Home  >  Article  >  Backend Development  >  Can Apache run php directly?

Can Apache run php directly?

王林
王林Original
2019-10-16 11:46:403058browse

Can Apache run php directly?

1、将其中的mod_fcgid.so放到Apache根目录下的modules文件夹中;

2、编辑httpd.conf文件,该文件位于Apache根目录下的conf文件夹中。在文件的末尾续上:

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>


   FcgidMaxProcesses 300
   FcgidMaxProcessesPerClass 300

   FcgidOutputBufferSize 65536
   FcgidConnectTimeout 10
   FcgidProcessLifeTime 0
   FcgidMaxRequestsPerProcess 0
   FcgidMinProcessesPerClass 0
   FcgidFixPathinfo 0
   FcgidProcessLifeTime 0
   FcgidZombieScanInterval 20
   FcgidMaxRequestLen 536870912
   FcgidIOTimeout 120
   FcgidTimeScore 3

   FcgidPassHeader Authorization

   FcgidInitialEnv PHPRC "C:\\php7" # 改成你的PHP根目录,这条注释一定要删除,不然会出错
   FcgidInitialEnv PATH "C:\\php7;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;" # 改成你的PHP根目录,这条注释一定要删除,不然会出错
   FcgidInitialEnv SystemRoot "C:\\Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv windir "C:\\WINDOWS"
   <Files ~ "\.php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "C:/php7/php-cgi.exe" .php # 改成你的PHP根目录,这条注释一定要删除,不然会出错
   </Files>
</IfModule>

然后保存,开启Apache服务。

3、在上面的httpd.conf文件中,还能更改Apache服务的端口,只要在如下位置,改成你想要的设置的端口即可

Can Apache run php directly?

在PHP文件夹中的php.ini中,查找并激活下面的一行,后保存:

cgi.fix_pathinfo = 1

推荐教程:PHP视频教程

The above is the detailed content of Can Apache run php directly?. For more information, please follow other related articles on the PHP Chinese website!

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