PHP and Apache installation configuration instance sharing

Source: Internet
Author: User
Tags apache php phpinfo
This article is mainly to share with you PHP and Apache installation configuration examples, hope to help everyone.

First, install Apache

1. Login http://httpd.apache.org/download.cgi

2. Select a version of the "Files for Microsoft Windows" option to enter the download page;

3., select the first item "Apachehaus", in the new interface, you will find VC11 and VC14, here note, it is important to remember that the choice of VC11 and VC14 is consistent with the choice of PHP after.

4. After the download is complete, unzip the file to a folder, such as C:\Apache

5. Open the C:\Apache\conf\httpd.conf file with Notepad, locate the: Define Srvroot, set the Define srvroot "C:\Apache", the value set here is the location of the previously unzipped folder.

If you need to modify the port, continue to find Listen 80 and change 80 to the port you want to set.


6, start Apache HTTP Server using Windows command line as administrator to enter the Bin folder under the Apache program folder, enter Httpd-k install, complete the installation of Apache service.

7. Double-click C:\Apache\bin\ApacheMonitor.exe to open the Apache console. After you click Start, enter http://localhost, and the following page shows that the installation was successful.

Two. Install PHP

1. Log in to http://www.php.net/, choose the version you want to install, it is important to note that the version selection VC11 and VC14 must be consistent with the previous Apache selection. X86,x64 must be consistent with the actual situation of the machine.

2. Unzip the downloaded file to a folder, such as C:\php, and copy the root directory under Php.ini-production and rename it to php.ini;

3. Set the environment variables to add C:\php and C:\php\ext to the environment variable path, which is added at the end of the path variable; C:\php; C:\php\ext

Three integrated Apache and PHP

1. Open C:\Apache\conf with Notepad

Find ServerRoot, modify ServerRoot "C:\Apache" (here is where you put the Apache installation package after you unzipped it)

Find #servername www.example.com:80, modify to ServerName www.example.com:80 (remove the previous #)

Find DocumentRoot "C:/apache/htdocs", modify to DocumentRoot "C:/apache/htdocs" (if same, do not change)

Find <directory "C:/apache/htdocs" >, modify to <directory "C:/apache/htdocs" > (if same, do not change)

Find DirectoryIndex index.html, modified to DirectoryIndex index.html index.php index.htm (Here we have added index.php index.htm)

Find scriptalias/cgi-bin/"c:/apache/cgi-bin/", modify to Scriptalias/cgi-bin/"C:/apache/cgi-bin" (if same, do not change)

Find <directory "C:/apache/cgi-bin" > Modify to <directory "c:/apache/cgi-bin/" > (if same, do not change)

in c \ apache\conf\httpd.conf last line add add LoadModule php5_module "C:/php/php5apache2_4.dll" Let Apache support PHP (please confirm c:/php/ There is a php5apache2_4.dll, if you download is I provide the connection must be some)

Add AddType application/x-httpd-php. php. html. htm

Add Phpinidir "f:/phptools/php5.5" (Tell Apache PHP.ini location)

At this point, httpd.conf configuration is complete, save httpd.conf.

2. Open F:\php\php.ini with Notepad

Will Extension_dir = "ext" modified to Extension_dir = "ext" (remove the semicolon in front of extension)

Change the Extension=php_mbstring.dll to Extension=php_mbstring.dll (remove the semicolon in front of the extension, which is the PHP multibyte string extension)

Change the Extension=php_mysql.dll to Extension=php_mysql.dll (remove the semicolon in front of the extension)

Change the Extension=php_mysqli.dll to Extension=php_mysqli.dll (remove the semicolon in front of the extension)

Third, testing

Create phpinfo.php under C:\Apache\htdocs, write to <?php phpinfo ();

Open the Apache service, enter http://localhost/phpinfo.php in the browser, the following page appears, the integration is successful!

Resolution of the "Cannot load Php5apache2_4.dll into server" issue

This problem occurs because Apache does not match PHP's v11,v14 version, or PHP's x86 and x64 versions are selected incorrectly. So be sure to select the matching version when downloading.

Also note the PHP version number PHP5Apache2_4.dll

Related recommendations:

PHP + Apache Installation configuration

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.