Author |
|
gcleaves
Joined: 01 Dec 2009 Posts: 14
|
Posted: Tue 01 Dec '09 20:57 Post subject: Production Server Recommendation |
|
|
I'd like to hear what people recommend for a production environment for our small intranet because I can't get straight what is most stable and fast. I currently use Apache on Windows 2003 and PHP. I don't want to change any of that really. I'm looking for recommendations in the area of versions, VC6/9, thread safe/NTS and an optimizer.
So assuming Windows Server 2003 what combination of:
Apache server (hopefully 2.2) (VC?, TH or NTS)
PHP module or FastCGI
PHP version
Opcode optimizer I've ready enough to confuse myself about MPM on Apache but can't seem to actually tell it to use the prefork module or not. Is that just for Linux?
I recently installed Xcache 1.2.2 onto my existing PHP 5.2.4 module/Apache 2.2.4/ZF 1.5 environment and Apache stopped responding every 2 or 3 hours. Once removing Xcache things were stable again, although the server does crash every couple of months (I think mssql related).
Gracias in advance,
Geoff |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
Posted: Wed 02 Dec '09 1:19 Post subject: |
|
|
You should use the latest stable apache which is current 2.2.14. I recommend a VS9 build from apache like apachelounge offers.
More stable is php over fcgid with a PHP 5.3.1 VS9 Non thread safe. Fcgid speparates PHP and apache. So even PHP or one of its modules cashes your apache will still run.
Also if needed by the PHP script you use you can combined PHP as module and over fcgid.
On Windows there is only WinntMPM which works very good.
For a intranet I don't know if there is a PHP cache needed. Even if your pages are dynamic, is there a needed for realtime? Else you could use the apache cache modules.
Better than any optimizing of any PHP script and caching is fast hardware and much of ram. On my experience modern hardware is also cheaper than reviewing scripts. |
|
Back to top |
|
gcleaves
Joined: 01 Dec 2009 Posts: 14
|
Posted: Wed 02 Dec '09 13:23 Post subject: |
|
|
Quote: | Also if needed by the PHP script you use you can combined PHP as module and over fcgid. |
Can you explain a little more about this statement? All my scripts currently run using php5apache2_2.dll. Why would a script need the Apache module versus fcgid? Are the Apache environment variables available in fcgid? |
|
Back to top |
|
gcleaves
Joined: 01 Dec 2009 Posts: 14
|
Posted: Wed 02 Dec '09 14:01 Post subject: PHP variable only available in module |
|
|
I've read the following in the variable section of the PHP manual:
Code: | 'PHP_AUTH_USER'
When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. |
Some of my scripts DO use this variable. Do you have any recommendation for this situation if I want to use fcgid? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7298 Location: Germany, Next to Hamburg
|
Posted: Wed 02 Dec '09 15:58 Post subject: |
|
|
You can mix mod_php and phpover fcgid.
You can set directories to use fcgid.
example
Code: |
#enable php as module everywhere
PHPIniDir "C:/server2/php"
LoadModule php5_module "C:/server2/php/php5apache2_2.dll"
AddType application/x-httpd-php .php .php5
AddType application/x-httpd-php-source .phps
#on some directory use fcgid
IPCCommTimeout 40
IPCConnectTimeout 10
MaxProcessCount 8
OutputBufferSize 64
ProcessLifeTime 60
MaxRequestsPerProcess 500
DefaultMinClassProcessCount 0
SetEnv PHPRC "C:/server2/php-non-thread-safe"
PHP_Fix_Pathinfo_Enable 1
<Directory I:/server2/htdocs/somefolder/>
AddHandler fcgid-script .php
Options Indexes FollowSymLinks ExecCGI
FCGIWrapper "c:/server2/php-non-thread-safe/php-cgi.exe" .php
AllowOverride all
Order allow,deny
Allow from all
Satisfy any
</Directory>
|
or you can use different vhosts with / without fcgid.
example
[code]
PHPIniDir "C:/server2/php"
LoadModule php5_module "C:/server2/php/php5apache2_2.dll"
AddType application/x-httpd-php .php .php5
AddType application/x-httpd-php-source .phps
IPCCommTimeout 40
IPCConnectTimeout 10
MaxProcessCount 8
OutputBufferSize 64
ProcessLifeTime 60
MaxRequestsPerProcess 500
DefaultMinClassProcessCount 0
SetEnv PHPRC "C:/server2/php-non-thread-safe"
PHP_Fix_Pathinfo_Enable 1
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot C:/server2/www
ServerName localhost
ErrorLog /server2/logs/error.log
CustomLog /server2/logs/access.log common
<Directory "C:/server2/www">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/server2/www_fcgi
ServerName fcgi.local
ErrorLog C:/server2/logs/fcgi.error.log
CustomLog /server2/logs/fcgi.access.log common
<Directory "C:/server2/www_fcgi">
<IfModule mod_fcgid.c>
SetEnv PHPRC "C:/server2/php-nts"
AddHandler fcgid-script .php
Options Indexes FollowSymLinks ExecCGI
FCGIWrapper "C:/server2/php-nts/php-cgi.exe" .php
</IfModule>
AllowOverride all
Order allow,deny
Allow from all
Satisfy any
</Directory>
</VirtualHost>
#also a PHP 6 vhost over fcgid
<VirtualHost *:80>
DocumentRoot C:/server2/www_fcgi
ServerName php6.local
ErrorLog C:/server2/logs/php6.error.log
CustomLog C:/server2/logs/php6.access.log common
<Directory "C:/server2/www_fcgi">
<IfModule mod_fcgid.c>
SetEnv PHPRC "C:/server2/php6"
AddHandler fcgid-script .php
Options Indexes FollowSymLinks ExecCGI
FCGIWrapper "C:/server2/php6/php-cgi.exe" .php
</IfModule>
AllowOverride all
Order allow,deny
Allow from all
Satisfy any
</Directory>
</VirtualHost> |
|
Back to top |
|
gcleaves
Joined: 01 Dec 2009 Posts: 14
|
Posted: Fri 04 Dec '09 18:20 Post subject: Re: PHP variable only available in module |
|
|
gcleaves wrote: | I've read the following in the variable section of the PHP manual:
Code: | 'PHP_AUTH_USER'
When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. |
Some of my scripts DO use this variable. Do you have any recommendation for this situation if I want to use fcgid? |
This mod_rewrite rule works for getting PHP, mod_fcgid, and HTTP authentication to work:
Code: | RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
|
Taken from http://www.docunext.com/wiki/Apache_FastCGI#PHP_CGI_HTTP_Authentication |
|
Back to top |
|