PHP Super equipped module

Source: Internet
Author: User
Tags apache php sapi
PHP Super Config module

Calling PHP in Apache is an enduring topic, the current PHP version of PHP4 and PHP5, and in Apache call PHP there are modules (module) mode and CGI mode, Apache also has two versions of Apache1 and Apache2.
There are eight modes of calling PHP in Apache:
Module mode of 1,PHP4 in Apache1
2,PHP4 in Apache1 's CGI mode
Module mode of 3,PHP5 in Apache1
4,PHP5 in Apache1 's CGI mode
Module mode of 5,PHP4 in Apache2
6,PHP4 in Apache2 's CGI mode
Module mode of 7,PHP5 in Apache2
8,PHP5 in Apache2 's CGI mode
Have you ever thought about the configuration of these eight invocation patterns in a configuration file?
Maybe you did, but not completely successful, because these eight modes are not compatible with each other oh.
However, the flexibility to use an Apache command, the eight models to tame the docile, to accommodate together, it is easy.

?

--------------------------------------------


Calling PHP in Apache is an enduring topic, the current PHP version of PHP4 and PHP5, and in Apache call PHP there are modules (module) mode and CGI mode, Apache also has two versions of Apache1 and Apache2.
There are eight modes of calling PHP in Apache:
Module mode of 1,PHP4 in Apache1
2,PHP4 in Apache1 's CGI mode
Module mode of 3,PHP5 in Apache1
4,PHP5 in Apache1 's CGI mode
Module mode of 5,PHP4 in Apache2
6,PHP4 in Apache2 's CGI mode
Module mode of 7,PHP5 in Apache2
8,PHP5 in Apache2 's CGI mode
Have you ever thought about the configuration of these eight invocation patterns in a configuration file?
Maybe you did, but not completely successful, because these eight modes are not compatible with each other oh.
However, the flexibility to use an Apache command, the eight models to tame the docile, to accommodate together, it is easy.
Which instruction? It turns out to be:
In Http://w.yi.org/ftp/FAPM/apache/Apache2/zh/mod/core.html#ifdefine there is a complete introduction to this instruction.
Instructions
Code:

Description: An encapsulation directive that only occurs when a successful test is performed at startup
Syntax: ...
Context: Server configuration, virtual host, directory,. htaccess
Overwrite: All
Status: Core
Module: Core

... The configuration section is used to identify the directive for additional application conditions. the instructions in the configuration section are processed only when the test results are true. If the test fails. The instructions in this configuration segment will be ignored.

The tests in the configuration section can be one of the following two forms:

Name of parameter
! Parameter name
In the first case, the instruction between the start and end tags is processed only if the parameter with the parameter name is already defined. The second case is diametrically opposed. The processing of instructions is performed only if the parameter name is not defined.

The parameter name variable is specified in the form of the-d parameter of the httpd command line when the service starts up.

Configuration segments can be nested, allowing for simple multi-parameter testing. For example:

$ httpd-dreverseproxy ...

# httpd.conf

LoadModule Rewrite_module modules/mod_rewrite.so
LoadModule Proxy_module modules/libproxy.so

?

?

?

##################################################################
# PHP Super Config module--php4,php5,module,cgi let you play--Apply to Apache #
##################################################################
# Configuration version Universal version v1.01 #
# config write Chochu/honestqiao #
# Date of compilation May 29, 2004 #
# Contact Information qq:5601680 Msn:[email protected] #
##################################################################
# Home Address: http://w.yi.org/#
# Forum Address: Http://bbs.chinaunix.net/forum/viewforum.php?f=13 #
##################################################################
##################################################################
# Copyright Notice #
# This PHP super Configuration module is written by Chochu (Honestqiao), you can use and propagate freely #
#本PHP超级配置模块, however, keep the declarations section above the configuration content (because this statement does not #
#会对你的实际配置造成任何影响), and must not in any way indicate that you wrote this #
#PHP超级配置模块. #
# Thank you for your use, welcome to criticize suggestions and report errors. #
##################################################################
SETENV Php_control_status Not_php_control_status

SETENV Php_control_status Apache

SETENV Php_control_status APACHE_PHP4

SETENV Php_control_status Apache_php4_mod
LoadModule Php4_module/usr/local/php-4.3.6/sapi/php4apache.dll #请修改为实际的路径
#AddModule mod_php4.c
AddType application/x-httpd-php. php
AddType application/x-httpd-php. php3
AddType application/x-httpd-php. PhP4
#PHPINIDir/usr/local/etc/php/php4.ini
#请将php. INI to the Apache installation directory
AddType Application/x-httpd-php-source. Phps
Alias "/server-php" "/USR/LOCAL/ETC/PHP/PHPINFO.PHP4" #请修改为实际的路径
Alias "/phpmyadmin" "/usr/local/phpmyadmin-2.6.0-alpha2/" #请修改为实际的路径


SetEnv php_control_status apache_php4_not_mod

