A detailed installation of the PHP development environment under Windows

Source: Internet
Author: User
First, Apache

Because the Apache website only provides source code, if you want to use it must be compiled yourself, here I choose the third party installation package Apache Lounge.

    • Enter Apachelounge official download address:http://www.apachelounge.com/download/

    • First download and install the VC redist, which is required for Apache to run a component.

    • Download the Apache unzip version and place the extracted folder under the path you want to install.

    • To modify a configuration file:

Apache has a path by default: "c:\Apache24" (the version number may be different). If not, you need to open the apach\conf\httpd.conf configuration file, which will have all the "c:\Apache24", "c:\Apache24\htdocs" and " c:\Apache24\cgi-bin\"Change to the corresponding path.

Specify IP and port: Find "ServerName www.example.com:80" in httpd.conf, remove the previous comment, and modify "www.example.com" to "localhost "。 If you want to modify the port, the "80" here and the previous "listen:80" in the 801 changes.

    • Optionally, add a system variable: Add "Apache installation path \ bin" to path.

    • Verify that the installation is successful: Run Apache boot Httpd.exe. Enter localhost:80on the browser, if it is not inaccessible then the Apache configuration is complete.

Second, PHP

    • Install config PHP

Go to php download address http://windows.php.net/download Download the latest thread-safe PHP Zip package and place it under the path you want to install. Note: The downloaded PHP VC version can not be higher than the previously installed VC Redist version.

Go to the PHP installation directory, copy a php.ini-development renamed php.ini to the installation path, open find "extension_dir", remove the comment, change the value to "PHP installation path \ext "

    • Loading PHP in Apache

Open the Apache configuration file conf\httpd.conf, locate the LoadModule zone, and then add:

LoadModule php7_module "PHP installation path \php7apache2_4.dll" # Loading PHP as a module in Apache, " Php7_module"7" in the version corresponding to PHP, in addition, different versions of PHP "php7apache2_4.dll" may be different.

Phpinidir "PHP installation path " #告诉Apache the installation path of PHP

    • Define the files that execute the PHP module

find AddType application/x-gzip. gz. tgz, adding code on its next line: addtype application/x-httpd-php. php. HTML: Declares . php and. html files can execute PHP programs.

    • Test: New file under Apache installation path \htdocs: test.php, Inside Editor: <?php phpinfo ();?;, start Apache, enter in browser:localhost:80/test.php .

Third, MySQL

    • Installation: Download the appropriate installation version in https://dev.mysql.com/downloads/and install it according to your needs.

    • Load the MySQL-connected assembly in PHP: Add a line of Extension=php_mysqli.dll to the php.ini extension plate.

Description: Different PHP versions may provide different connection mysq assemblies, go to the Ext folder to see what PHP is offering here and what to write. Different assemblies may be used differently when connecting to a database.

    • Test: Edited in test.php: <?php $mysqli = mysqli_connect ("localhost", "root", "pwd") or Die (" Cannt connet");, start the database, restart Apache, view it on the browser side, and configure it correctly if there is no error message.

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.