PHP Standalone Environment configuration

Source: Internet
Author: User
Tags configuration php phpinfo

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

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

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

First, installation configuration Apache2.4.7 (Httpd-2.4.7-win64-vc11.zip)

1. Unzip the downloaded installation package: Httpd-2.4.7-win64-vc11.zip put it into its own installation directory (my directory D:\phpEnv\Apache24) Win7 (64-bit) php5.5-apache2.4-mysql5.6 environment installation

2. Then modify the http.conf (D:\phpEnv\Apache24\conf\http.conf) configuration file-use Notepad to open the line

(1) Modify the root path of ServerRoot Apache: (37 lines) ServerRoot "C:/apache24" to =>serverroot "D:/phpenv/apache24"

(2) modify servername your host name: (217 lines) servernamewww.example.com:80 Remove the previous #, which is required when launching Apache from the command line.

(3) Modify DocumentRoot Apache access to the home folder directory, is the location of PHP, HTML code files.

Apache default path is under Htdocs (D:\phpEnv\Apache24\htdocs), there will be a simple entry file index.html.

This path can be modified on its own, and I will configure it in my own new folder, www (D:\phpEnv\www).

(247 lines) DocumentRoot "C:/apache24/htdocs" <directory "C:/apache24/htdocs" > changed to = = DocumentRoot "D:\phpEnv\www" <directory "D:\phpEnv\www" >

(4) Modify the Portal file configuration: DirectoryIndex generally we are index.php, index.html, index.htm as the portal for Web projects. Apache Default portal only index.html need to add the other two support,

Of course, the entrance file settings can be increased or decreased according to their own needs, if the requirements are more stringent can only write a index.php, so that the entry in the project can only be index.php

(274 lines) <IfModuledir_module> directoryindexindex.html = = <IfModuledir_module> DirectoryIndex index.php index.htm index.html

(5) Set the Serverscript directory:

(358 lines) scriptalias/cgi-bin/"c:/apache24/cgi-bin/" to = = scriptalias/cgi-bin/"D:/phpenv/apache24/cgi-bin"

(6) (380 lines) <directory "C:/apache24/cgi-bin" > AllowOverride none Options none Require all granted change to =

<directory "D:/phpenv/apache24/cgi-bin" >

AllowOverride None

Options None

Require all granted

3, next can launch Apache started---run, enter cmd, open command prompt.

Then enter the D:\phpEnv\Apache24\bin directory to enter httpd enter,

. You can test without an error (Keep the command window open).

Put the index.html in the Apache24\htdocs directory in the D:\phpEnv\www directory, access to the browser will appear "It works" that the Apache has been properly installed and started.

You can also write a simple index.html file or open it yourself.

4. Add Apache to the Window service startup item and set it to boot to start off the httpd service (Close the command window)

Reopen a new command window into the D:\phpEnv\Apache24\bin directory:

The command to add the HTTP service is: Httpd.exe-kinstall-n "ServiceName" ServiceName is the name of the service,

I added: httpd.exe-k install-n "Apache24" command successful, there will be a successful prompt,

At this point you can see the Apache24 Service in the Window service startup item and click Start.

You can also modify the startup type to manual if you do not want to set it to boot.

If you want to uninstall this service, first stop the service and then enter Httpd.exe-k uninstall-n "Apache24" to uninstall the service.

Of course, you can also D:\phpEnv\Apache24\bin the following ApacheMonitor.exe to launch Apache here is not much to say so Apache configuration is basically completed.

Second, install the configuration php

1, unzip the downloaded Php.zip to the installation directory my Yes (D:\phpEnv\php)

2. Copy the Php.ini-development file in the directory and rename it to php.ini it is a PHP configuration file

3. Add PHP support for Apache service Open Apache config file http.conf at last add

# PHP5

Support Loadmodulephp5_module D:/phpenv/php/php5apache2_4.dll

addtypeapplication/x-httpd-php. php. html. htm

# Configure Thepath to PHP.ini

Phpinidir "d:/phpenv/php"

Here I added under LoadModule to ensure that your Php5apache2_4.dll file does exist php5.5 earlier version there is no this file,

But there's already a high-point version,

You can open the PHP installation directory to find this file Phpinidir "d:/phpenv/php" This is your PHP root directory

4. Restart the Apache server.

5. Test. Delete other files in www, create a new index.php, the content is < PHP phpinfo ();?>

saving, accessing the information that appears in PHP indicates that PHP has been successfully installed.

Note: Some common configuration changes in PHP: (D:\phpEnv\php\php.ini)

Settings for time zone: Date.timezone = Asia/shanghai

Error Reporting level: Error_reporting = E_all

This can all be opened in development mode.

Third, install the configuration MySQL

1, download the MySQL compression package, directly extracted to the installation directory, and then configure the relevant environment variables, modify the configuration file, Add window service on the line, here is not detailed.

Here put my configuration file for everyone to refer to the following:

[Mysqld]

Loose-default-character-set = UTF8

Basedir = d:/program/mysql-5.6

DataDir = D:/program/mysql-5.6/data

Port = 3306

Sql_mode=no_engine_substitution,

Strict_trans_tables

Character_set_server = UTF8

[Client]

Loose-default-character-set = UTF8

Note: Basedir is the root directory of MySQL and DataDir is the data storage directory for MySQL. I'm not going to explain anything else.

After installing MySQL, there is no graphical user interface, you can install a navicat for MySQL and other software, this will look more convenient.

2, after the installation of MySQL, add MySQL support for PHP

Open PHP configuration file php.ini (D:\phpEnv\php\php.ini)

(1) (721 lines); Extension_dir = "ext", remove the front ";",

And instead of Extension_dir = "D:\phpEnv\php\ext" to open the extension of PHP support, ext folder has a lot of PHP extension support. dll files, interested students can see.

(2) then the MySQL extension that opens PHP

(875, 876 lines) remove the front ";" Extension=php_mysql.dll Extension=php_mysqli.dll

Of course you can also open 881 rows of Php_pdo_mysql.dll enable PHP PDO support I usually use this.

Note: There are many expansion options in lines No. 863 through No. 888, what you need to use, and remove the previous ";" You can do it.

Of course, if you want to add additional extension support such as Redis support, PHP itself may not provide the appropriate DLL files,

You need to find it yourself. Add the DLL to the Ext folder, then add a extension= to the configuration file ... When you are done,

Restart Apache when you visit phpinfo to see

Iv. Summary:

The installation of the PHP environment has a lot of information on the Internet,

When I was in touch with PHP, it was also an enormous search,

It's been on my computer a lot of times,

Started with integrated packages, WAMP, Appserv, etc., and later after the PHP version was upgraded,

Finding PHP to upgrade the integration pack is a hassle,

Therefore, it is strongly recommended that you do a separate configuration under the environment to better understand the connection between Apache, PHP, and MySQL.

PHP Standalone Environment configuration

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.