Generally installed after PHP, Apache and can not process PHP files, to make PHP with the Apache server integration, you must modify the configuration file, here I teach you how to configure the PHP installation files.
Method/Step
First, add the following code to the httpd.conf in the Apache conf directory:
loadmodulephp5_module~php Installation Path/php5apache2_2.dll
Phpinidir "~php Module Installation Path"
Addtypeapplication/x-httpd-php.php.phtml
Here I have a simple explanation for the above code, the whole code means to let Apache load the PHP processing module (loadmodulephp5_module), the code "~php installation Path" is based on the location of your installation of PHP changes, such as I was installed in D disk, So my path is: D:\Myenv\php-5.3.5 (note that the oblique bar here is a backslash "\", in the code to be changed to a positive oblique bar "/"), the code to join the position is in the httpd.conf a lot of loadmodule under the join can be, as shown in the following figure:
Then you need to check if there is a file "Php5apache2_2.dll" in the directory you just added, theoretically it should be, in case you have to check it, this document is very important and plays a role as a bridge.
Next we need to specify the PHP initialization directory, which is the code "Phpinidir ' ~php Module installation path", which is used to specify the PHP INI file, the file will be configured for PHP, popular point that you need to tell Apache where your PHP, In the same way, we replace the "~php Module installation path" in the code with just the installation path.
And then I'll explain to you what the last line of code means, "addtypeapplication/x-httpd-php.php.phtml" means to add an application type, and vernacular explain that when a *.php file appears, PHP starts processing the file. You can add annotations to your configuration file to help you understand them, as shown in the following illustration:
So, we need to change the path of the place there are two, the following figure with the red part, the red part to the actual installation of the PHP path you can (note is a positive oblique rod)
In addition to PHP file settings are also very important, in your PHP installation directory to find the Php.ini-development file and then renamed to PHP.ini, change this reason is: our PHP settings need to modify in php.ini. Picture below: Delete The dark blue part of the name.
After the change, the file looks like this, the following figure:
Now we need to be able to specify the corresponding function module in the php.ini, by the following code "
extension_dir= "PHP Extension Library path" is added to the php.ini file you just modified. The goal is to be able to use PHP's various powerful libraries, and the "PHP Extension Library path" in your installation of PHP folder has a "Ext" folder, open the folder is a PHP extension library. The following figure:
Now let's add the extension library path, open the "php.ini" file with your Notepad, find the "Extension_dir" location, and use the lookup to quickly locate the location. The following figure:
Then the location of "extension_dir= ' ext '" to your PHP library path, in my case, my library path is: D:/myenv/php-5.3.5/ext (the same note is a positive oblique rod), the following figure: replace the blue part of your library path can be.
The final replacement result is the following figure:
Now that our consolidation has been completed, we can test the success. Test method: Invoke a simple PHP function, the function code is as follows:
Then restart your Apache to see if you can use it.
If you integrate successfully, you can see the following shocking effect.
How to integrate Apache and PHP together, through the above people's thinking is not more clear, if the article is also satisfied with the price, just point a praise bar