Home > Article > Backend Development > Installation and configuration of IIS/Apache+PHP+MySQL under Winodws_PHP tutorial
Introduction
The execution efficiency of PHP is obvious to all, which is one of the reasons why I like it. If you want to integrate it with Mysql and Apache, which are called its excellent partners, you can't help but marvel at its efficiency. PHP is also updated very quickly. Here is a list of the latest version PHP4.3.2RC4 (almost no bugs, it is estimated that the official version will be released soon after writing this article), and the installation process of the latest version Mysql4.0.13.
PHP installation files can be downloaded directly from http://www.php.net/ to obtain the .zip package for win32 (5.8M)
The Mysql installation file can be downloaded directly from http://www.mysql.com and you can get the .zip package for win32
In addition, if you want to experience the cooperation effect of Apache and PHP and give up IIS, please go to http://www.apache.org to download the latest .MSI installation package for win31. The latest version is 2.0.45.
In addition, you can download Zend Optimizer to accelerate PHP. For details, please visit http://www.zend.com
<1>Install and configure PHP
1. Unzip the PHP compressed package to C:PHP (this path can be arbitrary, but if this path is used below, please modify it accordingly).
2. Copy php4ts.dll in the C:PHP directory and all files in the C:PHPdlls directory to the Windows system folder. The folder varies depending on the Windows version
If it is Windows 9x/ME, it is c:windowssystem
If it is Windows NT/2000, it is c:winntsystem32
If it is Windows XP/server2003, it is c:windowssystem32
Among them, C: is the system disk of the operating system you are currently using. If your current operating system is not installed under C:windows, please make modifications accordingly.
Copy php.ini-dist to C:windows (XP/2003/9x/Me) or C:Winnt (2000/nt) and rename it to php.ini. Open it with notepad and modify the information:
Search for the line extension_dir = ./ and point its path to the extensions directory in your PHP directory, such as:
extension_dir = C:PHPextensions
If you want to support more modules, please proceed below. If not, just save the php.ini file directly.
PHP supports many modules, but some dlls are not free, so they are not released with the PHP compressed package. However, there are a lot of them in the dlls folder. We have just copied them to the system32 folder. Now we test See how many modules it supports. The following are the results of my test, for reference only. If after the installation is completed, it pops up that the xxx.dll module is not supported, just add the preceding semicolon and search:
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
The supported extension modules are commented out in front with semicolons below. If you want PHP to support a certain module, please remove the ";" in front. The following is the result after my test. Generally, after removing the comments as follows No problem:
extension=php_bz2.dll
extension=php_cpdf.dll
extension=php_crack.dll
extension=php_curl.dll
extension=php_db.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_dbx.dll
extension=php_domxml.dll
extension=php_exif.dll
extension=php_fdf.dll
extension=php_filepro.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_hyperwave.dll
extension=php_iconv.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_java.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_oci8.dll
extension=php_openssl.dll
;extension=php_oracle.dll
extension=php_pdf.dll
extension=php_pgsql.dll
;extension=php_printer.dll
extension=php_shmop.dll
extension=php_snmp.dll
extension=php_sockets.dll
;extension=php_sybase_ct.dll
extension=php_w32api.dll
extension=php_xmlrpc.dll
extension=php_xslt.dll
extension=php_yaz.dll
extension=php_zip.dll
After the modification is completed, save php.ini and complete the installation and configuration of PHP.
<2>Mysql installation
Mysql is relatively independent. This database is very small and cannot be operated directly. It is not as intuitive as access or SQL2000. However, there are many software that can operate it well, such as phpMyAdmin and mysqlcc. These software can be downloaded from http://www.mysql.com and will not be explained in detail here.
After downloading the Mysql for win32 installation package, open it with winzip and run setup.exe directly. What you need to pay attention to is to choose an installation path. Of course, the installation path can be arbitrary, but I recommend installing it with PHP, choose C: MySQL directory. After the installation is complete, MySQL is complete. As for setting users and passwords, you can use the two software mentioned above to manage them. The description will not be continued here. The default username is root and the password is empty.
Generally, the service will be automatically started after MySQL is installed. If it is not started, please run C:MySQLbinmysqld-nt.exe
The next installation depends on what you choose as your web server. I suggest using Apache. If you feel it conflicts with your IIS, then please use IIS directly.
<3>IIS configuration:
Open IIS, right-click on "Default Web Site" to open properties, and make the settings as shown below in the home directory. Pay attention to the steps:
After completion, the IIS+PHP+MySQL environment is established.
<4> If you don’t have IIS, then we install Apache, a small web server:
The for win32 we downloaded is an Msi installation file. Just double-click it and the installation of Apache will be automatically executed. Just follow the prompts to install it. Fill in the things to be written according to your preferences. It has no impact. Of course, the directory I still recommend that you choose the C: directory as the PHP directory, so that you can see C: Apache2 after installation. After installation, the Apache icon will be displayed in the system tray in the lower right corner of the desktop. Double-click it to open the Apache control panel and stop or restart the server.
What needs to be done here is to modify the file C:Apache2confhttpd.conf and open it with Notepad:
Found:
#NameVirtualHost *
Modified to:
NameVirtualHost 127.0.0.1
Found:
Modify the following lines:
ServerAdmin (the administrator email you just entered during installation)
DocumentRoot c:Apache2htdocs
ServerName Apache2
ErrorLog c:Apache2logserror_log
CustomLog c:Apache2logsaccess_log common
Found:
AddType application/x-tar .tgz
Add the following two lines below:
AddType application/x-httpd-php .php
AddType image/x-icon .ico
Found:
#LoadModule ssl_module modules/mod_ssl.so
Add a line below:
LoadModule php4_module C:phpsapiphp4apache2.dll
Add default file:
Find the DirectoryIndex * line, which can be modified like this and add the default file name:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html
Save the file and restart the apache server.
At this point the PHP environment has been completely established.
<5>Installation of Zend Optimizer (optional)
After downloading, it is an .exe file. You can install it directly. The installation process requires you to select the PHP version. Be sure to select it accurately. Here I choose php 4.3.x. Before completing the installation, you will be prompted whether to back up php.ini. Click OK. The installation is finished.
Open php.ini and modify one place:
Found:
[Zend]
It can be seen below:
zend_optimizer.optimization_level=*
This line,
Change the value after = to 1023, that is, change this line to
zend_optimizer.optimization_level=1023
After saving, it will be OK. Restart Apache/IIS, and the installation is complete. I'm very tired too :)
<6>Test:
Use Notepad to create a new file, write the following lines, and save it to the C:Apache2htdocs directory. This directory is your site and directory, named phpinfo.php. Then enter http://localhost/phpinfo in the browser. php, you can see all the information about PHP.
CODE
phpinfo();
?>
You need to note that when you save the file, the file extension should be .php. (Notepad will automatically add the .txt suffix to the file name unless you take one of the following measures to avoid this.) When you save the file, the system will ask you to specify the file name. In this case, please Add quotation marks to the file name. (For example, "hello.php.") Alternatively, you can click the "Save as type" drop-down menu in the save dialog box and change the setting to "All files." This way you don't need to add quotes when entering the file name.
The above paragraph is excerpted from the "PHP Chinese Manual". For more detailed installation information, please go to http://www.php.net/docs.php to download this Chinese manual. It contains detailed installation of various systems, but it is not very intuitive. And so, some optimizations have not been written out :)
Below I will give you the download addresses of several software you need to use:
PHP4.3.1 stable version:
http://www.blueidea.com/download/forum/php...4.3.1-Win32.zip
Mysql4.0.13 stable version:
http://www.blueidea.com/download/forum/mys...-4.0.13-win.zip
Apache2.0.45 stable version:
http://www.blueidea.com/download/forum/apa...-x86-no_ssl.msi
Zend Optimizer:
http://www.blueidea.com/download/forum/ZendOptimizer-2[1].1.0a-Windows-i386.exe
In addition, PHP4.3.2RC4 includes the PEAR package, which is not available in PHP4.3.1. If it is included in the compressed package you downloaded, set the include path in php.ini and find the following two lines:
; Windows: "path1;path2"
;include_path = ".:/php/includes"
Modified to:
; Windows: "path1;path2"
include_path = "C:phppear"
Just save it. This is the PHP include file path. You can set multiple files and separate them with ";".