@ TonyX , currently ranked No. 1, is right and gives a general solution to all questions. However, there is no direct answer to this question. If I were the subject of the question, I would not want such an answer.
back to the main question of the building, why copy to that directory? at that time, because PHP specified the configuration file directory when compiling, and the specified directory was / usr/local/php/lib, so when PHP starts, it will read the configuration file of php.ini in that directory. Not copying will not affect the normal operation of PHP. It's just that configuration items cannot be added. To see which directory the current PHP will go to find the configuration file, you can see it in phpinfo () (you can also run php-I on the command line), and you can see the items' Configuration File (php.ini) Path' and 'Scan this dir for additional .ini files', which records the path where the PHP loads the .ini configuration file.
it is recommended that the subject download a copy of PHP's source code and try to compile and run it again.
the lessons learned on paper are not profound and must be put into practice.
-- "Reading in Winter Night"
this has been done.
make a mistake.
-- "Lu's Spring and Autumn period"
it is better to believe in a book than to have no book at all.
Mencius. Try your best to "
"
The main purpose of the
question is to understand that most of the information on the Internet is rubbish. We should learn to screen information, have our own judgment, and practice to produce true knowledge.
. You don't need a complicated copy to that directory,
Copy to the php.ini configuration file directory specified by configure when you compile and install.
Usually / usr/local/php/etc this directory.
you can run normally without copying it. Take a look at which php.ini. is loaded in phpinfo
There are some items in
/ usr/local/php/lib/php.ini that you configure at compile time. If you don't configure them, then the files here are the same as the relevant configuration items when PHP starts by default, so you don't need to copy them.
as long as php can find phpini at runtime, you can put it there
when compiling php, if it is not specified-- with-config-file-path, is the above directory by default:
-- with-config-file-path=PATH
Set the path in which to look for php.ini [PREFIX/lib]
therefore, you need to copy it to the lib directory.
When php runs without php.ini, the default parameter values are used.
shell, type php-- ini
View the configuration loaded by PHP.
there is no php.ini file, and php loads the default configuration, so there are no errors.
The php.ini file is specified to give you more flexibility in configuring php, not required
the location copied to is the location of with-config-file-path, which is the parameter when installing php. This file is specified mainly for flexible configuration
.
I've come across that when compiling and installing php7, you specify the location of-- with-config-file-path, and there is php.ini, under the specified location, but / usr/local/php/lib/php.ini is still loaded. It shows that I am very confused.
Hello I also encountered this question related link: https://codeshelper.com/q/10.
can you help me answer it? Thank you