PHP installation steps (using apache2.2 + php5.3 as an example)

Source: Internet
Author: User
1. DownloadApacheforwindowsMSIfile, andrunitBydefault, portis80, rootdiris % apache_dir % htdocs. Youcanupdatethesettingsinconfhttpd. enabled, Ex

1. download Apache for windows MSIfile, and run it Bydefault, port is 80, root dir is % apache_dir %/htdocs. you can update thesettings in conf/httpd. conf file 2. if Apache Service can't be installed in Control Panel Admin Tools Services, Ex

1. Download Apache for windows MSIfile, and run it

Bydefault, port is 80, root dir is % apache_dir %/htdocs. You can update thesettings in conf/httpd. conf file

2. If Apache Service can't be installed in "Control Panel> Admin Tools> Services ",

Execute following command in % apache_dir %/bin

Httpd.exe-k install-n Apache2.2

Several other useful commands:

Remove apache service:httpd.exe -k uninstall -n Apache2.2

Start apache service from:httpd.exe -k start

Stop apache service:httpd.exe -k stop orhttpd.exe -k shutdown

Restart apache service:httpd.exe -k restart

If you do not use windows Apache service, you can directly use the following command:

Start apache server: httpd

Stop apache server: httpd.exe -k shutdown

Restart apache server:httpd.exe -k restart


2. Test if apache server works

1) Start server: start "Apacheservice" from "Control Panel> select" Start> Programs> Apache httpserver 2> control apache server> start "or start server from apacheserver icon in the right bottom corner of desktop

For Win 7, none of the above methods can start apache server. You need to select apache icon in the lower right corner of rightclick, select "open services", and then start "apache server" service

2) Try to accesshttp: // localhost

3. Download and extract php5.3 zipfile

Note: download php 5.3 VC9 thread safe version

4. Go to the php installation directory and copy php. ini-production or php. ini-development, and name it php. ini.

Assume php install dir is "d:/php5"

5. Configure PHP in php. ini file

1) Find

Extension_dir = "./"

Change it to following

Extension_dir = "d:/php5/ext"

IF there is "#" before abve code, must remove it !!!!!!!!!!!!!!

Php can 'tfind extension module without it

2) To support mysql, remove ";" fromfollowing line

; Extension = php_mysql.dll

If php load mysql module successfully, you can see "mysql" module (NOT "mysqlnd" module) in phpinfo ()


To Support openssl, remove ";" from following line (phplist with gmail setting must use openssl)

; Extension = php_openssl.dll

If php load mysql module successfully, you can see "openssl" module in phpinfo ()


3) (Optional) To enable short open tags (for example ), Find "short_open_tag" setting and change it tofollowing:

Short_open_tag = On

4) (Optional) To display errormessages in your browser window for development, find "display_errors" settingand change it to following:

Display_errors = On

6. Configure Apache for PHP 5

Open % apache_dir %/conf/httpd. conf file,

1) Add php module

If usingApache 2.0.x, add following line after all the LoadModule statements:

LoadModulephp5_module "d:/php5/php5apache2. dll"

If usingApache 2.2.x, add the following line instead:

LoadModulephp5_module "d:/php5/php5apache2_2.dll"

Note: "/" instead of "/" is used.

2) Add php type

Searchfor "AddType" in the file, and add the following line after the last "AddType" statement

AddTypeapplication/x-httpd-php. php

AddTypeapplication/x-httpd-php. phtml

3) Indicate the location folder ofyour PHP ini file

Add the following line to the end of your httpd. conf file.

PHPIniDir "d:/php5"

Note: "/" instead of "/" is used.

4) Find "DirectoryIndex" setting, and change it

DirectoryIndex index. php index.html

5) Save httpd. conf file and restartapache server

7. Create a test. php file in rootpath, the content is following:

Tryit fromhttp: // localhost/test. php

Note: you do not need to add the php installation directory in the environment variable "path ".

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.