How Apache and PHP are integrated together, apachephp integrated _php Tutorials

Source: Internet
Author: User

How Apache and PHP are integrated together, apachephp integration


Generally installed PHP, Apache can not process php files, in order to make PHP and Apache server integration, you must modify the configuration file, here I teach you how to configure the PHP installation files.

Method/Step

First, in the Apache conf directory of httpd.conf, add the following code:

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 of the above code, the whole code means to let Apache load PHP processing module (loadmodulephp5_module), the code "~php installation Path" is based on the location of your PHP installation change, such as I was installed in the D disk, So my path is: D:\Myenv\php-5.3.5 (note here the Oblique bar is the anti-oblique bar "\", in the code to be changed to a positive oblique bar "/"), the code is added to the position is in the httpd.conf there is a lot of loadmodule to join, as shown in:

Then you need to check if there is a file "Php5apache2_2.dll" in the directory you just added, theoretically, in case you have to check it, this file is very important and plays a role as a bridge.

Next we need to specify the PHP initialization directory, that is, the code "Phpinidir ' ~php Module installation path '", this code is used to specify the PHP INI file, the file will be configured in PHP, the popular point is that you need to tell Apache where your PHP has been put, In the same vein, we replace the "~php Module installation path" in the code with the installation path just before

Then I'll explain to you the last line of code, the meaning of "addtypeapplication/x-httpd-php.php.phtml" is to add the application type, with plain English to explain that, when the *.php file appears, PHP will start processing the file. You can add comments to your profile to make it easier for you to understand, such as:

So, we need to change the path of the place there are two, such as the red flag part, the red part of the change to you actually install the PHP path (note is a forward diagonal bar)

In addition to the PHP file settings is also very important, in your PHP installation directory to find the Php.ini-development file and change the prefix name to php.ini, the reason for this is: our PHP settings need to be modified in php.ini. such as: Remove the dark blue part of the name.

After the change is done, the file looks like this:

Now we need to specify the corresponding function module in PHP.ini, by the following code "

Add the extension_dir= "PHP Extension Library path" to the php.ini file you just modified. The purpose of this is to be able to use PHP's various powerful libraries, and "PHP Extension Library path" in your installation of PHP folder under the "Ext" folder, open the folder is the PHP extension library. Such as:

Now let's add the extension library path, open the "php.ini" file with your Notepad, find the "Extension_dir" location, and you can use find to quickly locate the location. Such as:

Then change the location "extension_dir= ' ext '" to the path of your PHP library, in my case, my library path is: D:/myenv/php-5.3.5/ext (same note is a forward slash), such as: Replace the blue part of your library path.

The final replacement results are as follows:

Now that our integration is complete, we can test the success. Test method: Call a simple PHP function, the function code is as follows:

<?phpphpinfo ();? >

Then restart your Apache to see if it can be used.

If you integrate successfully, you will be able to 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 a praise it

http://www.bkjia.com/PHPjc/1060090.html www.bkjia.com true http://www.bkjia.com/PHPjc/1060090.html techarticle how Apache and PHP integrate together, apachephp integration generally installed PHP, Apache can not process php files, in order to make PHP and Apache server integration, you must modify the configuration text ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.