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, it can help those who are unable to build the development environment, the second is to let myself have a summary. I believe many people like me are very fond of 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.
The purpose of writing this article is to help those who are just learning PHP, so I will try my best to describe it in the simplest and clearer language, if you are already familiar with this issue, 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
Decompress the php-x.x.x-win32.zip 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 executable program.
[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:
AllowOverride None
Options None
Order allow, day
Allow from all
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:
AllowOverride None
Options None
Order allow, day
Allow from all
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.
Run the following code to test whether the server is successfully installed:
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!