Build PHP development environment under Windows

Source: Internet
Author: User

Label:

From: http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html

There are many PHP integrated development environments, such as XAMPP, Appserv (http://www.appservnetwork.com/) ... Just one click to install the PHP environment to build. But this kind of installation method is not flexible, the free combination of software is inconvenient, but also not conducive to learning. So I still like to build PHP development environment manually, which module needs to be installed on the line, or the software needs to upgrade, directly upgrade the software on the line, does not affect the other software, very convenient.

  First, preparation-download the required software

    • Apache Httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
    • PHP Php-5.3.10-win32-vc9-x86.zip
    • MySQL Mysql-5.5.20-win32.msi

  Second, install the software

    install Apache: Double-click Installation, no different from installing other Windows software, when filling the server infomation, there is no special rules, as long as the information entered in accordance with the format.

After the installation is complete, in the browser input http://localhost, if the IT works! is displayed, the Apache installation is successful.

Install PHP: Unzip the php-5.3.10-win32-vc9-x86.zip to a directory.

  

    install MySQL: Double-click Install, if you need to change the installation directory, select Custom in the Choose Setup Type

After the installation is complete, configure MySQL to all the default options, but it is best to change the default MySQL encoding to UTF8, set the password in the Modify Security settings option, enter the password two times, and finish the configuration with the last execute.

  Iii. Integration of Apache+php+mysql

Apache: First modify the Apache configuration file, let Apache support parsing php files. Apache configuration files are httpd.conf in the Conf directory of the Apache installation directory.

1. Allow Apache to parse the PHP file and locate it in the configuration file

#LoadModule Vhost_alias_module modules/mod_vhost_alias.so

Add on the next line (the green location is based on the directory where PHP is located)

LoadModule php5_module "d:/develop/php/php5apache2_2.dll"
Phpinidir "d:/develop/php"
AddType application/x-httpd-php. php. html. htm

2. Found in the configuration file

DirectoryIndex index.html

Switch

DirectoryIndex index.php index.html

3. Modify the Apache Site Directory, found in the configuration file (Apache installed directory, different values displayed)

DocumentRoot "d:/develop/apache2.2/htdocs"

Switch

DocumentRoot "d:/workspace/php"

      

Find it again.

<directory "d:/develop/apache2.2/htdocs" >

Switch

<directory "d:/workspace/php" >

PHP: Renamed Php.ini-development to php.ini as a PHP configuration file. Modify PHP.ini

1. Set the specific directory for the PHP expansion pack to find

; On Windows:
; Extension_dir = "ext"

Change to (value is the directory of Ext folder)

; On Windows:
Extension_dir = "d:/develop/php/ext"

2. Turn on the library function to locate the row of the library you want to open

; Extension=php_curl.dll

; Extension=php_gd2.dll

; Extension=php_mbstring.dll

; Extension=php_mysql.dll

; Extension=php_xmlrpc.dll

Remove the preceding semicolon (note) and change to

Extension=php_curl.dll

Extension=php_gd2.dll

Extension=php_mbstring.dll

Extension=php_mysql.dll

Extension=php_xmlrpc.dll

      

3. Set the time zone to find

;d Ate.timezone =

Switch

Date.timezone = Asia/shanghai

       

Configuration is complete to detect the success of the configuration. Restart Apache, in the Site directory, create a new file index.php, enter the content:

<?php
Phpinfo ();
?>

Open the browser input http://localhost, display the following content, the installation was successful, and successfully associated with MySQL.

==> Frequently Asked Questions:

From: http://www.cnblogs.com/snackuo/p/3547548.html

1.80 port is occupied, Apache can not boot.

Problem Description: The default installation of Apache, after the installation can self-launch Apache, but set to manually start the error, the log shows 80 port is occupied, modify the configuration file changed to 81 port, can be started normally manually. Since booting is due to Apache priority in the boot sequence, the preemptive use of 80 ports.

Troubleshooting process: Cmd window input Netstat–ano, found that 80 port has been monitored, pid=4, and then the Task Manager query to PID is the system process, so only the online search ' 80 port is occupied by NT Kernel & System (pid=4) ' Then we found the solution.

Workaround: Cmd window net stop http then select y last input sc config HTTP start= disabled (note disabled preceded by a space), then you can start the default configuration of Apache normally.

2.apache supports PHP.

Problem Description: My Apache version should be 2.2 installation files are: Httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

①, my PHP version is 5.5.9. The download file is: Php-5.5.9-win32-vc11-x86.zip (Thread Safe), not so the version of the required file Php5apache2_4.dll, and then follow the general tutorial to configure, Error: Httpd.exe:Syntax error on line 131 of D:/apache2.2/conf/httpd.conf:cannot load D:/php/php5apache2_4.dll into server: \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xb3\xcc\xd0\xf2\xa1\xa3

The reason for this check is that you need to install the file Vcredist_x86.exe corresponding to version 2012.

It cannot be started after installation. There is no error log, and then the suspicion is the php5apache2_4.dll issue.

Workaround: Replace the PHP version. Php-5.4.25-win32-vc9-x86.zip (Thread Safe) also installs Vcredist_x86.exe corresponding to version 2008 (uninstall this version of the runtime has also been successful, but 2012 is not uninstalled). And then it started up successfully.

The most meaningful reference sites are: tutorials and problem solving.

The most meaningful reference content:

1, Apache2.0 corresponding PHP module for the Php5apache2.dll

2, Apache2.2 corresponding PHP module for the Php5apache2_2.dll

3, Apache2.4 corresponding PHP module for the Php5apache2_4.dll

Therefore, the apache/php collocation has the following situation:

1, php5.2 support Apache2.0 and Apache2.2;

2, php5.3, php5.4 at the same time support Apache2.2 and Apache2.4;

3, php5.5 only support Apache2.4

The version of PHP corresponds to the runtime.

The compiler used by php5.5 is vc11,php5.4 and php5.3 is vc9,php5.2 is VC6. Also pay attention to the x86 version, or the x64 version. Currently only php5.5 offers x64 versions, others are only x86 versions.

VC11 Runtime x86/x64 version:

VC10 Runtime x86 version:

VC10 Runtime x64 version:

VC9 Runtime x86 version:

VC9 Runtime x64 version:

When the version of PHP and Apache is correct, the manual installation of the VC runtime all uninstalled, still can start normally, it is determined that the most important configuration environment is the PHP and Apache version corresponding.

Build PHP development environment under Windows

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.

Tags Index: