Home  >  Article  >  Backend Development  >  Configuring PHP environment under Windows 8.1_PHP tutorial

Configuring PHP environment under Windows 8.1_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:17:001079browse

1. Download the installation package:

Apache2.2: http://mirrors.cnnic.cn/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

PHP5.4: http://windows.php.net/downloads/releases/php-5.4.22-Win32-VC9-x86.zip

Mysql5.5: http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.35-winx64.msi

Of course the software versions are not limited to the above, but there are still two points that need to be explained here:

First, openssl in the Apache software package means that it contains the openssl module. You can use openssl to configure an SSL secure link for Apache. If you use PHP under apache1 or apache2, you should choose the VC6 version. If you are under IIS When using PHP, you should choose the VC9 version;

Second, the difference between VC6 and VC9 in the PHP package: the VC6 version is compiled using visual studio 6, while VC9 is compiled using Visual Studio 2008, and the performance and stability of the version that does not use VC9 under Apache have been improved. Use VC9 This version of PHP requires Microsoft 2008 C++ Runtime to be installed, so it is recommended not to use the VC9 version under Apache.

The other is our directory structure. In order to facilitate management, we put them together. First create the WAMP folder, and then create the MySQL, PHP, and Apache folders in it. Later we will put MySQL, PHP, Apache is installed in the corresponding folder. The directory structure is as follows:

2. Install the software (there are many installation tutorials on the Internet, so I won’t go into them here)

3. Apache and PHP configuration

Find the php.ini-recommended file in the folder WAMPPHP, rename it to php.ini, and then open it with an editor

1. First find

<span 1</span> ; Directory in which the loadable extensions (modules) reside.
<span 2</span> 
<span 3</span> extension_dir = "./"

was changed to:

; Directory in which the loadable extensions (modules) reside.<span 

extension_dir </span>= "D:/Program Files/WAMP/PHP/ext"

(I installed it in the Program Files directory of the D drive, you can change it according to the actual situation) means specifying the specific directory of the PHP extension package in order to call the corresponding DLL file

2. Enable the corresponding extension library function

Find the following lines and remove the ";" in front

extension=php_curl.<span dll

extension</span>=php_gd2.<span dll

extension</span>=php_mbstring.<span dll

extension</span>=php_mysql.<span dll

extension</span>=php_mysqli.<span dll

extension</span>=php_pdo_mysql.<span dll

extension</span>=php_xmlrpc.dll

3. Configure PHP’s Session function

When using the session function, you must configure the directory where the session file is saved on the server. Otherwise, the session cannot be used. You need to create a readable and writable directory folder. Then we create the phpSessionTmp directory in the WAMP folder, and then in php. ini file found

;session.save_path = "/tmp"

was changed to:

session.save_path = " D:/Program Files /WAMP/phpSessionTmp"

4. Configure PHP’s file upload function

When using the PHP file upload function, you must specify a temporary folder to complete the file upload function. Next, create a phpFileUploadTmp folder in the WAMP folder, and then find

in the php.ini file
;upload_tmp_dir =

was changed to:

upload_tmp_dir = "D: /Program Files /WAMP/phpFileUploadTmp"

5. Modify date.timezone, which defaults to US time. If not modified, an error will be reported

Found:

;<span date</span>.timezone =

was changed to:

;<span date</span>.timezone = Asia/Shanghai

Okay, the configuration of php.ini is complete, but this is not enough. We also need Apache to support PHP, so we must complete the corresponding PHP configuration in the Apache configuration file httpd.conf.

Find the httpd.conf file in the D:Program FilesWampApacheconf folder and open it

6. Add under #LoadModule vhost_alias_module modules/mod_vhost_alias.so:

LoadModule php5_module "D:/Program Files/WAMP/PHP/php5apache2_2.dll"<span 

PHPIniDir </span>"D:/Program Files/WAMP/PHP"<span 

AddType application</span>/x-httpd-php .php .html .htm

7. Since the directory where the Apache server executes the web main program is Apache2.2/htdocs by default, for convenience, we have created a www folder in WAMP to replace htdocs, so we need to modify the corresponding Apache configuration at this time. Change the web program directory to the www directory

Found:

DocumentRoot "D:/Program Files/WAMP/Apache/htdocs"

was changed to:

DocumentRoot " D:/Program Files/WAMP/wwwroot"

Found:

<Directory "D:/WAMP/Apache/htdocs">

was changed to

<Directory "D:/Program Files/WAMP/wwwroot">

8. The order in which the index file is last modified. Since the PHP function is configured, of course index.php needs to be executed first

Found:

DirectoryIndex index.html

was changed to:

DirectoryIndex index.php <span default</span>.php index.html index.htm <span default</span>.html <span default</span>.htm

At this point, the PHP environment configuration is basically completed, let’s give it a try

Restart Apache, place a phpinfo.php file in WAMP/wwwroot, and write the code in phpinfo.php:

<?<span php

  </span><span phpinfo</span><span ();

</span>?>

Then enter http://localhost/phpinfo.php in the browser address bar. At this time, the web page displays the basic configuration information of PHP, and our PHP environment is completed.

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/626645.htmlTechArticle一. 下载安装包: Apache2.2:http://mirrors.cnnic.cn/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi PHP5.4:http://windows.php.net/downloads/relea...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn