php configuration file in Ubuntu

This article is reproduced from: https://www.cnblogs.com/daizhuacai/archive/2013/01/16/2862429.html Author: daizhuacai Please indicate the statement when reprinting.

There are some differences between installing PHP through apt-get and compiling the configuration files manually. Here I only talk about the installation through apt-get (I haven't compiled it myself).

The configuration file is placed in the /etc/php5 directory by default.

‍The following are the details of the /etc/php5 directory on my machine:

--------------------------------

/etc/php5$>ls -l */

apache2/:

total 68

lrwxrwxrwx 1 root root 9 2010-11-22 23:21 conf.d -> ../conf.d

-rw-r--r-- 1 root root 67547 2010-10-15 22:33 php.ini

 

cli/:

total 68

lrwxrwxrwx 1 root root 9 2010-11-22 23:21 conf.d -> ../conf.d

-rw-r--r-- 1 root root 67545 2010-10-15 22:33 php.ini

 

conf.d/:

total 8

-rw-r--r-- 1 root root 54 2010-10-15 22:33 curl.ini

-rw-r - r-- 1 root root 52 2010-10-15 22:33 pdo.ini

-----------------------------------

 

It can be seen that there are three folders in the etc/php5 directory: apache2, cli, conf.d.

in:

 

There are php.ini files under apache2 and cli, and they are independent of each other;

There are conf.d under apache2 and cli, and they are all symbolic links pointing to ../conf.d (ie /etc/php5/conf.d).

Different SAPIs use different configuration files. If it is apache, use the configuration file in the etc/php5/apache2 directory, and if it is the command line (CLI), use the configuration file in the /etc/php5/cli directory. The *.ini files in the /etc/php5/conf.d directory are additional configuration files for a certain extension and are generic (so the other two directories have symbolic links to this directory).

From this we can know that the php configuration file is divided into two parts, one is the main configuration file (php.ini), and the other is an additional configuration file (such as the configuration file curl.ini for configuring an extension). In addition, different SAPIs have their own independent main configuration files (php.ini).

The above is the case of installing through apt-get. Typically, there is only one PHP configuration file, php.ini. All configuration information is in this one file. However, separate configuration makes configuration information clearer and more modular.

Information about the configuration file path can be found through phpinfo().

--------------

//showinf.php

<?php phpinfo(); ?>

------------------

Open showinf.php in the browser, you will see the relevant information, the following is an excerpt:

You can see that the system will automatically scan the *.ini files under conf.d.

Therefore, which configuration file to modify depends on the specific situation. For example, when running a web service as an apache module, you need to modify the php.ini under apache2, and when running as a shell script, modify the cli.

The configuration information of the add-on components is written to the respective ×.ini.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324201858&siteId=291194637