凌的博客

您现在的位置是: 首页 > 学无止境 > PHP > 

PHP

配置apache+php+zendguardloader

2015-06-06 PHP 790
配置apache+zendguardlaoder  低版本的5.3的无法使用加载dll的方式 这里使用 loadmodule的方式 1、下载mod_fcgid, http://httpd.apache.org/download.cgi 我这里下载的是2.3.6 2、解压之,

配置apache+zendguardlaoder  低版本的5.3的无法使用加载dll的方式

这里使用 loadmodule的方式

1、下载mod_fcgid, http://httpd.apache.org/download.cgi 我这里下载的是2.3.6

2、解压之,得到mod_fcgid.so,将它移至apache安装目录下的modules下,我这里是(C:\Program Files\Apache Software Foundation\Apache2.2\modules)

3、打开httpd.conf  添加如下:


#load 
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script .fcgi .php
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 1000
# Maximum number of PHP processes
FcgidMaxProcesses 15
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout  120
FcgidIdleTimeout  120
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
 
 
# Where to look for the php.ini file?
FcgidInitialEnv PHPRC "D:/apserver/php-5.3.25"
#Path to php-cgi
FcgidWrapper "D:/apserver/php-5.3.25/php-cgi.exe" .php


[Zend.loader] 
zend_loader.enable=1
zend_loader.disable_licensing=1
zend_loader.obfuscation_level_support=4
zend_loader.license_path=
zend_extension="D:\apserver\php-5.3.25\ext\ZendLoader.dll"


4、配置好fcgid模块之后,还需要做一个处理:   找到配置运行目录属性的地方,在option中添加一个属性ExecCGI


5、重启apache,运行localhost,就能看到刚刚配置的信息(我在php运行目录下设置了一个index.php中输出phpinfo【需要apache认的index.php这样的默认执行文件,需要同样配置DirectoryIndex】):



配置多版本

为了解决使用方便的问题,我打算采用虚拟机的配置来分别配置,每个虚拟机一个php版本,这样我使用的时候只要访问需要的php版本的虚拟机即可,而不需要设置配置文件。同时也为了减少代码拷贝上的问题,我将所有的虚拟机都配置在同一个目录下,每个虚拟机都配置一个监听端口,这样也解决了代码在不同目录的共享问题。

1和2如上面一致,就不说了。不一样从第三步开始

3、在httpd.conf中,我加载fastcgi并且配置项只有如下:


#load 
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script .fcgi .php
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 1000
# Maximum number of PHP processes
FcgidMaxProcesses 15
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIOTimeout  120
FcgidIdleTimeout  120
# Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php



同时查找该文件中的:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

将Include ....一行前面的#号去掉,同时,打开conf/extra/httpd-vhosts.conf文件进行虚拟主机配置(当然如果不使用该文件,也可以将虚拟主机的配置直接放置在httpd.conf文件的末尾)

4、虚拟主机的配置:

打开的文件中有一份默认的配置,我们更改如下:

Listen localhost:80
NameVirtualHost *:80

#load php.ini
FcgidInitialEnv PHPRC "C:/php/php-5.3.8/"
FcgidWrapper "C:/php/php-5.3.8/php-cgi.exe" .php
ServerAdmin webmaster@dummy-host.hz.ali.com
DocumentRoot "C:/www"
ServerName localhost
ServerAlias www.dummy-host.hz.ali.com
ErrorLog "logs/localhost"
CustomLog "logs/localhost.log" common

对了,就是将FcgidInitialEnv  和FcgidWrapper两个的配置转移到虚拟机中,这样每个虚拟机都有自己的配置,我这里默认是执行5.3.8版本,所以给他的端口号是80,如下,我还配置了5.2.17和5.2.4两个版本分别给的端口号是217和24:

Listen localhost:217
NameVirtualHost *:217

    #load php.ini
    FcgidInitialEnv PHPRC "C:/php/php-5.2.17"
    FcgidWrapper "C:/php/php-5.2.17/php-cgi.exe" .php
    ServerAdmin webmaster@dummy-host.hz.ali.com
    DocumentRoot "C:/www"
    ServerName localhost
    ServerAlias www.dummy-host.hz.ali.com
    ErrorLog "logs/217"
    CustomLog "logs/217.log" commonListen localhost:24
NameVirtualHost *:24

    #load php.ini
    FcgidInitialEnv PHPRC "C:/php/php-5.2.4"
    FcgidWrapper "C:/php/php-5.2.4/php-cgi.exe" .php
    ServerAdmin webmaster@dummy-host.hz.ali.com
    DocumentRoot "C:/www"
    ServerName localhost
    ServerAlias www.dummy-host.hz.ali.com
    ErrorLog "logs/24"
    CustomLog "logs/24.log" common


文章评论

0条评论