Configuration of PHP5+APACHE+MYSQL servers in Windows environment

Source: Internet
Author: User
Tags apache download ini mysql download php file php and phpinfo

The following article will describe the configuration of the PHP environment under Windows 2000 / XP / 2003 (it is not recommended to establish a PHP environment under windows 98). The server selects Apache 2.0.54 and the database selects MySQL 4.1.14.

Several packages need to be downloaded:
1. PHP 5.1.0RC1
2. Apache 2.0.54
3. MySQL 4.1.14

Download the software package:
1. PHP 5.1.0RC1
The download address of PHP is: http://www.php.net/downloads.php, find the location as shown below, and download the two packages in the box. The PHP 5.1.0RC1 zip package is the PHP5 software package, and the Collection of PECL modules for PHP 5.1.0RC1 is the PECL extension module collection package of PHP5.



After downloading, put it in C drive for backup.
2. Apache 2.0.54
The official Apache download address is: http://httpd.apache.org/download.cgi, find the location shown below, download the MSI installation package for For Windows, and save it on the C drive for later use.



3. MySQL 4.1.14
The official MySQL download address is: http://dev.mysql.com/downloads/mysql/4.1.html, find the Windows downloads section, download the Without installer package and save it on the C drive, as shown below:



Install PHP5:

Assuming your system is installed on the C drive, otherwise the following directories must be changed to the corresponding drive directories.
解 Unzip the downloaded PHP 5.1.0RC1 to the C: \ PHP5 \ directory. Extract all the files in the PECL extension module collection package to the C: \ PHP5 \ ext \ directory.
Copy the php5ts.dll file in the C: \ PHP5 \ directory to the C: \ windows \ (in the case of Windows 2000 operating system, the C: \ WINNT \ directory, the same below, the description is not repeated).
Copy the following dll files in the C: \ PHP5 \ directory to the C: \ windows \ system32 \ directory:
Fdftk.dll
Fribidi.dll
Gds32.dll
Libeay32.dll
Libintl-1.dll
Libmhash.dll
Libmysql.dll
Libmysqli.dll
Ntwdblib.dll
Ntwdblib.dll
Yaz.dll
Among them, libmysql.dll is extended support before MySQL 4.1, libmysqli.dll is extended support after MySQL 4.1.
Copy the php.ini-dist file in the C: \ PHP5 \ directory to the C: \ windows \ directory, rename it php.ini, and open the editor with Notepad:
Navigate to the following two lines:
; Directory in which the loadable extensions (modules) reside.
Extension_dir = "./"

Modify the following one to point it to the C: \ PHP5 \ ext \ directory, after the modification:
; Directory in which the loadable extensions (modules) reside.
Extension_dir = "C: \ PHP5 \ ext \"
Navigate to the following two lines:

You can see all the supported extensions listed below. We can remove the semicolon to make PHP support the corresponding extensions. I tested it and supports the following extensions, which can also be configured according to the choice.

extension = php_bz2.dll
extension = php_cpdf.dll
extension = php_curl.dll
extension = php_dba.dll
; extension = php_dbase.dll
extension = php_dbx.dll
; extension = php_exif.dll
extension = php_fdf.dll
extension = php_filepro.dll
extension = php_gd2.dll
extension = php_gettext.dll
; extension = php_iconv.dll
; extension = php_ifx.dll
extension = php_iisfunc.dll
extension = php_imap.dll
; extension = php_interbase.dll
extension = php_ldap.dll
extension = php_mbstring.dll
; extension = php_mcrypt.dll
extension = php_mhash.dll
extension = php_mime_magic.dll
extension = php_ming.dll
; extension = php_mssql.dll
; extension = php_msql.dll
extension = php_mysql.dll
; extension = php_oci8.dll
extension = php_openssl.dll
; extension = php_oracle.dll
extension = php_pdf.dll
; extension = php_pgsql.dll
extension = php_shmop.dll
extension = php_snmp.dll
extension = php_sockets.dll
; extension = php_sybase_ct.dll
extension = php_tidy.dll
; extension = php_w32api.dll
extension = php_xmlrpc.dll
extension = php_xsl.dll
; extension = php_yaz.dll
extension = php_zip.dll
Save the file and exit.

Install Apache 2.0.54
Ready to download apache_2.x.x-win32-x86-no_ssl.msi. Double-click to start the installation. Step Next Next, after agreeing to the license agreement, there will be a page for filling in server information and local debugging. Just enter localhost in the first two. as follows:





All the way Next, all install according to the default path-Of course you can also choose the path you need. Apache will automatically install and start related services. And running an Apache monitor in the lower right corner of the taskbar:

Configuration of PHP5 + Apache + mysql server in Windows environment-

If the service is not found in Apache after the installation is complete, you need to enter apache -k install in cmd;

Configuration of PHP5 + Apache + mysql server in Windows environment-

We can restart, stop, and start the Apache service from this monitor. Double-click the small icon to open the control interface:


Next, configure the configuration file of Apache. Use Notepad to open C: \ Program Files \ Apache Group \ Apache2 \ conf \ (I installed it according to the default installation path, and the subsequent settings are changed according to my own installation path) The httpd.conf file in the directory, locate the following line:
DirectoryIndex index.html index.html.var

添加 Add a PHP default page after it, usually index.php, as follows:
DirectoryIndex index.html index.html.var index.php

To make Apache recognize PHP related extensions, search and locate the following section:
 <Directory "C: / Program Files / Apache Group / Apache2 / cgi-bin">
   AllowOverride None
   Options None
   Order allow, deny
   Allow from all
</ Directory>

 添加 Add the following two lines after:
 AddType application / x-httpd-php .php .phtml .php3 .php4
AddType application / x-httpd-php-source .phps

Specify the php module, find and locate the following line:
#LoadModule ssl_module modules / mod_ssl.so
添加 Add a line below:
LoadModule php5_module c: \ php5 \ php5apache2.dll
Make it point to the php5apache2.dll file in the PHP5 directory, the path must be accurate.

In addition, if you want to disable directory browsing, find and locate the following lines:
# ……
#Some notes
# ……
Options Indexes FollowSymLinks
Remove the Indexes on the line immediately following the comments, after modification:
# ……
#Some notes
# ……
Options FollowSymLinks
Find DocumentRoot "C: / Program Files / Apache Group / Apache2 / htdocs" and change it to your WEB directory (you can leave it unchanged) as mine is DocumentRoot "D: / website"


OK, save the httpd.conf file and restart the Apache server.

Installation of MySQL 4.1.14

Run the setup.exe file to install, and after completion, a pop-up window will prompt you to install the instance



After entering the detailed configuration instructions, you can refer to http://dev.mysql.com/tech-resources/articles/4.1/installer.html, which will not be explained one by one here.

We click Next all the way to install. If the installation is successful, open the "Control Panel", enter "Administrative Tools", and then open "Services", you can see the mysql startup service information.


Here MySQL installation comes to an end, very simple.

If Client does not support authentication protocol error occurs during connection, please refer to another article on this site http://www.smallrain.net/study_show.asp?id=579.

Test if PHP is successfully configured

Open Notepad and enter this line of code:

Configuration of PHP5 + Apache + mysql server in Windows environment-


Save it as phpinfo.php file, and store it in the D: / website (web directory defined in Apache) directory. Remember to select the save type as "all files" when saving.

OK, open your browser, enter in the address bar: http: //localhost/phpinfo.php and press Enter. If all goes well, you will see the following page. At this point, PHP5 configuration is complete:


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.