Build a PHP Development Environment Based on Windows

Source: Internet
Author: User
Tags pear php development environment sapi zip folder

 

 

 

I believe that many people like me very much like learning PHP programming, many people have to give up their desire to learn PHP because they cannot build a PHP Development Environment Based on Windows. So I want to write my own experiences on this issue. First, I can help those who are unable to build the development environment. Second, I can give myself a chance to sum up.

 

I write this articleArticleThe goal is to help those who have just started learning PHP, so I will try to describe it in the simplest and clearer language. If you are already very skilled in this problem, you can do more meaningful things without reading this article.

 

Limited by my own level, this article will inevitably have errors and deficiencies, please kindly advise.

 

 

Note: This article does not address server security and optimization issues. If you have such problems, visit the security focus website and search for the article published by San, a security focus member.

 

 

Before getting started, let's first introduce the software used to build the PHP environment. Because we explain how to build a development environment in Windows, you must have a PC with windows as the operating system. The following is the specific development environment on my machine:

 

 

Operating System: Windows XP SP2

 

Required Software: PHP: php-4.4.0-Win32.zip

 

MySQL: mysql-noinstall-4.1.14-win32.zip

 

Apache: apache_2.0.54-win32-x86-no_ssl.msi

 

PhpMyAdmin: phpMyAdmin-2.6.4-pl1.zip

 

 

Software Source: Windows: Microsoft

 

PHP: http://www.php.net/

 

MySQL: http://www.mysql.com/

 

Apache: http://www.apache.org/

 

PhpMyAdmin: The http://www.phpmyadmin.net/

 

 

Now, after you download and have these software, we can start our installation and configuration journey.

 

 

Configure PHP

 

Extract JavaScript> php-x.x.x-win32.zip JavaScript> to the C root directory. After decompression, we should be able to find a folder named php-x.x.x-win32 under the C root directory and rename it PHP. Go to this folder and we can see several folders and several files. I will describe several directories and files used during configuration.

 

 

[DLLs] The DLL required to store the corresponding PHP extension library. So what is the PHP dll extension library? It is an extension of PHP's basic functions. For example, if you need to use PHP to generate images, you need to use the GD library extension, which contains a series of image generation functions. In this way, you can easily expand the application scope of PHP. Therefore, when configuring PHP, you need to tell PHP that you need the support of the extension library.

 

[Extensions] PHP extension library DLL. This is the PHP search extension library and storage extension library location.

 

[Pear] pear is the storage path for PHP extensions and application libraries (PhP extension and application repository. Learn more about http://pear.php.net.

 

[SAPI] Stores sapi dll files.

 

[Go-pear.bat] files required to install pear.

 

Installation install.txt] installation instructions.

 

[Php4ts. dll] Main DLL file.

 

[Php.exe] CGI executableProgram.

 

[PHP. ini-Dist] PHP configuration file

 

 

It is always difficult to see here. In fact, it is easy to see here. Here is a more detailed explanation. As long as you pay attention to the installation steps, do not make a mistake, And the success will not be far from you. Come on!

 

 

Step 1: copy the php4ts. dll file to the C: \ WINDOWS \ directory (if it is a Windows 2000/NT operating system, it is the c: \ winnt \ directory, the same below. Note the folder corresponding to your Windows version ).

 

Step 2: replace all. copy the DLL file to the c: \ windows \ system32 \ directory (if it is a Windows 2000/NT operating system, it is the c: \ winnt \ system32 \ directory; if it is Windows 98, it is the C: \ WINDOWS \ SYSTEM \ directory. The same below. Note the folder corresponding to your Windows version ).

 

Step 3: copy the php. ini-Dist file to the C: \ WINDOWS \ folder and rename it PHP. ini. Note: Do not store the php. ini file in the PHP Directory. That is to say, the c: \ PHP Directory should not contain the php. ini file (this will not happen if PHP is completely installed according to my steps ). Now we have the php. ini file in the c: \ windows \ directory. This file is the PHP configuration file, so the configuration of PHP is centered around it. Open it in notepad and configure it in the order from top to bottom.

 

Path and directories: Set the PHP file search path. Modify it:

 

; Unix: "path1:/path2"

 

; Include_path = ".:/PHP/shortdes"

 

;

 

; Windows: "\ path1; \ path2"

 

Include_path = "c: \ PHP \ pear \"

 

Extension_dir: Set the PHP search extension library location. Point its path to: C: \ PHP \ extensions \

 

File Uploads: set the size of the file that PHP allows to upload (2 MB by default)

 

Dynamic extensions: PhP Extension Configuration section. All supported extensions of PHP are listed here. A semicolon is added to comment out the extensions, indicating that the current PHP configuration does not support this extension. You can remove the semicolon according to your specific needs, to make PHP configuration support this extension.

 

More practical extensions include:

 

Extension = php_curl.dll: curl extension support

 

Extension = php_gd2.dll: Gd Image Library extension support

 

Extension = php_xslt.dll: XSLT extension support, which supports XML Conversion.

 

 

Pear Installation

 

Click Start-run, Enter cmd, and continue entering CD \ in the Windows Command Prompt window \

 

C :\

 

C: \> Cd PHP

 

C: \ php>

 

C: \ php> go-pear.bat

 

The rest is entering all the way, huh, huh.

 

 

MySQL Installation

 

Decompress the mysql-noinstall-4.1.14-win32.zip folder and place it in the C root directory. Run mysqld-nt.exe to open the MySQL service.

 

Note: by default, the root user name of MySQL is installed without a password, which is very dangerous. Therefore, please add a password for it.

 

 

Install and configure Apache

 

There is no difference between installing and installing common software. Generally, localhost is added when adding server information. After the installation, go to the [htdocs] Directory and open the httpd. conf file under the [conf] Directory to start our Apache journey.

 

1. Find directoryindex index.html. var.

 

Add index. php after it, and add it as follows:

 

Directoryindex index.html. var index. php

 

2. Search and locate:

 

<Diretory "C:/program files/Apache Group/apache2/cgi-bin">

 

AllowOverride none

 

Options none

 

Order allow, Day

 

Allow from all

 

</Diretory>

 

Add the following two rows to the end:

 

Addtype application/X-httpd-PHP. php. phtml. php3. PhP4

 

Addtype application/X-httpd-PHP-source. PHPs

 

Add the following code:

 

<Diretory "C:/program files/Apache Group/apache2/cgi-bin">

 

AllowOverride none

 

Options none

 

Order allow, Day

 

Allow from all

 

</Diretory>

 

Addtype application/X-httpd-PHP. php. phtml. php3. PhP4

 

Addtype application/X-httpd-PHP-source. PHPs

 

3. Search and locate:

 

# Loadmodule ssl_module modules/mod_ssl.so

 

Add it below:

 

Loadmodule php4_module C:/PHP/SAPI/php4apache2. dll

 

After adding, it should be as follows:

 

# Loadmodule ssl_module modules/mod_ssl.so

 

Loadmodule php4_module C:/PHP/SAPI/php4apache2. dll

 

 

Here, the configuration of the Apache server can end up. After saving the httpd. conf file, restart the Apache server.

 

To test whether the server is successfully installed, we can use the followingCode:

 

<? PHP phpinfo ();?>

 

Save it as a phpinfo. php file and put it in the htdocs directory. Enter the following address in the address bar of the browser: http: // localhost/phpinfo. php, and you will see the relevant information.

 

The establishment of the php development environment in Windows environment has ended.

 

Welcome to PhP learning and development!

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.