简体   繁体   中英

After I've downgraded my wamp PHP version to 5.2.11, how can I get Apache to start?

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.

The ereg function was "depreciated" as of PHP 5.3... Depreciated does not mean it was removed, all it means is that every time it's used, a "notice" (not error) message will be logged (and in some cases displayed on screen). That is, it's still valid in PHP 5.3. And I don't believe it was removed in PHP 5.4 if memory is correct. I think it will only be removed in PHP 6.

All you have to do is configure your php.ini settings to not log or display the E_DEPRECATED notice .

Here are the php.ini lines from my WampDeveloper Pro set up, just find the same directives in WampServer and adjust...

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

The first line will use all levels, and then remove the notices, depreciated, and strict-coding levels.

That last line you might or might-not want to be On or Off depending on if this is a dev system or a production system (security reasons).

You can also just leave it all as-is, and not log repeat messages ... that way you still know what's going via the logs, but they are not filled up with the same message over and over:

ignore_repeated_errors = On

But whatever you do, don't use PHP 5.2, it's full of bugs, performance, compatibility, and security problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM