Apache
Apache наиболее популярный, многофункциональный и стабильный веб сервер.
httpd.conf основной файл конфигурации
Содержание |
PHP4 и PHP5 вместе
Способ 1
Запускаем второй Apache с другой версией PHP, слушающий на порту 8080:
Listen 127.0.0.1:8080
В конфиге главного апача пишем:
<VirtualHost *> ServerName php4.ourdomain.ru DocumentRoot /dev/null ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
способ 2, на англ.
http://www.hurring.com/scott/howto/php4_and_php5/
1. Prerequisites First, think about which extentions you want to use with PHP and install the appropriate dev / client / library packages for debian.
In my case, becuase i wanted MySQL support in PHP5, i needed to install the MySQL development libraries along with bison and flex and libxml2 (becuase configure complained about those as well). apt-get install libmysqlclient-dev bison flex libxml2-dev 2. Download and install PHP5 Fetch a fresh copy of the PHP5 source code from the PHP site.
Unzip, configure and install it:
./configure --prefix=/usr/local --with-mysql=/usr/include/mysql/ && make &&
sudo make install
When it's done installing, test that it works on the command line.
3. Configure apache Symlink the PHP5 binary into the cgi-bin directory. You can just copy the 'php' binary over to the directory too, but this makes upgrading more of a pain, because you'll have to remember to copy the binary everytime.
On a linux system, the command would look like:
ln -s /usr/local/bin/php /usr/lib/cgi-bin/php5
On an OS X system, might look like:
ln -s /usr/local/php5/bin/php /Library/WebServer/CGI-Executables/php5
Then, anable the mod_actions module so that you can use the "Action" keyword in the "Directory" stanza below. On debian, this can be done very easily with
apache-modconf apache enable mod_actions
Now you should be able to simply use <Directory> entries to tell apache which directories to parse with PHP5. Directories that you don't explicitly tell apache to use php5, it will default back to mod_php4:
<Directory /your/php5/files/>
AddHandler php-script .php
Action php-script /cgi-bin/php5
</Directory>
Способ 3, тоже на англ.
http://www.digitalsandwich.com/archives/14-PHP5-and-PHP4-Running-on-SAME-apache-server.html
PHP5 and PHP4 Running on SAME apache server First off, it has been brought to my attention that this DOES NOT work for Linux servers. It has only been successfully tested on FreeBSD servers. In particular a FreeBSD 4.10_STABLE server. I am currently working on a similar solution for Apache on Linux. (Redhat9 in particular)
I think I have finally found a way to do what I need to do with parrallel versions. My situation is my company's hosting farm doesn't give us the ability to run two seperate apache servers on one box and I don't particularly want to run a CGI version due to the loss of $_SERVER variables and other security issues. So I endeavored on a trick to get php5 to use a different mime-type. Well, it's not a trick, but it's also probably not obvious to most people how to accomplish this so read on.
The changes I made where to get it to work for Apache 1.3.*. I am not sure if the same changes (different directory) can be applied for it to work with Apache 2.In any case, the file I edited was /sapi/apache/mod_php5.c. Around line 913 change the following values:
application/x-httpd-php -> application/x-httpd-php5 application/x-httpd-php-source -> application/x-httpd-php5-source
The changes will be your new mimetypes for use with the AddType directive in PHP. (eg: AddType application/x-httpd-php5 .php)
Then towards line 924 change these values:
php_value -> php5_value php_flag -> php5_flag php_admin_value -> php5_admin_value php_admin_flag -> php5_admin_flag
The changes here should be used if you want to set php.ini options via your httpd.conf or .htaccess files. (eg: php5_value include_dir "/usr/local/lib/php")
Now, I haven't found any warning that this won't work, but I also haven't found any references to other people doing this. So I would proceed with caution. I am the senior developer for a fairly large web development firm and we currently have versions 4 and 5 co-existing on one of our productions servers. Over the course of almost a month we haven't had any problems. But that doesn't mean that problems don't exist. I am hoping to start a discussion about any possible drawbacks of this method. Let me know your thoughts and whether or not this works for you.
mod_status
LoadModule status_module modules/mod_status.so ExtendedStatus On <Location /my-apache-status> SetHandler server-status </Location>

