Recently need to reinstall PHP, has been using XAMPP, basically do not need their own configuration, now ready to download the official original Apache and PHP, and slowly explore how to inherit the configuration.
I downloaded the Apache version for the 2.2.25,php version of 5.4.19, the Apache and PHP integrated configuration (PHP installation directory is: F:\php5.4.19
), remember that PHP default does not open the support of the GD library, you need to open it yourself. Then open PHP安装目录/php.ini
the configuration file and find the following:
; extension=php_gd2. DLL
Follow the online search method, remove the previous notation ";", and then restart the Apache server, the results found still no, through the phpinfo()
function still can not see any information related to the GD library. See a lot of online on the "PHP Open GD Library" article, are directly said a "remove the semicolon before xxx", there is no following. It turns out that the only way to do this is obviously not possible, at least the official zip version of PHP is not so configured.
So I had to check php.ini
the configuration, and finally found the following line:
; ="ext"
Obviously, the extension_dir
instructions are commented out, resulting in PHP even the folder ext can not find the extension library, it is not natural to find the Php_gd2.dll in the extension library, GD library support nature is not open.
Then, tiger to remove the extension_dir
annotation symbol in front of the instruction ";", restart the server again, the result ... It's still not working. It's not science, is extension_dir
there a problem with the value "ext" of the instruction? Finally in the official PHP document query learned such as:
Official description of the EXTENSION_DIR directive
PHP official said that the default location of the PHP5 Search extension library C:\php5
, so try to follow the official statement, still let Extension_dir remain commented out of the status quo, in the C drive under the new PHP5 folder, and then Php_ Gd2.dll copy it in, restart the server again, the result ... It's still not working.
At this point, through the phpinfo()
function to see that php.ini
there is no open extension_dir
command, the phpinfo()
extension_dir
value displayed on the display is actually-is the C:\php
official documentation also error, or PHP 5.4 This version has been changed, and the official documents have not been updated in time? The other first regardless of so many, first try to do C:\php
not, so the php5 renamed to PHP, everything else as usual, then restart the server, and then through the phpinfo () function to see the GD library has been opened. -This at least proves that in PHP 5.4.19, the default search location for the extension library is C:\php
.
Of course, it is well known that the extension_dir
directive is to support the absolute path, the above toss half a day, mainly to understand extension_dir
the role of the directive and influence. Finally, the extension_dir
previous comment symbol ";" Remove, and then change its value to the absolute path of the Ext folder, the detailed code is as follows:
="F:/php5.4.19/ext"
To sum up, for the official version of PHP, to open the GD library support, not only to remove extension=php_gd2.dll
the previous comment symbol, but also to remove the extension_dir
note before the instruction symbol, and its value for the corresponding modification. Of course, not only the GD library, if you need to open other PHP extension libraries, such as Php_mysql, Php_mysqli, the method is similar.