Jump to content

convert php4 to php5


fullyloaded

Recommended Posts

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.

Link to comment
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.

Link to comment
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]."'");

Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.