Home > Article > Backend Development > How to build a php server environment
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:
3. Add the extension of the apache server: Find the following piece of 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:
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:
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 |