Install the PHP development environment in Windows and the windowsphp Development Environment

Source: Internet
Author: User
Tags apache php php development environment what php

Install the PHP development environment in Windows and the windowsphp Development Environment
I. ApacheThe Apache official website only provides the source code. If you want to use it, you must compile it by yourself. Here I select the third-party installation package Apache Lounge.

  • Go to Apachelounge official: http://www.apachelounge.com/download/
  • First download and install vc redist, which is a required component for running Apache.
  • Download the Apache decompressed version and put the decompressed folder in the path you want to install.
  • Modify the configuration file:

Apache has the default path "c: \ Apache24" (the version number may be different ). If not, open Apach \ conf \ httpd. conf configuration file, which contains "c: \ Apache24", "c: \ Apache24 \ htdocs", and "c: change \ Apache24 \ cgi-bin \ "to the corresponding path.

Specify the IP address and port: Find "ServerName www.example.com: 80" in httpd. conf, remove the comment above, and change "www.example.com" to "localhost ". If you want to modify the port, replace "80" with 80 in "Listen: 80.

  • (Optional) add system variable: Add "Apache installation Path \ bin" to Path.
  • Verify whether the installation is successful: run the startup httpd.exe of apache. Enter localhost: 80 in the browser. If it is not inaccessible, Apache configuration is complete.
Ii. PHP
  • Install and configure PHP

Go to PHPhttp: // windows.php.net/downloaddownload the latest thread security PHP zip package. decompress the package and place it in the desired path. Note: The downloaded php vc version cannot be higher than the previously installed vc redist version.

Go to the PHP installation directory and copy a copy of php. ini-development is renamed as php. put ini in the installation path, open "extension_dir", remove the annotator, and change the value to "PHP installation path \ ext"

  • Load PHP in Apache

Open the configuration file conf \ httpd. conf of Apache, locate the LoadModule area, and add the following content to it:

LoadModule php7_module "PHP installation path \ php7apache2_4.dll" # Load PHP as a module in Apache. "7" in "php7_module" must correspond to the PHP version. In addition, different PHP versions of php7apache2_4.dll may be different. PHPIniDir "PHP installation path" # Tell Apache PHP installation path
  • Define the file for executing the PHP Module

Find AddType application/x-gzip. gz. tgz and add code in the next line: AddType application/x-httpd-php. php. html: the file of shengming.php and .html can execute the PHP program.

  • Test: create a file named test. php under the Apache installation path \ htdocs. edit the file: <? Php phpinfo () ;?>, Start Apache and enter localhost: 80/test. php in the browser.
Iii. MySQL
  • Installation: Install the SDK at https://dev.mysql.com/downloads.
  • Load the MySQL assembly in PHP: add a line of extension = php_mysqli.dll to the php. ini extension Section.

Note: Different PHP versions may provide different sets of components connected to mysq. Go to the ext folder and check what PHP provides. Different assemblies may use different functions when connecting to the database.

  • Test: In test. php, EDIT: <? Php $ mysqli = mysqli_connect ("localhost", "root", "pwd") or die ("cannt connet");?>, Start the database, restart Apache, and check on the browser. If no error message is displayed, the configuration is correct.

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.