Home > Backend Development > PHP Tutorial > How to build a php server environment

How to build a php server environment

WBOY
Release: 2016-07-25 08:54:09
Original
1373 people have browsed it
  1. loadmodule php5_module d:php5php5apache2_2.dll
Copy code

2. You can modify the root directory of the main document of the server by modifying the documentroot parameter. The original root directory is apache2.2httdocs. like: documentroot "d:/phpserver" After modifying the documentroot parameter, you need to modify one more thing: turn up:

  1. Modify to:
  2. apache2.2httdocs
Copy the code

3. Add the extension of the apache server: Find the following piece of code:

  1. allowoverride none
  2. options none
  3. order allow,deny
  4. allow from all
Copy code

Add after this code: addtype application/x-httpd-php .php The extensions that php can recognize include .php3, .php3, php, phtml, etc. Only the standard extension .php is recommended here.

4. Modify the default display page. The default display page of apache is index.html. Find directoryindex and modify the parameters as follows:

  1. directoryindex index.php
Copy the code

5. Modify the apaceh port, the default is 80. Find listen and modify the parameters. If you want to modify the port to 82: listen 82 At this point, the apaceh server has been configured. All you need to do is restart the apaceh server. However, it is still not possible to display php web files.

You also need to install php 1. Unzip the php5 installation file to the corresponding directory. Such as d:hph5. 2. Copy all dll files in this directory (php5 directory) to the windowssystem32 directory on the system disk. 3. Copy the php.ini-dist file in the directory to the windows directory of the system disk and rename it to php.ini. 4. Open php.ini and find the line "extension_dir="./"" and change it to "extension_dir="d:/hph5/ext"". 5. Find the line ";extension=php_mysal.dll" and remove the semicolon ";" in front of it. In this way, php can support the mysql database. 6. At this point, php is configured and restart the apache server.

Test: Write a php script file, named phpinfo.php, and save it in the virtual root directory d:/phpserver of the apache server. Code of php script file:

  1. phpinfo();
  2. ?>
Copy the code

to test, enter: http://localhost/hphinfo.php in the address bar of the browser, if it displays PHP version related information indicates that the PHP server is successfully built. php and mysql server configuration instructions php implementation code for detecting server status How to get server time in php An alternative way to obtain server-side information using php php code to get server information



Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template