Very often, the user needs to change PHP settings in one way or another to work with scripts. There are two possible options.
Case 1. It is necessary to make changes at the PHP compilation (assembly) level (adding modules, changing PHP_INI_SYSTEM system options).
Case 2: it is enough to change the value of one or more options that have the mutable status PHP_INI_PERDIR or PHP_INI_ALL.
Let us recall the meaning and decoding of the PHP_INI_* constants:
PHP_INI_USER | 1 | The option can be set in user scripts |
---|---|---|
PHP_INI_PERDIR | 2 | The option can be set in php.ini, .htaccess or httpd.conf |
PHP_INI_SYSTEM | 4 | The option can be set in php.ini or httpd.conf |
PHP_INI_ALL | 7 | The option can be installed anywhere |
In the first case, when we need to change the PHP configuration by adding new modules (imap, templates, curl), with which our modular PHP is not built. If so, you need to build your PHP. After assembly, it is recommended to copy our INI file:
/usr/local/etc/php.ini
or
/usr/local/etc/php.ini
depending on the type of SAPI interface used (cgi or cli).
In the second case, when you do not need to use any additional modules, but only need to change the value of the directives managed in php.ini, you should simply copy the already assembled php-SAPI executable file to the site and perform the necessary actions with .htaccess:
/usr/local/bin/php-cgi
or
/usr/local/bin/php
depending on the type of SAPI interface used.
If the set values of the directives in our INI files match the desired ones, there is no need to copy the INI file. In particular, such actions are carried out when it is necessary to increase the memory_limit value for PHP. If you intend to change the directives in php-SAPI.ini, you should copy it, similar to the method described above.
ls /usr/local/etc/php.ini | awk '{print $1}' | xargs grep memory_limit
/usr/local/etc/php.ini: memory_limit = 32M
Please pay special attention to the fact that if, as a result of adding your directive, you received an error or did not get the desired result, then it is likely that configuring the corresponding parameter is simply not available at this level. If this is the case, try building your own PHP, but first, please check with our technical support to see if you really need your own PHP in this situation.