Configuration of PhP5 and Apache servers in Windows

Source: Internet
Author: User
Tags php example zip folder
Configuration of PhP5 and Apache servers in Windows
Author: Deep Space Source

Link to this article:
Http://www.openphp.cn/index.php/article/2/12/index.html

You need to download several software packages:
1. PhP5 RC3
2. Apache 2.0.49
3. MySQL 4.0.20

Download the software package:
1. PhP5 RC3
PHP is: http://www.php.net/downloads.php, find such as location, download the two packages in the box. The PHP 5.0.0rc3 zip package is the PhP5 software package, while the collection of PECL modules for PHP 5.0.0rc3 is the PECL extension module package of PhP5.

After the download is complete, save it to drive C for backup.
2. Apache 2.0.49
Apache official: http://httpd.apache.org/download.cgi, find such as location, download for Windows MSI installation package, save in C disk backup.

3. MySQL 4.0.20
MySQL official: http://dev.mysql.com/downloads/mysql/4.0.html, find the Windows downloads section, download the without installer package and save it on the C drive, as shown in:

Install PhP5:
Assume that your system is installed on drive C, otherwise the following directories must be changed to the corresponding disk directory.
Decompress the downloaded PhP5 rc3(php-5.0.0rc3-win32.zip) to the C: \ PhP5 \ directory. Decompress all the files in the PECL extension module collection package to the C: \ PhP5 \ ext \ directory.
Copy the php5ts in the C: \ PhP5 \ directory. DLL file to c: \ windows \ (if it is a Windows 2000 operating system, it is the c: \ winnt \ directory, the same below, do not repeat the description) directory.
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

Libmysql. dll is supported by MySQL 4.1 and later versions. Because I downloaded MySQL 4.0.20 above, copy libmysql. dll.
Copy the php. ini-Dist file under the c: \ PhP5 \ directory to the C: \ WINDOWS \ directory, change it to PhP. ini, and open and edit it in Notepad:
Locate the following two rows:

; Directory in which the loadable extensions (modules) reside.

Extension_dir = "./"

Modify the following line to point it to the C: \ PhP5 \ ext \ directory. The modification is as follows:

; Directory in which the loadable extensions (modules) reside.

Extension_dir = "C: \ PhP5 \ ext \"

Locate the following two rows:

Windows extensions

; Note that ODBC support is built in, so no DLL is needed for it.

We can see that all supported extensions are listed below. We can remove the semicolon to make PHP support the corresponding extensions. I tested the following extensions, or you can choose whether to configure them.

Extension = php_bz2.dll

Extension = php_c2.16.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_cmd.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_cmd.dll

; Extension = php_yaz.dll

Extension = php_zip.dll

Save the file and exit.

Install Apache 2.0.49

Prepare the downloaded apache_2.x.x-win32-x86-no_ssl.msi. Double-click to start installation. Next, after you agree to the license agreement, there will be a page to fill in the server information, local debugging, the first two enter localhost. As follows:

Install them all the way down to next. You can also select the path you need. Apache automatically installs and starts related services. An Apache monitor is running in the lower right corner of the taskbar:

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 Apache configuration file and use NotePad to open C: \ Program Files \ apache group \ apache2 \ conf \ (here I install it in the default installation path, according to your installation path) HTTPD in the directory. CONF file, locate the following line:

Directoryindex index.html. var

Add a PHP Example page after it, usually index. php, as follows:
Directoryindex index.html. var index. php To enable Apache to identify related extensions of PHP, search for and locate the following section:

To enable Apache to identify related extensions of PHP, search for 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:

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

Specify the PHP module and locate the following line:

# Loadmodule ssl_module modules/mod_ssl.so

Add a row below:

Loadmodule php5_module c: \ PhP5 \ php5apache2. dll

Make it point to the php5apache2. dll file under the PhP5 directory. The path must be accurate.
To specify Apache to recognize Chinese characters, we specify gb2312 as the default encoding. Find and locate the following line

Adddefacharcharset ISO-8859-1

Modify it:

Adddefacharcharset gb2312

In addition, if you want to disable directory browsing, find and locate the following lines:

#......

# Some Annotations

#......

Options indexes followsymlinks

Just remove the indexes of the line following the comments. After modification:

 

 

#......

# Some Annotations

#......

Options followsymlinks

OK. Save the httpd. conf file and restart the Apache server.

Install MySQL 4.0.20

Compress the mysql-4.0.20-win-noinstall.zip folder to the C root directory (Note: with this version of MySQL, you must put the decompressed folder under the C root directory ), after decompression, you can find the folder named mysql-x.x.x under the C root directory. Change it to MySQL.
Go to the bin directory, find the winmysqladmin.exe file, and open it. The first operation prompts you to enter a new user name and password. Here, you can select the username and password you need as your default username and password for my. ini. For example:

After you click OK, winmysqladmin will be reduced to the taskbar in the lower right corner:

Let's see if the MySQL service is started. Open Control Panel, open administrative tools, and then open services ". If everything goes well, we will see the MySQL started information, such:

The installation of MySQL has come to an end, which is very simple.

Test whether PHP is configured successfully:

Open notepad and enter the following lineCode:

<? PHP phpinfo ();?>

OK. Save the httpd. conf file and restart the Apache server. MySQL 4.0.20 installation compresses the mysql-4.0.20-win-noinstall.zip folder to the C root directory (Note: to use this version of MySQL, you must decompress the folder and place it under the C root directory ), after decompression, you can find the folder named mysql-x.x.x under the C root directory. Change it to MySQL. Go to the bin directory, find the winmysqladmin.exe file, and open it. The first operation prompts you to enter a new user name and password. Here, you can select the username and password you need as your default username and password for my. ini. For example: Save as a phpinfo. php file and store it in the directory of apache2 \ htdocs \. Remember to set the storage type to "all files", for example:

All right, open your browser, enter http: // localhost/phpinfo. php in the address bar, and press Enter. If everything goes well, you will see the following page. At this point, the PhP5 configuration is successful:

Note: This article does not discuss server configurations in terms of security and performance. For the corresponding security configurations, refer to other manuals. This article only briefly introduces the configuration of the PhP5 environment as a prerequisite for learning PhP5, this document cannot be configured as a serverArticleFor example, the root user password of MySQL is not set here, which may cause great security risks.
(Full text) deep space on the Dragon Boat Festival early

Author: deep space. Home: http://www.openphp.cn

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.

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.