Jump to content

How can i convert php4 code to php5 code?


colap

Recommended Posts

Hi,

 

How can i convert php4 code to php5 code?

Is there any script to covert?

I tried to install php4tophp5.exe but it doesn't install.

A project is written in php4 using CMS.

Now i need to convert it.

Can anyone help me to figure it out?

 

Thanks.

Link to comment
Share on other sites

The best way to do this is really going to be the manual approach. Put your CMS on a server with PHP5 and turn on full error checking:

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

 

The work through the warnings and errors, you will get a lot more warnings than fatal errors. work through and remove the depreciated functions and replace them with their php5 counterpart for each warning given. Shouldnt take more than a few hours

Link to comment
Share on other sites

Hi,

 

How can i convert php4 code to php5 code?

Is there any script to covert?

I tried to install php4tophp5.exe but it doesn't install.

A project is written in php4 using CMS.

Now i need to convert it.

Can anyone help me to figure it out?

 

Thanks.

 

http://www.php.net/ChangeLog-5.php

 

More than likely, you're not going to need to change any code... maybe bits and pieces at best.

Link to comment
Share on other sites

It's depricated, how can i convert it into php5 code?

$_VERSION =& new version();

 

$_VERSION = new version();

 

I'm not sure that will give you an error, but in PHP 5 objects are passed by reference by default so you don't need the &.

Link to comment
Share on other sites

The best way to do this is really going to be the manual approach. Put your CMS on a server with PHP5 and turn on full error checking:

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

 

The work through the warnings and errors, you will get a lot more warnings than fatal errors. work through and remove the depreciated functions and replace them with their php5 counterpart for each warning given. Shouldnt take more than a few hours

 

Where would i put these lines?

ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

 

Link to comment
Share on other sites

at the very top of your php scripts.

<?php
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);

// rest of script.

 

note that you said this was a cms which could indicate ( and dont quote me lol) that it may be using the (MVC Pattern). which means that everything is routed through one page (usually the index.php). If this is the case then u only need to add it into the index page

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.