Installing PHP5 as a CGI method is a way to run PHP5 and do not have to modify the configuration of PHP4. Another way to configure the PHP4 configured to obtain a full PHP5 function is to monitor the request from the client on another port of Apache. For example, the 8080 port of Apache. This allows the PHP4 script on the 80-port, and the object-oriented script of PHP5 is processed on the 8080 port. Remember that the CGI installation method has some restrictions compared to module installation. It does not directly use the advantages of Apache HTTP basic identity authentication. You can't use the Apache_note () function to read and set the value in the Notes table.
. (Apache_Note () is a function for Apache, which can get or set the value in the Notes table. If there is only one parameter call, return the current value of the record Note_Name. If you use two parameter calls, the value of Note_name will be recorded. For Note_Value and return the previous value of the record note_name.) Quote Self | PHP Manual -> Function Reference -> Apache Library -> Apache_notephp Manual Download address http://cn2.php.net/distributions/manual/php_manual_zh.chm as CGI configures PHP5
Delete --with-apxs. Join theNable-Force-CGI-Redirect option. Join --prefix = / usr / local / php5 option. Customize PHP.ini.
PHP5 To force the directory to which it know is mounted by -prefix = / usr / local / php5 option and PHP4 is separated. And you cannot cover the files and configuration data of PHP4. Add the following instructions in the apache profile http.conf, but Apache knows the location of the PHP5 CGI program. That is, a directory mapping of Apache to PHP5 CGI. Scriptalias / PHP5 / USR / LOCAL / PHP5 / BIN OPTIONS EXECCGI FOLLOWSYMLINKS ALLOWOVERRIDE NONE DIRECTORY> Scriptalias maps the URL path of the web server to the local file system, since us here It is installed as a CGI program. Then apache must know the CGI program location. For example, Scriptalias / Book / PHP5 / USR / local / PHP / PHP5 / BIN, the server domain is www.apache.org then when the client's request arrives at the Apache server, it will go / usr / local / php / php5 / BIN This local file system performs the program stored there. After the mapping is established, the next step is to execute the file to the CGI of the specific file type, which can be configured by two ways, one is to add the following instructions in the http.conf profile AddHandler PHP-CGI-Script .php Action PHP-CGI-Script / PHP5 / PHP Options Execci Directory> AddHandler Instruction Represents any file ending with .php by the APACH server as PHP-CGI -script script and transferred to PHP CGI to execute. Multiple file types can be set in one line. For example, addHP .phpx .phtml .pxml The file ended in PHP, PHPX, PHTML, and PXML is considered to be PHP scripts to hand over to PHP parser parsing and execution. The second line Action instruction tells the Apeche PHP-CGI-Script script to be handled by files in / php5 / php directory, because you have previously made URL / PHP5 to local file system / usr / local / php5 / bin / mapping So this command is actually mapped to the / usr / local / php5 / bin / php directory, which is actually the location of the PHP5 CGI installation. Finally, since the PHP5 is run as a CGI, you must open the execcgi parameter (Open the execution permission of the script), allowing the Apache to execute the script in this directory. Another method is to create a .htaccess access control file in the script directory and join the three-line instructions between Directory> above. Apache will automatically check the files when there is a client request to reach this directory, see if there is appropriate permission to make the PHP script can be executed. Use the .htaccess configuration file You can make the configured modification immediately take effect immediately without restarting the APACH server. However, it requires you to open the AllowOverride option (set to options or all). This will reduce the efficiency of the APCHE, because Apache is checked and parsing this file at each request to reach this directory. When concurrent requests are increased, the efficiency of the Apache server will decline seriously. So this approach is not recommended when you have access to a high website.