简体   繁体   中英

MAMP php5 strict standards

I am trying to set error_reporting to E_ALL & ~E_STRICT in php.ini of mamp.

But this is not getting affected at all. I confirmed that I am editing right file by setting different error_reporting like E_NOTICE and checked phpinfo to verify the same.

But only ~E_STRICT is not happening.

When I visit my cms (concrete5) it gives me a list of strict errors ( pasting first few below ):

Strict Standards: Non-static method Cache::get() should not be called statically in www/concrete/models/package.php on line 78

Strict Standards: Non-static method Cache::key() should not be called statically in www/concrete/libraries/cache.php on line 117

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in www/concrete/libraries/cache.php on line 121

tried to set error_reporting to E_ALL & ~E_STRICT in .htaccess and also index.php file. none worked.

Solution please.

Concrete5 has a setting that will suppress display of errors and warnings (and notices I presume) -- in the Dashboard -> System & Settings -> Environment -> Debug Settings. It's possible that you have this set to hide all errors/warnings -- which will override your settings in the config file.

As for @PeeHaa's comment about suppressing errors instead of fixing them, well it's not as simple as that because the Concrete5 CMS itself has a TON of php that will generate notices. I assume this is because of code that was written years ago before certain things were deprecated. For example, there are a ton of system functions that get called statically even though the function is not declared as "static". This was an okay thing to do in older versions of PHP but is now frowned upon. Unfortunately I don't think there's anything you can do about this.

This is unfortunately one of the trade-offs with using Concrete5. It's the best CMS out there, but it is not always the most sophisticated platform for more advanced developers.

It's very tricky to get Concrete5 to ignore these errors and load a page (including the Dashboard). Your best bet is to downgrade PHP to the latest 5.3.X until a PHP 5.4.X compatible version is released.

I got this resolved by moving from mamp to xampp on my imac.

issue with mamp: it does not allow us to use php 5.3 unless we have mamp pro

solution that I used: I moved to xampp with php 5.3 and everything worked smooth.

If MAMP appears to be ignoring settings in php.ini (eg. E_STRICT) then chances are you are not editing the correct file. You can see which config file is being loaded with phpinfo();

Look for this line: Loaded Configuration File: /Applications/MAMP/bin/php/php5.4.4/conf/php.ini

Notice how it is in MAMP/bin on my machine. With the default MAMP installation it is easy to mistake the template config files for live config files.

E_STRICT is not ignored by MAMP when set in the correct place.

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