PHP5 and Apache server configuration in Windows environment

Source: Internet
Author: User
Tags exit copy ini mysql php file phpinfo win32 zip
apache|php5|window| Server


Several packages need to be downloaded:
1. PHP5 RC3
2. Apache 2.0.49
3. MySQL 4.0.20

Download Packages:
1. PHP5 RC3
PHP official website Download address: http://www.php.net/downloads.php, find the following map location, download box two packages. Where the PHP 5.0.0rc3 Zip package is the PHP5 package, and Collection of PECL modules for PHP 5.0.0rc3 is PHP5 's PECL Extension Module collection package.






When the download is complete, put it in the C disk.
2. Apache 2.0.49
Apache Official Download Address: http://httpd.apache.org/download.cgi , find the following map location, download for Windows MSI installation package, save in C disk standby.






3. MySQL 4.0.20
MySQL Official Download Address: http://dev.mysql.com/downloads/mysql/4.0.html , find the Windows downloads section, download without installer Package and save it in C, as shown in the following figure:





Install PHP5:
Suppose your system is installed in C, otherwise the following directory must be changed to the appropriate disk directory.
Unzip the downloaded PHP5 RC3 (php-5.0.0rc3-win32.zip) to the C:\PHP5\ directory. Unzip all files in the PECL Extension Module collection package into the C:\PHP5\ext\ directory.
Copy the Php5ts.dll file from the C:\PHP5\ directory to C:\windows\ (if the Windows 2000 operating system is the C:\WINNT\ directory, the same below, no longer repeat the description) directory.
Copy the following DLL files in the C:\PHP5\ directory under 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



Where Libmysql.dll is extended support for MySQL 4.1 Prior versions, Libmysqli.dll for MySQL 4.1 later. Because I download the above is the MySQL 4.0.20, so actually copy libmysql.dll can.
Copy the Php.ini-dist file in the C:\PHP5\ directory to the C:\windows\ directory and rename it to php.ini and open the edit with Notepad:
Navigate to the following two lines:



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



Extension_dir = "./"



Modify the following line to point it to the C:\PHP5\ext\ directory, as follows:



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



Extension_dir = "C:\PHP5\ext\"


Navigate to the following two lines:


; Windows Extensions



; This is the ODBC support is built in, and so no DLL are needed for it.



You can see that all of the supported extensions are listed below, and we can remove the preceding semicolon to enable PHP to support the appropriate extensions. I tested it, support the following extensions, or configure them according to your selections.



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 file Exit and exit.

Install Apache 2.0.49

Ready to download the Apache_2.x.x-win32-x86-no_ssl.msi. Double-click to start the installation. Step next down, agree to the license agreement will have to fill out the server information page, local debugging, the front two input localhost can. As follows:






All the way down, the default path is installed-you can also choose the path you need. Apache automatically installs and starts related services. and running an Apache monitor in the lower-right corner of the taskbar:






We can reboot, 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, with Notepad to open C:\Program Files\apache group\apache2\conf\ (I am here to install the default installation path, the following settings according to their own installation path to do the corresponding changes) under the directory httpd.conf file, navigate to 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 enable Apache to identify PHP, search for and navigate to 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 later:



AddType application/x-httpd-php. php. phtml php3. PhP4
AddType Application/x-httpd-php-source. Phps



Specify the PHP module, locate and navigate to 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.
To specify that Apache recognizes Chinese, we specify GB2312 as the default encoding. Should find and locate the line below





Adddefaultcharset iso-8859-1



Modify it to:



Adddefaultcharset GB2312



Also, if you want to prevent directory browsing, find and navigate to the following lines:



#......



#Some notes



#......



Options Indexes FollowSymLinks





Remove a few lines of comments below the line followed by the Indexes can be modified:









#......



#Some notes



#......



Options FollowSymLinks



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

Installation of MySQL 4.0.20

Compress the Mysql-4.0.20-win-noinstall.zip folder into the C-packing directory (note: Use this version of MySQL must be unzipped folder in the C-packing directory), after decompression can be found in the C-packing directory named mysql-x.x.x folder. Rename it to MySQL.
Go to the Bin directory, locate the Winmysqladmin.exe file, and open it. The first run prompts you to enter a new username and password. Here you can choose the username and password input you need, as the default username and password for My.ini. The following figure:




After clicking OK, the winmysqladmin will be narrowed down to the taskbar in the lower right corner:






Let's see if the MySQL service starts. Open Control Panel, open Administrative Tools after entering, and then open services. If everything goes well, we'll see the information that MySQL has started, as shown in the following figure:






Here MySQL installation came to an ending, very simple.

Test whether PHP is configured successfully:

Open Notepad and enter the following line of code:



<?php phpinfo ();?>


Save as phpinfo.php file, stored in the Apache2\htdocs\ directory, remember to save when you choose to save the type of "All Files", the following figure:








OK, open the browser, enter in the Address bar: http://localhost/phpinfo.php and return, if all goes well you will see the following page, to this PHP5 configuration is done:






Note: This article does not discuss the configuration of the server from the security and performance, the corresponding security configuration please refer to the other manuals, this article simply introduced the configuration of the PHP5 environment, as a prerequisite for learning PHP5, this article can not be used as a server configuration article to read, for example, there is no MySQL root password Will cause a lot of security risks, so please set the reader.




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.