Jump to content

Archived

This topic is now archived and is closed to further replies.

fullyloaded

convert php4 to php5

Recommended Posts

hi

im having a big problem with my site the problem is it will only run under php4 any one have any idea how much work it would be to make it compatible with PHP5 i know you might have to see the code but will PHP4 to PHP5 Converter work software work?

Share this post


Link to post
Share on other sites

The fastes way I find to do this is run the site on php 5 and fix the errors you get. It sounds like hastle, but it won't actually take long at all.

 

4 to 5 doesn't usually cause a problem with scripts, backwards compatible is the problem in most cases. Have you tried your site on php5? You might (probably will) find that it just works as normal.

Share this post


Link to post
Share on other sites

hi

thanks for the fast reply yes i tried it on php5 and it will only show part of my site i checked the error log in my cpanel and there is no errors showing in there.

Share this post


Link to post
Share on other sites

Most php4 code works as is under php5, given the same php.ini configuration. Most problems are code that uses old deprecated features and functions that it should not have been using even under php4.

 

You would need to turn on full php error reporting (error_reporting set to E_ALL and display_errors set to ON in your php.ini) to get php to help you and you should do the conversion and testing on a development system, not a live server as there is a huge amount of time wasted continually uploading and testing files on a live server.

 

If you have a problem with a specific file and you want help with, you would need to post the file and the symptoms so that someone could examine what it might be doing that is php configuration specific.

Share this post


Link to post
Share on other sites

ok i did the php.ini error and this is what i got im hoping its easy to fix

Use of undefined constant ADMIN_PATH - assumed 'ADMIN_PATH' in /home/***/startup.php on line 6
Use of undefined constant MYSQL_DB_HOST - assumed 'MYSQL_DB_HOST' in /home/***/config.php on line 8
Use of undefined constant MYSQL_DB_USER - assumed 'MYSQL_DB_USER' in /home/***/config.php on line 9
Use of undefined constant MYSQL_DB_PASS - assumed 'MYSQL_DB_PASS' in /home/***/config.php on line 10
Use of undefined constant MYSQL_DB_NAME - assumed 'MYSQL_DB_NAME' in /home/***/config.php on line 11
Constant ROW_PER_PAGE already defined in /home/***/startup.php on line 38
Undefined index:  m_id in /home/***/startup.php on line 57

 

config.php

MYSQL_DB_HOST => "***",
MYSQL_DB_USER => "***",
MYSQL_DB_PASS => "***",
MYSQL_DB_NAME => "***"

 

startup.php

line 6 define(ADMIN_PATH,$script_path);

line 38 define($_db->f('constant_name'),$_db->f('value'));

line 57 $_db->query("UPDATE user  SET action='".$time_stamp."' WHERE user_id='".$_SESSION[u_ID]."'");

Share this post


Link to post
Share on other sites

The first 5 errors are due to incorrect syntax being used. These errors were always present in the code but were being hidden by the error_reporting/display_errors settings on the php4 system. These are not due to any php4/php5 difference.

 

The 6th error is a logic error in the code and is due to code or configuration data that is attempting to define a value more than once. Again, this error was probably always present in the code but was being hidden by the error_reporting/display_errors settings on the php4 system.

 

The above 6 errors don't prevent your code from working.

 

Only the 7th error potentially can affect if or how the code works and the line of code does not match the error message so it is hard to tell from the minimal amount of information provided which of several possibilities exist. Either sessions are not working (if that is the only session variable on the page), just one session variable is not being set (would indicate a problem in the code responsible for setting it), or that error always existed in the code but was being hidden on the php4 system due to the error_reporting/display_errors settings. This last error (based on the line of code, which as stated does not actually match the error message) is responsible for an UPDATE query, so if the symptom is an UPDATE query not working, then it could be an area of the code that needs to be investigated and fixed.

 

Nothing posted so far would account for the symptom you mentioned -

it will only show part of my site

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.