Windows PHP5.2.14 and apache2.2.16 installation configuration method

  • 2020-03-31 21:16:43
  • OfStack

First, download the configuration files you need to install
1, (link: http://apache.freelamp.com//httpd/binaries/win32/httpd-2.2.16-win32-x86-no_ssl.msi)
2, (link: http://cn2.php.net/get/php-5.2.14-Win32.zip/from/a/mirror)

One, apache configuration

The installation of apache do not say, the installation process to choose their own want to install the location, all the way next, it is ok. Default port 80, after the installation, the browser input (link: http://localhost/) to verify, successful will output It works!

Apache configuration: the configuration file is located at %APACHE_HOME%\conf\httpd.conf in the installation directory, modifying the root DocumentRoot (two). The port is also modified here.

Ii. PHP configuration

Unzip the downloaded php-5.2.14-win32.zip. Be careful not to turn on the debug or non-thread-safe versions of PHP when downloading. Otherwise you will get an error when combined with apache.

Make a copy of the unzipped php.ini-dist for backup, rename the original php.ini-dist to php.ini, open the file, and configure it.

1. Set extension location: extension_dir = "%PHP_HOME%/ext"

2. Open the needed extension: extension=php_bz2.dll, extension=php_gd2.dll, extension=php_mysqli.dll, extension=php_mysqli.dll before the semicolon removed (note that there should be no space in front of the extension=php_mysqli.dll), if you want to open other extensions, then the semicolon in front of other extensions removed.

3. Jet lag: find  

         ; Date. Timezone =

    Modified to

          Date. Timezone = PRC

4. Setup in conjunction with apache

Open the apache configuration file httpd.conf, in

# LoadModule vhost_alias_module modules/mod_vhost_alias. So

Enter below this line:

LoadModule php5_module E: / PHP/PHP - 5.2.14 - Win32 / php5apache2_2. DLL

PHPIniDir "E: / PHP/PHP - 5.2.14 - Win32"
AddType application/x - HTTPD - PHP. PHP. PHTML

Explanation:

      The first is the location of the dynamic link library that PHP USES in conjunction with apache, which is in the root directory after PHP is unzipped.

      The second behavior is the path to the php.ini file

      The third line tells the browser to forward the.php.phtml file to apache for parsing.

Restart Apache so it can be associated with PHP. (note that every time you modify an Apache or PHP configuration file, restart Apache.)

Should encounter the problem of garbled code, continue to supplement when encountered.

PS: as expected, I encountered some garbled code. I used Eclipse for PHP Developers for development. The workspace encoding is set to utf-8 by default in the preferences, but when a PHP or HTML page does not contain < Meta HTTP - equiv = "content-type" Content = "text/HTML. Charset = utf-8 "> , then there will be Chinese garbled code. Check that the encoding of the garble file is utf-8, it must be saved and saved as utf-8, the garble will disappear, it should be a bom (Byte Order Mark) problem. Current solution: open php.ini file, query keyword: "default_charset", remove the preceding semicolon, change the value to utf-8, restart apache.

Preparation conditions:

Apache 2.2.16   Installed version (link: http://archive.apache.org/dist/httpd/binaries/win32/)

PHP 5.3.3   VC6 x86 Thread Safe decompress Zip ((link: http://windows.php.net/download/)

Mysql 5.1.x installation or decompression version can be, as long as the normal startup

First install Apache 2.2.16 to the PHPWebSite folder of D disk (my personal habit) (need to create a new folder named PHPWebSite in D disk), after the installation test whether the installation is successful, in the browser input (link: http://localhost/) return, if It works! Apache 2.2.16 installation success, and can be used normally! (note: if you have an IIS server on your computer, either close the IIS server or modify the port of IIS. Since Apache also USES port 80, it is recommended to change the IIS port to another port, such as port 8090.)

Then PHP 5.3.3  VC6 x86 Thread Safe zip package unzip to the PHPWebSite directory of D disk, rename it as PHP, configure the PHP configuration file, find the php.ini-development file under the PHP folder (I use this) or php.ini-production file, change the suffix name of this file to php.ini, then open php.ini, find the line extension_dir, Change this line to extension_dir = "D:/PHPWebSite/ PHP /ext" and remove the semicolon (note no Spaces, change the \ in the path to /, or you'll get an error). Open the required PHP extension, will extension=php_bz2.dll, extension= php_fileinf.dll, extension=php_gd2.dll, extension=php_mysql.dll,
Extension =php_mysqli.dll before the semicolon removed (note that there is no space in front of the DLL), if you want to open other extensions, then the extension before the semicolon removed, it is ok. At this point, the PHP environment is basically configured.

Problem of time difference in php5
< ? PHP echo date (" Y -m - d H: I: s "); ? > The time difference is eight hours
Why? The new version of the PHP5 series adds a time zone setting, which defaults to Greenwich time, exactly eight hours from the east 8 zone, where China is located
Find date.timezone with this line
; Date. Timezone =
Will; Get rid of it and change it to
Date. Timezone = PRC

Next configure Apache 2.2.16 to associate Apache 2.2.16 with PHP. Go to D: PHPWebSite\Apache2.2\conf directory to find the Apache configuration file httpd.conf, open the configuration file, in
Type in the following line of #LoadModule vhost_alias_module modules/mod_vhost_alias.so:

LoadModule php5_module D: / PHPWebSite/PHP/php5apache2_2. DLL
PHPIniDir "D: / PHPWebSite/PHP"
AddType application/x - HTTPD - PHP. PHP. PHTML

Restart Apache so it can be associated with PHP. (note that every time you modify an Apache or PHP configuration file, restart Apache.)

Finally, install Mysql 5.1.x (Mysql has nothing to do with PHP), so don't repeat!

Note: the above mentioned environment configuration can be in XP, Win2003, vista, Win7 flagship 32-bit version can be configured normally, in the Windows 7 flagship 64-bit version can not run normally, the reason is still unknown, or a mystery! Xi xi xi...... ^_^


Related articles: