Home > Backend Development > PHP Tutorial > Two ways to run php on apache in windows

Two ways to run php on apache in windows

WBOY
Release: 2016-07-25 09:03:15
Original
1194 people have browsed it
  1. # Set the alias of the PHP directory

  2. ScriptAlias ​​/php/ "D:/usr/local/php"

  3. # Associate a specific extension to resolve PHP file

  4. AddType application/x-httpd-php .php

  5. # Set up a program that uses PHP5 to execute CGI scripts

  6. Action application/x-httpd-php "/php/php-cgi.exe"

Copy the code

2. Run PHP in Apache mode For PHP5, you need to configure the following:

  1. # Load PHP5 module

  2. LoadModule php5_module "D:/usr/local/php/php5apache2.dll"
  3. AddType application/x-httpd-php .php

  4. < ;p> # Configure the path of the php.ini file
  5. PHPIniDir "D:/usr/loca/php"

Copy the code

After the settings are completed, you need to start the Apache server and then conduct a test , to verify that PHP is working properly. To do this, you need to create a new "phpinfo.php" test program in the Web virtual directory. By default, the virtual directory is located in the htdocs folder under the Apache directory, such as "D:/usr/local/apache2/htdocs". Below is the content of the phpinfo.php file:

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

Enter in the browser: http://localhost/phpinfo.php, if you can see php version 5 interface, it means the installation is successful.



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