Tweaking PHP

Tweaking PHP

Fixing bugs and security holes and speeding up PHP on server.

Timezone in PHP

First, check if timezone is defined with php -i | grep date.timezone.

[Date] ; Defines the default timezone used by the date functions date.timezone = Europe/Berlin

PHP .ini files

php --ini will show used .ini files. Note that this is for command line PHP.

Find some option in PHP .ini files

php –ini | sed -re ’s/([^/])(..ini)(.*)/\2/gi' | grep ‘/’ | xargs grep ‘timezone’

Check if php-fpm is runnung?

Check to make sure that php-fpm is running with ps aux | grep php, but you can do it also with service php5-fpm status

Configure command when building PHP

Usually, configure options are available as a result of available in

php -r 'phpinfo();' | grep -i 'configure'

Problem is - the Configure Command output was intentionally suppressed from Ubuntu & Debian PHP builds. So, the alternative it so use php-config:

apt-get install php5-dev 
php-config

There are a lot of other options interesting in this command. But the problem, again, is that it shows a configuration options for a CLI sapi, and not for FPM for example.

The last resort is to analyze from buildlogs. In my case, this was the most accurate. So Download build log for php5 on amd64 from here And look for phrase cd fpm-build.

For this last task, maybe we can use a script getbuildlog, part of a Debian’s huge devscripts package. But I want to install it manually, just for one time usage.

wget https://raw.github.com/nabetaro/devscripts-translation/master/scripts/getbuildlog.sh
chmod +x getbuildlog.sh

./getbuildlog php5

After that, start mining in downloaded files.

date 01. Jan 0001 | modified 28. May 2021
filename: Server - PHP Tweaking
Article Content