Installing PHP notes under Windows

Source: Internet
Author: User
Tags install php php books

In order to further understand the configuration of the server side, the previous article on how to install Apache under Windows, then the next study under Windows to install PHP and run PHP environment with Apache, purely learning to use the ^^, If you have trouble, you can install the integration environment (WAMP, etc.) directly.

One: Download the installer

The download here is also a compressed package, directly decompression can be. The latest version of PHP has reached 7.1, taking into account that most of the projects are in the 5.x version, as in the case of PHP 5.6 (5.6.23).

php:http://windows.php.net/download/

Here choose vc11x64 thread Safe compressed version, (x86 is 32 bit, do not choose the wrong)

About thred safe or non thread safe to the web to check the next probably this (we are here is the Apache server to choose thred Safe bar):

Two ways to do PHP: ISAPI and FASTCGI
ISAPI execution method is used in the form of DLL dynamic library, can be executed after the user request, after processing a user request will not disappear immediately, so the need for thread security check, so as to improve the execution efficiency of the program, so if the ISAPI to execute PHP, Recommended choice of Threadsafe version
FastCGI execution is performed in a single thread, so there is no need for thread security checks, but the protection of thread security can improve execution efficiency, if it is fastcgi to execute PHP, it is recommended to choose Nonthread Safe version
Through Phpinfo (); Look at the thread Safety item in it, this project is to see if it is thread safe, if yes: enabled, generally it should be TS version, otherwise it is version nts

Download it and then extract it to the C:\wamp-all\ directory and rename it to php-5.6.23.

Two: Configure PHP

1. Php.ini-production renamed to PHP.ini

2. Search; Extension_dir = "Ext" removes the previous; (semicolon), which is an open comment.

This is the path to the extension library directory (you need to point to the directory that holds the PHP extension library file), can be an absolute path (such as "C:/wamp-all/php-5.6.23/ext") or a relative path (such as "ext"), where the default is ext, open the comment directly.

3. Open the extension library in turn

Php_fileinfo.dll, Php_gd2.dll, Php_mysql.dll, Php_mysqli.dll, Php_pdo_mysql.dll will be in front;

Three: Configure Apache

The previous section has explained the basic configuration of Apache, and now this is an extension module for installing PHP as Apache (just an extension of Apache).

1. LoadModule

In the Apache config file httpd.conf search LoadModule in the last LoadModule add:

LoadModule php5_module "C:/wamp-all/php-5.6.23/php5apache2_4.dll"

There are two parameters, the first parameter php5_module is the name of the module, you can take it yourself, the second parameter is the DLL file of the module, which can be found in the extracted PHP package (there are several similar, do not find the wrong).


LoadModule php5_module "C:/wamp-all/php-5.6.23/php5apache2_4.dll" #加载php模块

The parameter error is reported.

2. AddType

In the Apache configuration file, locate AddType application/x-gzip. gz. tgz

Add the following directly to the PHP module to resolve which suffix file, multiple spaces separated

AddType application/x-httpd-php. php. phtml

3. Phpinidir specify the location of the PHP configuration file

Add it directly below the AddType application/x-httpd-php. PHP phtml.

Phpinidir "c:/wamp-all/php-5.6.23"

After configuring save, restart Apache.

Found an error

But do not see the error log, do not know what is wrong, online search, and some say that the port is occupied by other programs, changed the port to restart Apache or the same error.

Found a way to start Apache in command-line mode, and if an error occurs, a message will be printed on the command line

Open cmd, CD to Apache/bin directory, execute: HTTPD.EXE-W-n "Apache"-K start;

where "Apache" is the Apache server name specified when Apache is installed (see Apache installation article)

The first is the report parameter error, above has been said, the note is removed on the can.

Remove comments Run httpd.exe-w-n "Apache"-K start; new errors found

See these error message, think of the choice to download PHP version when the choice is vc11, need to download the VC11 compilation environment.

: http://www.microsoft.com/zh-CN/download/details.aspx?id=30679

Select the appropriate type to download and install.

The installation completes and then restarts Apache, too happy. Everything works fine.

Finally test the PHP environment, create a new index.php under the site root directory

<?phpecho "Hello World";

Open Browser Input http://localhost/index.php

Appearance: Hello World

The environment is normal.

Summary: began to read the tutorial on PHP, the example of the book is too old. Note here in the download version and configuration Apache, the environment has been running smoothly, of course, the PHP environment on Linux will be tossing the next ^^. The next section looks at the MySQL installation.

Reference Documentation:

1. PHP Books

2. http://windows.php.net/download/

3. http://jingyan.baidu.com/article/e4d08ffd8fa40d0fd2f60dfd.html

4.http://zhidao.baidu.com/link?url=q41murlazkofo_dy_ ygnq7dyndoncol1mu71oudec6xf0zdxhzooiq6o3ij-vhon104agplgavbbi2cmjcmimnley45_hci5mwtza_j2xpm

Installing PHP notes under Windows

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.