PHP Windows Environment Deployment

Source: Internet
Author: User
Tags php development environment php file upload php windows

1. Description

This article is used in the Windows environment to manually build PHP development environment, the installation of functional modules mainly include mysql,php and Apache three, the environment is as follows:

L WINDOW7 (64-bit)

L MySQL 5.7.14

L PHP 5.6 (64-bit)

L Apache 2.4.23 (64-bit)

For the sake of management and configuration, we have all the function modules installed in the C-drive PHP directory.

2. MySQL2.1 Installation

: http://dev.mysql.com/downloads/installer/

Double-click the downloaded program to install

2.2 Service

For easy access to the MySQL database, you have the option to install MySQL as a window service. During installation, you can choose to start MySQL as a Windows service, and you can manually set it as a Windows service without setting it.

Run the command line as an administrator, go to the MySQL installation directory, and use the Settings command as follows:

Mysqld--install MySQL--defaults-file= "xxx \my.ini"

Where Defaults-file is the My.ini file under the installation directory.

2.3 Remote connections

(1). Log in to the MySQL database using a named row

Mysql-u root–p

(2). Use the MySQL database to modify the access host, for example '% '

Use MySQL;

Update user Set host = '% ' where user = ' root ';

3. PHP3.1 Installation

: http://windows.php.net/download#php-5.6

Download the Vc11-x64-thread-safe version, unzip the downloaded zip file into the c:/php/php directory, and rename the php.ini-development to PHP.ini

3.2 Configuring the expansion module

Open the php.ini file and make the following settings:

(1). set Extension Module path

Extension_dir = "C:/php/php/ext"

(2). Enable modules such as Mysql,curl, remove the front;

Extension=php_curl.dll
Extension=php_gd2.dll
Extension=php_mbstring.dll
Extension=php_mysql.dll
Extension=php_pdo_mysql.dll
Extension=php_pdo_odbc.dll
Extension=php_xmlrpc.dll

3.3 Configuring the session

When using the session function, you must configure the session file on the server to save the directory, or you can not use the session, create a read-write directory folder,

php.ini config file found; session.save_path = "/tmp" changed to Session.save_path = "XXX"

3.4 Configuration File Upload

When using the php file upload function, we must specify a temporary folder to complete the file upload function, or the file upload function will fail to create a read-write directory folder on Windows 7.

php.ini config file found; upload_tmp_dir = changed to Upload_tmp_dir = "XXX"

3.5 Modifying Date.timezone

php.ini config file found; date.timezone = changed to Date.timezone = Asia/shanghai

4. Apache4.1 Installation

: http://www.apachelounge.com/download/

Download Httpd-2.4.23-win64-vc14.zip version and run environment Vc_redist.x64.exe, first install the running environment VC_ Redist.x64.exe, and then extract the Httpd-2.4.23-win64-vc14.zip file to the C:/php/apache directory.

4.2 Configuring the Service Path

Go to the Conf directory in the Apache directory and open httpd.conf in Notepad to find

ServerRoot "xxx" This line, modify the actual installation path, for example

ServerRoot "C:/php/apache24"

4.3 Configuring the Listening port

Locate the Listen 80 line in the httpd.conf file and modify the IP and port to actually listen, such as Listen 127.0.0.1:8080

4.4 Configuring the Web root directory

Find the DocumentRoot "xxx" line in the httpd.conf file and modify the paths in the DocumentRoot "xxx" and <directory "xxx" > to the actual Web site directory used. In the directory configuration, you can set the corresponding directory access permissions, and so on.

4.5 Configuring PHP

(1). Loading PHP Modules

Added under #loadmodule vhost_alias_module modules/mod_vhost_alias.so in the httpd.conf file

LoadModule php5_module "C:/php/php/php5apache2_4.dll"
Phpinidir "c:/php/php"

Where c:/php/php is the PHP installation directory

(2). Set Index file sequencing

PHP features configured to enable index.php priority execution, found in the httpd.conf file Dir_module, in the internal department

DirectoryIndex index.html instead

DirectoryIndex index.php index.html

(3). Support PHP MIME type

Locate the Mime_module in the httpd.conf file and add it internally

AddType application/x-httpd-php. php. html. htm

4.6 Configuring Services

Apache can be used as a Windows service, open a command window as an administrator, go to the bin directory under the Apache installation directory, execute the following command

Httpd-k Install

That is, Apache can be installed as a Windows service. Use ApacheMonitor.exe in the bin directory under the Apache installation directory to start, close services, and so on.

4.7 + Ports

(1). Add multiple ports to listen, add multiple listen in httpd.conf, for example

Listen 127.0.0.1:8080

Listen 127.0.0.1:8081

(2). To configure VirtualHost for each port, add the VirtualHost configuration last in httpd.conf, for example

<virtualhost *:8080>

DocumentRoot "D:/WORKSPACE/PHP1"

<directory "D:/WORKSPACE/PHP1" >

Options Indexes FollowSymLinks

AllowOverride All

Require all granted

</Directory>

</VirtualHost>

<virtualhost *:8081>

DocumentRoot "D:/workspace/php2"

<directory "D:/workspace/php2" >

Options Indexes FollowSymLinks

AllowOverride All

Require all granted

</Directory>

</VirtualHost>

The corresponding port can be accessed when the configuration is complete

PHP Windows Environment Deployment

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.