S Etenv php_control_status apache_php4_cgi
scriptalias/php/"/usr/local/php-4.3.6/" #请修改为实际的路径
Action appli cation/x-httpd-php "/php/php.exe"
#请将php. ini to the installation directory for Apache
AddType application/x-httpd-php. PHP
Ad DType application/x-httpd-php. PhP3
AddType application/x-httpd-php. PHP4
AddType application/x-httpd-php- source. Phps
Alias "/server-php" "/usr/local/etc/php/phpinfo.php4" #请修改为实际的路径
Alias "/phpmyadmin" "/usr/lo cal/phpmyadmin-2.6.0-alpha2/"#请修改为实际的路径



SetEnv php_control_status apache_not_php4

Seten V php_control_status apache_php5

SetEnv Php_control_status Apache_php5_mod
LoadModule php5_module/usr/local/php-5.0.0rc2/php5apache.dll #请修改为实际的路径
#AddModule mod_php5.c
AddT Ype application/x-httpd-php. PHP
AddType application/x-httpd-php. PhP3
AddType application/x-httpd-php. PHP4
AddType application/x-httpd-php. PHP5
AddType application/x-httpd-php-source. Phps
#PHPINI Dir/usr/local/etc/php/php5.ini
#请将php. ini to the installation directory for Apache
Alias "/server-php" "/usr/local/etc/php/phpinfo . php5 "#请修改为实际的路径
Alias"/phpmyadmin ""/usr/local/phpmyadmin-2.6.0-alpha2/"#请修改为实际的路径


SetEnv php_control_status apache_php5_not_mod

S Etenv php_control_status apache_php5_cgi
scriptalias/php/"/usr/local/php-5.0.0rc2/" #请修改为实际的路径
Action AP plication/x-httpd-php "/php/php-cgi.exe"
#请将php. ini to the installation directory for Apache
AddType application/x-httpd-php. php
AddType application/x-httpd-php. PhP3
AddType application/x-httpd-php. PHP4
AddType Application/x-htt pd-php. PHP5
AddType application/x-httpd-php-source. Phps
Alias "/server-php" "/usr/local/etc/php/phpinfo. PHP5 "#请修改为实际的路径
Alias"/phpmyadmin ""/usr/local/phpmyadmin-2.6.0-alpha2/"#请修改为实际的路径




SetEnv php_control_status not_apache

setenv php_control_status Apache2

SetEnv Php_control_status APACHE2_PHP4

SetEnv php_control_status apache2_php4_mod
LoadModule php4_module/usr/ Local/php-4.3.6/sapi/php4apache2.dll #请修改为实际的路径
#AddModule mod_php4.c
AddType application/x-httpd-php . PHP
AddType application/x-httpd-php. PhP3
AddType application/x-httpd-php. PHP4
Phpinidir/ Usr/local/etc/php/php4.ini #请修改为实际的路径
AddType application/x-httpd-php-source. Phps
Alias "/server-php" "/usr/local/etc/php/phpinfo.php4" #请修改为实际的路径
Alias "/phpmyadmin" "/usr/local/phpmyadmin-2.6.0-alpha2/" #请修改为实际的 Path


SetEnv php_control_status apache2_php4_not_mod

SETENV php_control_status apache2_php4_cgi
scriptalias/php/"/usr/local/php-4.3.6/" #请修改为实际的路径
Action App lication/x-httpd-php "/php/php.exe"
#请将php. ini to the installation directory for Apache
AddType application/x-httpd-php. PHP
AddType application/x-httpd-php. PhP3
AddType application/x-httpd-php. PHP4
AddType application/x-httpd-ph P-source. Phps
Alias "/server-php" "/usr/local/etc/php/phpinfo.php4" #请修改为实际的路径
Alias "/phpmyadmin"/usr/ local/phpmyadmin-2.6.0-alpha2/"#请修改为实际的路径



SetEnv php_control_status apache2_not_php4

Sete NV php_control_status apache2_php5

SetEnv Php_control_status Apache2_php5_mod
LoadModule php5_module/usr/local/php-5.0.0rc2/php5apache2.dll #请修改为实际的路径
#AddModule mod_php5.c
AddType application/x-httpd-php. PHP
AddType application/x-httpd-php. PhP3
AddType application/x-httpd-p HP. PHP4
AddType application/x-httpd-php. PHP5
AddType application/x-httpd-php-source. Phps
PHP Inidir/usr/local/etc/php/php5.ini #请修改为实际的路径
Alias "/server-php" "/USR/LOCAL/ETC/PHP/PHPINFO.PHP5" #请修改为实际的路径
Alias "/phpmyadmin" "/usr/local/phpmyadmin-2.6.0-alpha2/" #请修改为实际的路径


SETENV Php_control_status Apache2_php5_not_mod

SETENV Php_control_status apache2_php5_cgi
scriptalias/php/"/usr/local/php-5.0.0rc2/" #请修改为实际的路径
Action application/x-httpd-php "/php/php-cgi.exe"
#请将php. INI to the Apache installation directory
AddType application/x-httpd-php. php
AddType application/x-httpd-php. php3
AddType application/x-httpd-php. PhP4
AddType application/x-httpd-php. php5
AddType Application/x-httpd-php-source. Phps
Alias "/server-php" "/USR/LOCAL/ETC/PHP/PHPINFO.PHP5" #请修改为实际的路径
Alias "/phpmyadmin" "/usr/local/phpmyadmin-2.6.0-alpha2/" #请修改为实际的路径





