0

I'm trying to run a PHP application full of depracted ereg calls. I got the wampserver extension to switch from PHP 5.3.10 to 5.2.11, where that function is still valid, but when I try to start my services Apache won't start. I'm using Apache 2.2.11, PHP 5.2.11, and MySQL 5.5.20 on Windows 7 x64. The index.php page I'm trying to load comes up when I use PHP 5.3.10, albeit with a lot of errors about my ereg functions.

I get that I can go through all my PHP files and update the code to modern usage, but shouldn't I be able to use wampserver's PHP version extensions, since they're offered?

I've tried copying .dll's from /wamp/bin/php/php5.2.11/ directly into /wamp/bin/ but it looks like the installer for the 5.2.11 extension had taken care of that already. It also seems to have updated php.ini during install.

The Apache error log shows zero activity when I try to start wamp services. Not even notices.

I'm pretty new to Apache and PHP so I'm not sure what relevant info I could paste from php.ini or httpd.conf but if there's anything in either of those that you think would be helpful to work toward a solution, let me know and I'll paste it.

4

1 回答 1

1

自 PHP 5.3 起,该ereg功能已“折旧”...折旧并不意味着它已被删除,它意味着每次使用它时,都会记录一条“通知”(不是错误)消息(并且在某些情况下会显示在屏幕)。也就是说,它在 PHP 5.3 中仍然有效。如果记忆正确,我不相信它在 PHP 5.4 中被删除。我认为它只会在 PHP 6 中被删除。

您所要做的就是将您的 php.ini 设置配置为不记录或不显示E_DEPRECATED notice.

这是我的WampDeveloper Pro设置中的php.ini行,只需在WampServer中找到相同的指令并调整...

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
display_errors = On

第一行将使用所有级别,然后删除通知、折旧和严格编码级别。

根据这是开发系统还是生产系统(安全原因),您可能希望或可能不希望打开或关闭最后一行。

您也可以保持原样,而不是记录重复消息......这样您仍然可以通过日志知道发生了什么,但它们不会一遍又一遍地填充相同的消息:

ignore_repeated_errors = On

但无论你做什么,都不要使用 PHP 5.2,它充满了 bug、性能、兼容性和安全问题。

于 2013-05-26T14:33:15.423 回答