Build a PHP Development Environment & amp; php + apache in Windows

Source: Internet
Author: User
Tags php development environment vc9
Article 1 There are many integrated development environments for PHP, such as XAMPP and AppServ... the PHP environment can be set up with one click. However, this installation method is not flexible enough, the free combination of software is not convenient, and it is not conducive to learning. Therefore, I still like to build a PHP Development Environment manually. You only need to install the module or upgrade the software directly.

Article 1 There are many integrated development environments for PHP, such as XAMPP and AppServ... the PHP environment can be set up with one click. However, this installation method is not flexible enough, the free combination of software is not convenient, and it is not conducive to learning. Therefore, I still like to build a PHP Development Environment manually. You only need to install the module or upgrade the software directly.

Article 1

There are many integrated PHP development environments, such as XAMPP and AppServ ...... the PHP environment can be set up with one-click installation. However, this installation method is not flexible enough, the free combination of software is not convenient, and it is not conducive to learning. Therefore, I still like to build a PHP Development Environment manually. You only need to install the module or upgrade the software without affecting other software, very convenient.

  I. Preparations-download 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

  Ii. Install software

    Install Apache: Double-click installation, which is no different from installing other Windows software. When you enter Server Infomation, there is no special rule as long as the entered information conforms to the format.

After the installation is complete, enter http: // localhost in the browser. If It Works is displayed !, Indicates that Apache is successfully installed.

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

  

    Install MySQL: Double-click the installation. To change the installation directory, select Custom in Choose Setup Type.

After the installation is complete, start configuring MySQL. Keep all the default options, but you 'd better change the default MySQL encoding to utf8. Set the password in the Modify Security Settings option and enter the password twice, click Execute to complete the configuration.

  3. Integrate Apache + PHP + MySQL

Apache: first, modify the Apache configuration file so that Apache can parse the PHP file. The Apache configuration file is httpd. conf In the conf directory of the Apache installation directory.

1. Apache can parse the PHP file and find it in the configuration file.

# LoadModule vhost_alias_module modules/mod_vhost_alias.so

Add in the next line (the Green position depends 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. Find

DirectoryIndex index.html

Change

DirectoryIndexIndex. phpIndex.html

3. Modify the directory of the Apache site and find it in the configuration file (the directory for Apache installation is different and the displayed value is different)

DocumentRoot"D:/Develop/Apache2.2/htdocs"

Change

DocumentRoot"D:/Workspace/PHP"

      

Find

         D:/Develop/Apache2.2/htdocs">

Change

         D:/Workspace/PHP">

PHP: Rename php. ini-development to php. ini as the PHP configuration file. Modify php. ini

1. Set the directory of the PHP extension package and find

; On windows:
; Extension_dir = "ext"

Change to (the value is the directory of the ext folder)

; On windows:
Extension_dir ="D:/Develop/PHP/ext"

2. Enable the corresponding library function and find the row of the library to be enabled

; Extension = php_curl.dll

; Extension = php_gd2.dll

; Extension = php_mbstring.dll

; Extension = php_mysql.dll

; Extension = php_xmlrpc.dll

Remove the semicolon (comment) and change it

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 and find

; Date. timezone =

Change

Date. timezone = Asia/Shanghai

       

After the configuration is complete, check whether the configuration is successful. Restart Apache, create the file index. php In the site directory, and enter the following content:

 

Open the browser and enter http: // localhost. If the following content is displayed, the installation is successful and MySQL is associated successfully.




Article 2

Build Apahce2.2 and php5.3.4 development environments in Windows XP

Install the Apache server
Ssl. msi
Install. Next, go to network..., server... enter localhost, and enter the Administrator email address in the third step. Then, the installation path page appears. Select your own installation path. I will install it in the E:/Apache2.2/directory and continue to next, final Completion!
By default, the installation is complete and apache is automatically started. http: // localhost is displayed in the address bar of the browser. If "It works!" is displayed !", Installed successfully!
Installation (Version: 5.3.4)
Php-5.3.4-src.zip
Configure PHP
1. Configure php: Rename the PHP. ini file under the php Directory to php. ini. This is the php configuration file, and then modify the following in the php. ini file:
A: Find extension_dir = "E:/PHP/ext ";
B: Search for doc_root = "E:/PHP"; (it must be consistent with DocumentRoot in the Apache configuration file httpd. conf );
C: Modify the character set, find default_charset, and modify it to your desired encoding. Here I am default_charset = "UTF-8 ".
D: Set register_globals = Off TO register_globals = On to make the passed global variable valid.
E: Search for extension and remove the semicolon before these items.
Extension = php_dba.dll
Extension = php_dbase.dll
Extension = php_gd2.dll GD library is used for drawing verification codes;
Extension = php_mysql.dll is used to connect to the MYSQL database;
2. Copy the php5ts. dll and php5apache2_2.dll files under the D:/PHP Directory to the C:/WINDOWS/system32 directory.
Configure Apache
Open the httpd. conf file in the E:/Apache2.2/conf directory.
1. Find the DocumentRoot directory. The default directory is E:/Apache2.2/htdocs. It can be used by default. Here it is changed to DocumentRoot "E:/phpApp"
2. Search for DirectoryIndex. The default homepage file name is set here. You can add index. php and so on after index.html. Note that each item is separated by a space.
3. Find Modify Deny from all to allow from all to prevent error messages such as You don't have permission to access/on this server. Especially after the path of the default homepage is changed.
Add the php module to apache
Open the httpd. conf file in the E:/Apache2.2/conf directory.
1. Find # LoadModule ssl_module modules/mod_ssl.so and add LoadModule php5_module D:/PHP/php5apache2_2.dll
2. Find AddType application/x-gzip. gz. tgz and add AddType application/x-httpd-php. php
Test
After completing the installation and configuration of apache and php, restart apache and create the file index. php In the E:/phpApp directory. Write the following code:
Enter http: // localhost in the address bar of the browser. If you see Hello World on the page! Information. Congratulations !!!

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.