As I’m helping a dev figuring out a broken wp theme, I came over this, imho, super-tip on howto print contents of a variable to the httpd log file.
In this particular case I’ve narrowed it down to a variable that seem to behave different between a 2 minor wordpress versions.
file_put_contents('php://stderr', print_r($foo, TRUE))
Will print the content of variable $foo to the httpd log, in my case I put that into places in the code to track content for a couple variables in the code, I added a ‘mark’ as well to easily grep it from the weblog
file_put_contents('php://stderr', print_r('Here man: $foo', TRUE));
I found this over at stackoverflow.com
I’ve setup teampass, it may be the tool I need for a central password database where I work. There is a bug in the latest version, I noticed stuff like
*213 FastCGI sent in stderr: “PHP Notice: Undefined index: notification in /items.queries.php on line 942”
in the nginx error log. The solution is to do a :
ALTER TABLE teampass_items ADD notification VARCHAR(250) DEFAULT NULL;
in the teampass mysql db.
Got that from /github.com/nilsteampassnet/TeamPass/issues/130 .
I switched from stock Debian Squeeze php 5.3.x to dotdeb’s 5.3.10 yesterday on a lot of servers. Usually a minor upgrade shouldn’t introduce any major changes, but in this particular case I’ve come across several customers having encoding problems. It’s related to the mysql backend, which defaults to utf-8 and customers having code encoded in latin1 (iso8859-1 or iso8859-15), that is: they’ve encoded their stuff in mysql in latin1. It’s an easy fix, you simply have to specify your mysql encoding when connecting via php, f.example:
$link1 = mysql_connect('localhost','user1','pass1',TRUE);
More info at php.net
Came over this one on a stripped down, chroot’ed, shell server. The php date() function need access to files in /usr/share/zoneinfo , zoneinfo wasn’t inside the chroot so the fix was easy:
# cp -a /usr/share/zoneinfo /path/to/chroot/usr/share/
setting up Apache, mysql and php on a Centos box. Centos default to
short_open_tag = Off
In php.ini. This means if you’re like me and throwing up a phpinfo.php script to test php after installation, remember to either set this setting to On, or remember to specify php in top of you php scripts (I’ve goten lazy, haven’t specified that for a while) .
While I’m at it, got to rant a bit about:
Debian just makes it all so much easier configuring Apache !!
I’ve been strugling to get my head around configuring phpmyadmin for a multiuser setup. For one thing I don’t want users to enable ‘statistics’ through phpmyadmin ’cause it generates to much traffic between the phpmyadmin server and our mysql backend server. I also want to hide mysql variables and phpmyadmin ‘status’ tab mainly because of security .
I phpmyadmin theres a ./libraries/server_links.inc.php file where you can comment out the code related to the tabs ‘databases’, ‘status’ and ‘vars’ tab’s.
* Displays tab links
$tabs = array();
/*$tabs['databases']['icon'] = 's_db.png';
$tabs['databases']['link'] = 'server_databases.php';
$tabs['databases']['text'] = $strDatabases;*/
$tabs['sql']['icon'] = 'b_sql.png';
$tabs['sql']['link'] = 'server_sql.php';
$tabs['sql']['text'] = $strSQL;
/*$tabs['status']['icon'] = 's_status.png';
$tabs['status']['link'] = 'server_status.php';
$tabs['status']['text'] = $strStatus;*/
/*$tabs['vars']['icon'] = 's_vars.png';
$tabs['vars']['link'] = 'server_variables.php';
$tabs['vars']['text'] = $strServerTabVariables;*/
$tabs['charset']['icon'] = 's_asci.png';
$tabs['charset']['link'] = 'server_collations.php';
$tabs['charset']['text'] = $strCharsets;
$tabs['engine']['icon'] = 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = $strEngines;
[ ... ]
Now those tab’s are hidden, but for hack’ish users, they can probably call for instance server_databases.php directly, so I’ve removed those files entirely from the phpmyadmin webroot ..
Note: According to wiki.phpmyadmin.net I should be able to disable the ‘statistics’ link with
$cfg['ShowStats'] = FALSE;
in config.inc.php, but in my setup with phpmyadmin 3.3.9 I just couldn’t make that happen.