How to check directives for all installed PHP versions

PHP directives are PHP options that are usually configured in php.ini files. You can consult the list of PHP directives here https://www.php.net/manual/en/ini.list.php

On DirectAdmin servers, the php.ini files are located in /usr/local/phpXX/lib/php.ini where XX is the PHP version. For example, for PHP 7.2 the file will be /usr/local/php72/lib/php.ini . Many times, you might need to check a directive for all PHP versions. To do so, you can use this command:

grep directive_name /usr/local/php*/lib/php.ini

Example:

grep memory_limit /usr/local/php*/lib/php.ini

On a test server, the output is:

[root@web custombuild]# grep memory_limit /usr/local/php*/lib/php.ini
/usr/local/php70/lib/php.ini:memory_limit = 256M
/usr/local/php72/lib/php.ini:memory_limit = 128M
/usr/local/php74/lib/php.ini:memory_limit = 192M
/usr/local/php80/lib/php.ini:memory_limit = 128M
[root@web custombuild]#

As you can see, you can easily check the value for a directive (memory_limit in our case) for all PHP versions installed on the system.

Leave a Reply