2012-07-13

Scratch of the day - php throwing stricts error on browser

Today, I had to setup a Postgresql database server with phpPgAdmin web interface. While visiting the web interface for the first time, this error message appears on the top :







Strict Standards: Only variables should be assigned by reference in 
/usr/local/www/phpPgAdmin/classes/database/Connection.php on line 23

Warning: Cannot modify header information - headers already sent by 
(output started at /usr/local/www/phpPgAdmin/classes/database/Connection.php:23) 
in /usr/local/www/phpPgAdmin/classes/Misc.php on line 540

Seems like php 5.4.4 imposed some extra measure as best practice.

Although phpPgAdmin works as usual, the error message is annoying. Plus, it is kind of bad to show what potentially can be exploit.

To turn off these error messages, just tweak the below parameter in /usr/local/etc/php.ini :

display_errors = Off

By default it is turned on. Restart Apache to reload php.ini.

This could also happen in the absents of /usr/local/etc/php.ini, which the parameter (display_errors) is default to On. In this case, create the file with installed template of php.ini. E.g.

cp php.ini-production php.ini

Then restart Apache to reload php.ini.

Hasta la vista !!!

1 comment:

Tom said...

This broke phpPgadmin for me until I applied the fix outlined in your post. Before that, i got: Error Loading all_db.php?subject=server&action=tree&server=%3A5432%3Aallow (???)

in the sidebar.