I read a PHP book in 2003, when it was still PHP3. Looking back four years ago, the prospects for PHP on the web are still bright! I haven’t seen PHP for three years and now it has reached PHP5. It has been three or four months since I actually started writing the first PHP WEB. I am currently working on the www.kuomart.com website in my spare time. When I was writing, I recalled that I had been using Windows 2003+IIS6+PHP5.0.7+MYSQL4.1 for development. Until yesterday, my machine had a Trojan, and Kav didn’t find out why. I didn’t find any suspicious exposure points myself, so I simply reinstalled xp. Since the TV1000 TV card can only run normally in xp, the configuration was successful once before under the 2003 system, but a hardware error blue screen appeared! So I simply installed the web development part of my development environment under 2003 under XP. I really want to install a lamp environment, but considering that there is too much data on the machine, it is troublesome to operate. I will wait until I have money to buy a hard drive or just do it on a whim that day. So I started configuring the environment at noon today!
I went to http://www.apache.org and downloaded the latest version of apache, apache.2.24. After installation, I couldn’t find the service. It turned out that I chose only the second option. If I choose this option, I need to manually add the windows service. ! It took me a while to figure it out, so if this is your first installation, just don’t set any unnecessary settings in the next step. It will run fine!
The next step is to install php. I started to install php5. 0.4,4, I won’t go into details about installing php. I will post the information I found below. Then there is the configuration of apache to support php. Of course, I need to modify httpd.conf, but I
use Notepad to open the C:Program FilesApache Software FoundationApache2.2confhttpd.conf file and modify it:
① Found:
AddType application/x-gzip .gz .tgz
Add the following lines below:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
AddType image/x-icon . ico
② Find:
#LoadModule ssl_module modules/mod_ssl.so
Add a line below:
LoadModule php5_module C:php5php5apache2_2.dll
(Special tip: If your Apache version is 1 .x, here should be: LoadModule php5_module C:php5php5apache.dll; if your Apache version is 2.0.x-2.2.x, here should be: LoadModule php5_module C:php5php5apache2.dll, I pay here It took a lot of trouble to discover this! )
③ Find:
DirectoryIndex index.php…
This line can be modified like this and add the default file name:
DirectoryIndex index.php default.php index.htm index.html default.htm default.html
Why is it incorrect to add LoadModule php5_module C:php5php5apache2_2.dll?
requested error appears
Of course this is the case Usually I just search on Baidu or Google. It turns out that it is a problem between various versions. I think it is. I found the corresponding configuration information as follows:
1. Download the latest Apache2.24, MySQL5.2, PHP5.2.1 [Download address: http://cn.php.net/downloads.php Note: Download php-5.2.1-Win32 and pecl-5.2.1-Win32 (extension package) at the same time, the format is the decompressed one, and It is not the kind that is directly installed by exe or msi. ] (Please use Baidu to search for the specific address).
2. Install and configure PHP5.2.1
1. Unzip the PHP5.2.1 compressed package to C:PHP5 (this path and file name can be arbitrary, but if this path and file name are used below, If you are not using this path and file name, please modify it accordingly).
2. Copy the following files in the C:PHP5 directory to the Windows system folder. The folder varies depending on the Windows version (if it is Windows9x/ME, it is c:windowssyste; 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 respond accordingly. Make changes)
php5ts.dll
fdftk.dll
fribidi.dll
gds32.dll
libeay32.dll
libmcrypt.dll
libmhash.dll
libmysql .dll
libswish-e.dll
msql.dll
ntwdblib.dll
ssleay32.dll
yaz.dll
3. Copy the file php.ini in the C:PHP5 directory -dist is renamed to php.ini (this configuration file automatically adds "//" to all added content, which increases security and also increases trouble; if php.ini-recommended is renamed to php.ini, the configuration file will not The added content plus "//" reduces security but makes it more convenient.Which one you choose is up to you), copy php.ini to C:windows(XP/2003/9x/Me) or C:Winnt(2000/nt), open it with Notepad, and make the following modifications:
① Search for the line extension_dir= ./, and point its path to the extensions directory in your PHP directory. Modify it to: extension_dir = C:PHP5ext
② If you want to support more modules, please do the following. If you don’t want to If so, 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 to 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. Search:
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
The supported extensions are commented out with semicolons in front. Module, if you want PHP to support a certain module, please remove the ";" in front. The following is the result after my test. Generally, there will be no problem after removing the comments as follows:
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 modification is completed, save php.ini.
③Unzip the pecl-5.2.1-Win32.rar package and copy all files in it to the C:PHP5ext folder. (This folder is where the extension files of PHP5.2.1 are stored. If you have compiled a PHP extension program in C language, you can also put it in this folder)
④Create a new folder in the C:PHP5 directory , named: session. (This folder is used to save the session, because PHP does not have memory-resident variables like the application in ASP, so for those who save the initial query conditions for page turning, or make a shopping cart, the session is almost is the only option. However, the folder needs to be cleaned regularly in the future)
This completes the installation and configuration of PHP.
3. Mysql installation
Mysql is relatively independent. This database is very small and cannot be operated directly. It does not have graphical management tools like access or SQL2000, but at present There are already many graphical management software that can operate it well, such as: EMS SQL Manager 2005 for MySQL (strongly recommended as the best MySQL management software), Navicat, phpMyAdmin, mysqlcc. These software can be downloaded from the Internet and will not be described in detail here.
1. After downloading the Mysql for win32 installation package, open it with winzip and run setup.exe directly. It should be noted that you should choose an installation path. Of course, the installation path can be arbitrary, but it is recommended to install it together with PHP. , select the C:MySQL directory.
2. After the installation is completed, MySQL automatically enters the setup phase. Configure according to the default method, and finally enter the password to complete the setting. (The default username is root and the password is empty)
3. Generally, the service will be automatically started after MySQL is installed. If it is not started, please double-click C:MySQLbinmysqld-nt.exe to run it.
4. If you have downloaded several of the management software mentioned above, you can use them to manage MySQL.
Four. IIS configuration (choose the fifth option)
Open IIS, right-click on the "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.
5. Apache installation configuration (choose the fourth option)
If you have not installed IIS, then please install Apache, a small and powerful web server. The installation directory is recommended to be the same as the PHP directory. , select C:.The system default installation directory is C:Program Files:
1. Download the Apache2.2.4 for win32.Msi installation file, double-click it and the installation of Apache will be automatically executed.
2. During the installation process, follow the prompts and enter localhost in the first blank line from top to bottom, and enter your name and email address in the remaining two blank lines (you can enter anything you want) to complete the installation configuration.
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 you can stop or restart the server.
3. Configuration of Apache2.2.4
Use Notepad to open the C:Program FilesApache Software FoundationApache2.2confhttpd.conf file to modify:
①Find:
AddType application/x-gzip .gz. tgz
Add the following lines below:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
AddType image/x-icon .ico
② Found:
#LoadModule ssl_module modules/mod_ssl.so
Add a line below:
LoadModule php5_module C:php5php5apache2_2.dll
(Special note: If your Apache version is 1.x, this should be: LoadModule php5_module C :php5php5apache.dll; If your Apache version is 2.0.x-2.2.x, this should be: LoadModule php5_module C:php5php5apache2.dll, I found this out after a lot of trouble)
③ Find:
DirectoryIndex index.php…
This line 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.
6. Zend Optimizer installation configuration (optional)
After downloading, it will be an .exe file. You can install it directly. The installation process requires you to choose the PHP version. Be sure to select it accurately. Here I Select php5.2.1. Before completing the installation, you will be asked whether to back up php.ini. Click OK to end the installation.
Open php.ini and modify a place:
Find:
[Zend]
As you can see below:
zend_optimizer.optimization_level=*
In this line, replace "=" The subsequent value is changed to 1023, that is, this line is changed to:
zend_optimizer.optimization_level=1023
After saving, restart Apache/IIS, and the installation is complete.
7. Test
Use Notepad to create a new file and write the following lines:
phpinfo();
?>
Rename the file to phpinfo.php and save it to C:Apache Software FoundationApache2.2htdocs directory (this directory is the root directory of your site), and then enter http://localhost/phpinfo.php in the browser.
If you can see the relevant PHP information, it proves that the installation and configuration of the entire IIS6/Apache2.2.4+MySQL5.2+PHP5.2.1 environment under Windows is successfully completed!