?

?

?

?

?

#使用方法:
# Device Command:
# Connection Configuration:
# Save the above PHP Super Configuration module as a file named Php.conf, and then use the include "/path/to/php.conf" in the Apache configuration file to refer to the PHP Super configuration module;
# Modify the section of the PHP Super Configuration module that prompts you to modify it, usually by modifying the actual path where your files are located.
#
# Start Command:
# apachecontrol-k start-d apache=apacheversion php=phpversion type=runtype
# Assuming that the Apache file name is httpd, execute the following command:
# httpd-k start-d apache=apacheversion php=phpversion type=runtype
# Apacheversion: Indicates that the Apache version apache,apache--represents Apache1; apache2--means Apache2;
# Phpversion: Represents the version of PHP, php4--that php4;php5--represents PHP5;
# RunType: Indicates the run mode, mod--means to run as module, cgi--means to run in CGI mode
#
# Channel Information:
# PHP Super Config module status: Represents the state of the PHP super configuration in the environment variables, which can be viewed via a CGI probe or phpinfo ().
# Description: Status name: Php_control_status
# Status: Not_php_control_status: Indicates not in PHP Super Config module
# Apache: Indicates access to the Apache1 configuration area
# Apache_php4: Represents the PHP4 configuration area into the Apache1
# Apache_php4_mod: module (module) mode configuration area for PHP4 that enters Apache1
# Apache_php4_not_mod: Represents the Non-module (module) mode configuration area of the PHP4 that enters the Apache1
# apache_php4_cgi: The CGI mode configuration area that represents the PHP4 into the Apache1
# APACHE_NOT_PHP4: Represents a non-PHP4 configuration area that enters the Apache1
# APACHE_PHP5: Represents the PHP5 configuration area into the Apache1
# Apache_php5_mod: module (module) mode configuration area for PHP5 that enters Apache1
# Apache_php5_not_mod: Represents the Non-module (module) mode configuration area of the PHP5 that enters the Apache1
# apache_php5_cgi: The CGI mode configuration area that represents the PHP5 into the Apache1
#
# Not_apache: Indicates access to non-Apache1 configuration area
# Apache2_php4: Represents the PHP4 configuration area into the Apache2
# Apache2_php4_mod: module (module) mode configuration area for PHP4 that enters Apache2
# Apache2_php4_not_mod: Represents the Non-module (module) mode configuration area of the PHP4 that enters the Apache2
# apache2_php4_cgi: The CGI mode configuration area that represents the PHP4 into the Apache2
# APACHE2_NOT_PHP4: Represents a non-PHP4 configuration area that enters the Apache2
# APACHE2_PHP5: Represents the PHP5 configuration area into the Apache2
# Apache2_php5_mod: module (module) mode configuration area for PHP5 that enters Apache2
# Apache2_php5_not_mod: Represents the Non-module (module) mode configuration area of the PHP5 that enters the Apache2
# apache2_php5_cgi: The CGI mode configuration area that represents the PHP5 into the Apache2
#

?

?


#测试工程:
# For example, in a Window2000 environment, execute the following device command:
# cd/path/to/apache/
# apache-k start-d Apache=apache php=php4 type=mod
# After executing the device command, the value of the php_control_status becomes Apache_php4_mod, which indicates that the PHP4 module mode is in Apache1;
#
# cd/path/to/apache/
# apache-k start-d Apache=apache php=php5 type=cgi
# After executing the device command, the value of the php_control_status becomes apache_php5_cgi, which indicates that the PHP5 in Apache1 is in the CGI mode;
#
# cd/path/to/apache2/bin/
# apache-k start-d apache=apache2 php=php4 type=cgi
# After executing the device command, the value of the php_control_status becomes apache2_php4_cgi, which indicates that the PHP4 in Apache2 is in the CGI mode;
#
# cd/path/to/apache2/bin/
# apache-k start-d apache=apache2 php=php5 type=mod
# After executing the device command, the value of the php_control_status becomes Apache2_php5_mod, which indicates that the PHP5 module mode is in Apache2;
#
#
#常见问题:
# 1. Prompt error on startup and error in the relevant line of the PHP Super configuration module, generally indicates incorrect setting path
# 2. Successful startup but without PHP, you can view the status value of the Php_control_status to determine where the problem is and the parameters given when the device is executed may be incorrect
# 3. Start Right, you can also call PHP, then you say what the problem ah, to congratulate you can use normal AH.
# 4. If the problem is not resolved, please contact the developer of this PHP Super configuration module.
#
#
#附加说明:
# This PHP super configuration module, just give a general PHP under Apache Call control mode, using this PHP super Configuration module related lines, you need to have a certain understanding of Apache and PHP.
# If you need a more specific configuration, please contact me and I will make a custom version of the PHP Super Configuration module that fits your actual operating environment according to your actual operating environment.
#

?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.