0

I migrated a PHP website running ob ubuntu 10.10 server to another unbutu 12.04 server. Now some php functions are Deprecated and some can't find the right "path" they are looking for. The old server was running php 5.3.3 the new one has php 5.3.10 (so no real big difference)

Some links were written like this :

"../modules/xxx.php"

and I just changed the name to the fullpath and it is working.

Due to the fact, that the website is fully working on the old server, the configuration should be "ok". Do you guys think there is any other reason for this errors than the version of php ? I think about downgrading php to 5.3.3 on the new server for the test.... But I wont do it, when there might be other reasons.

Some error examples :

 Deprecated: Function split() is deprecated in /data/
 Warning: include(modules/mdl_users/settings.conf.php): failed to open stream: No such file or directory in /data/xxx/www/classes/module.class.php on line 35

he can't open the files when one part of the path was written by a function like this

include($this->registry->admin_path."modules/".$this->name."/settings.conf.php"

so obviously the configuration in php has been changed somehow. since the website is not mine, I don't want to change 100 paths manually. Do you think downgrading will "repair" this issue?

Thanks in advance

3
  • Downgrading probably would because the problem is deprecated and old code. You should fix it instead of using old versions of PHP.
    – Repox
    Aug 19, 2013 at 12:55
  • It was probably deprecated on the old server also, it was probably a different error reporting setting in your php.ini Aug 19, 2013 at 13:02
  • Yes probably, but why isn't the page working if these errors are not responsable for that? on the old server the page is 100% working. i just copied the path and configurated my apache2 correctly. and it was displaying a blank page, which means => php problem Aug 19, 2013 at 13:09

2 Answers 2

1

It sounds to me that the php.ini file just has different options selected on the new server. For instance, you can hide the deprecated warnings in the errors section of php.ini.

If those warnings were set to be hidden on your old server, and set to be displayed on your new server then this is why you are seeing them all of a sudden.

I doubly very much the minor version upgrade of PHP will be a problem. It's still 5.3 after all. The PHP config is almost certainly the cause of the issues.

The best thing to do would be to do a file compare from both the old and new php.ini files if you have access.

Alternatively, you can set most php.ini options at runtime in your code if you need to.

3
  • i already copied the php.ini from the old computer and it is not working :( Aug 19, 2013 at 13:10
  • ah ok. i now try to copy all loaded ini files which are displayed in the info.php and copy them to the new server. i hope this helps. Aug 19, 2013 at 13:13
  • Yes only 1 PHP.ini file will be loaded and phpinfo() will tell you the path to it. You can't just copy the old config file to the new server though as it will contain server-specific details e.g. File paths etc. Far better to file compare the two files to highlight the differences. Kdiff is a nice tool for this. You need to look at the differences between both files, and bring over the changes you need like the error masking etc. Aug 19, 2013 at 20:19
1

split() function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

preg_split() is the suggested alternative to this function. If you don't require the power of regular expressions, it is faster to use explode().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.