PHP 5.3 error

We are currently using PHP 5.2.17, after transition to PHP 5.3 webpage (prof 2.2.4) will stop working (blank page) and will return this error log:


[quote]PHP Fatal error: Cannot redeclare class Templater_Compiler in Unknown on line 0[/quote]





Any solution?



THX

The templater class (core/class.templater.php) should only be included once in core/fn.init.php. If it's being included elsehwere, then that's the source of your problem.



It has nothing to do with the version of PHP. Php 5.x will also generate an error if a class is defined multiple times.

Clear cache from:



/var/cache/

/var/compiled/




Most likely you haven't cleared it and it's rendering 'old' cached code.

It is clean instalation, all files are without changes. I have also tried to turn all add-ons off but it is still the same. We have tried new PHP 5.4 now, page is working but error_log is full of new problems.



Example:


[quote]

PHP Warning: Illegal string offset 'product_id' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%F4^F4E^F4E7AEF6%%grid_mimi1.tpl.php on line 122, referer …

PHP Warning: Illegal string offset 'product_id' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%F4^F4E^F4E7AEF6%%grid_mimi1.tpl.php on line 123, referer …

PHP Warning: Illegal string offset 'price' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 8, referer …

PHP Warning: Illegal string offset 'zero_price_action' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 8, referer …

PHP Warning: Illegal string offset 'zero_price_action' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 8, referer …

PHP Warning: Illegal string offset 'price' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 8, referer …

PHP Warning: Illegal string offset 'zero_price_action' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 8, referer …

PHP Warning: Illegal string offset 'product_id' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 32, referer …

PHP Warning: Illegal string offset 'product_id' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 48, referer …

PHP Warning: Illegal string offset 'product' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 49, referer …

PHP Warning: Illegal string offset 'product' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 50, referer …

PHP Warning: Illegal string offset 'zero_price_action' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 118, …

PHP Warning: Illegal string offset 'tracking' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 118, referer …

PHP Warning: Illegal string offset 'is_edp' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 118, referer …

PHP Warning: Illegal string offset 'has_options' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 118, referer …

PHP Warning: Illegal string offset 'tracking' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 231, referer …

PHP Warning: Illegal string offset 'is_edp' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 231, referer …

PHP Warning: Illegal string offset 'avail_since' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 233, referer …

PHP Warning: Illegal string offset 'qty_content' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 762, referer …

PHP Warning: Illegal string offset 'is_edp' in /data/m/i/xxxxx.com/web/var/compiled/customer/%%C0^C0D^C0D66DDE%%product_data.tpl.php on line 762, referer …

PHP Strict Standards: Non-static method Cache_backend_sqlite::_db_init() should not be called statically in /data/m/i/xxxxx.com/web/core/cache/class.cache_backend_sqlite.php on line 113, referer …

PHP Strict Standards: Declaration of Templater::display() should be compatible with Smarty::display($resource_name, $cache_id = NULL, $compile_id = NULL) in /data/m/i/xxxxx.com/web/core/class.templater.php on line 24, referer …

PHP Strict Standards: Non-static method Cache_backend_sqlite::_db_init() should not be called statically in /data/m/i/xxxxx.com/web/core/cache/class.cache_backend_sqlite.php on line 113, referer …

PHP Strict Standards: Declaration of Templater::display() should be compatible with Smarty::display($resource_name, $cache_id = NULL, $compile_id = NULL) in /data/m/i/xxxxx.com/web/core/class.templater.php on line 24, referer …



[/quote]



Did anyone tried PHP 5.4?

PHP 5.4 has E_STRICT set on by default, which causes this error:-


[quote]PHP Strict Standards: Declaration of Templater::display() should be compatible with Smarty::display($resource_name, $cache_id = NULL, $compile_id = NULL) in /data/m/i/xxxxx.com/web/core/class.templater.php on line 24, referer …[/quote]



edit config.local.php change this:-



if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~E_DEPRECATED);
}




to this


if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~(E_DEPRECATED | E_STRICT));
}




This will fix this error, other errors may other issues such as cache not cleared.

Thanks, it works already. No error.

Everything was ok more than week. but its happening again and no changes were done, so I dont understand. and this appeared in loggs:



PHP Warning: SQLite3::query(): Unable to execute statement: database is locked in

having the same problem on my localhost. Just reinstalled lastet xampp and i get this error on category list. Tried all that you guys wrote and cleared cache yet still i'm getting this error.

Any suggestions?



thanks,

I just moved my development site (CSC 3.0.3) to a new server and I am having the same issue.



I have tried Jesse and Adrian's suggestions to no avail.

Jeremy,



if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~E_DEPRECATED);
}




//if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
//error_reporting(error_reporting() & ~E_DEPRECATED);
//}


// Disable notices displaying
error_reporting(E_ALL ^ E_NOTICE);
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~E_DEPRECATED & ~E_STRICT);
}




Here is the code in my conf.local.php file



I have cleared the cache and the error persists. Excuse my ignorance Jesse, but are you telling me to comment out the code altogether?

[quote name='ticeholdings' timestamp='1352225858' post='148462']


// Disable notices displaying
error_reporting(E_ALL ^ E_NOTICE);
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~E_DEPRECATED & ~E_STRICT);
}




Here is the code in my conf.local.php file



I have cleared the cache and the error persists. Excuse my ignorance Jesse, but are you telling me to comment out the code altogether?

[/quote]



Yup, because when that code has been removed the error won't show on page, but in error_log or similar.

If you have a live store, commenting out the code and then working out the actual error on a development store is the way to go.

I had to recompile apache and add fastcgi as a handler for php to alleviate this issue.

I had major problems with PHP 5.4 with similar error reporting issues as above running local host on OSX. None of the above solutions worked. Uninstalled it and dropped back to PHP 5.3 - and everything was OK again.



My advice: don't go to PHP 5.4 yet.

In my situation works (php 5.4.8):



cofig.local.php:


<br />
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {<br />
error_reporting(error_reporting() & ~E_ALL);<br />
}<br />

anielska you are the man ,

on my older server the above code was fine but i have this new one php 5.4.0 and only yours erased them all. like magic.



for php 5.4. use

if (version_compare(PHP_VERSION, '5.3.0', '>=')) {

error_reporting(error_reporting() & ~E_ALL);

}

and it should work like magic .



thanks anielska.

Just started to get this error message on my CS Cart at www.riderz.co.uk



[b]Strict Standards[/b]: Declaration of Templater::display() should be compatible with Smarty::display($resource_name, $cache_id = NULL, $compile_id = NULL) in [b]/homepages/46/d68340725/htdocs/riderz/core/class.templater.php[/b] on line [b]28[/b]




I have attempted to edit the config.local file as above (several methods tried) but if I alter the code as described the error message no longer appears but I cannot access any individula product pages (category pages load fine as do all other pages but a product page from the front end or admin will not load, I just get a 500 error (eventually)





[b] Internal Server Error[/b]

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webadmin@kundenserver.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.








Thanks in advance for any help

Sorry, should have mentioned that it's on 1and 1 servers and running PHP 5.4.11

CSC is not compatible with php 5.4.

But it's been running on 5.4 for months without issues ?



EDIT:

Whatever 1and1 had done has now been changed again, so my product pages now load, need to do some more checks to make sure everything is working