PHP "failed to open stream" after migration from one server to another, others are Deprecated, why?

StackOverflow https://stackoverflow.com/questions/18314284

Вопрос

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

Это было полезно?

Решение

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.

Другие советы

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().

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top