logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Reducing time to first byte for PHP files (FCGID)
Author
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Tue 14 May '13 20:38    Post subject: Reducing time to first byte for PHP files (FCGID) Reply with quote

I noticed that my WHMCS pages don't load very quickly(since I can't use opcode caching for their ioncube encrypted files), after investigating with the Ioncube team we came to the conclusion that something is probably wrong with my server config.

It appears that PHP pages have a long time to first byte of 1.5 sec or longer when not making use of any opcode caching for my normal website.

The Ioncube team
recommended switching to a Linux server...
But I doubt that's going to help and I believe the problem is caused by PHP or the implementation of PHP in Apache.

I've already tested the standard PHP.ini files and also made some changes, but this didn't resolve the problem so I think it's caused by my Fcgid implementation.

This is my setup:
Code:

<IfModule mod_fcgid.c>
# Where to look for the php.ini file?
FcgidInitialEnv PHPRC "C:/Progra~2/PHP"
FcgidInitialEnv PATH "C:/Progra~2/PHP;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
# 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 1500
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 0
# Maximum number of PHP processes
FcgidMaxProcesses 300
FcgidMaxRequestInMem 268435456
FcgidOutputBufferSize 268435456
FcgidProcessLifeTime 43200
FcgidMinProcessesPerClass 0
FcgidMaxRequestLen 1073741824
FcgidProcessLifeTime 10800
FcgidZombieScanInterval 60
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIdleTimeout 0
FcgidIOTimeout 120
FcgidConnectTimeout 16
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/Progra~2/php/php-cgi.exe" .php
</Files>
</IfModule>


Does anyone know how I can optimize this? (I'm using PHP 5.4.15 nts x86)
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3059
Location: Hilversum, NL, EU

PostPosted: Tue 14 May '13 21:15    Post subject: Reply with quote

What happens when you use Apache as module instead of mod_fcgid ?
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Tue 14 May '13 21:53    Post subject: Reply with quote

What do you mean by using Apache as module?
Do you mean using Apaches mod_php?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3059
Location: Hilversum, NL, EU

PostPosted: Tue 14 May '13 22:02    Post subject: Reply with quote

LoadModule php5_module "x:/xxx/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "x:/xxx/"
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Tue 14 May '13 22:14    Post subject: Reply with quote

I tried this:

in my httpd.conf

Code:
LoadModule php5_module "C:/Program Files (x86)/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/Progra~2/php/"


But I get a not valid win32 app error, I think it's because I use Apache x64...

Any suggestions?
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 679

PostPosted: Wed 15 May '13 10:24    Post subject: Reply with quote

See your options at www.apachelounge.com/viewtopic.php?t=4481
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Wed 15 May '13 11:56    Post subject: Reply with quote

Thanks, I've switched to 32 bit apache.

But when I load a php page I get the following error:
Error displaying the error page: Application Instantiation Error

I currently have the following in my httpd.conf

Code:
LoadModule php5_module "C:/Program Files (x86)/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/Program Files (x86)/php/php.ini"


Any suggestions?
I think my php5apache2.4.dll is outdated since its from 2012...
Back to top
gijs



Joined: 27 Apr 2012
Posts: 189
Location: The Netherlands

PostPosted: Mon 27 May '13 23:39    Post subject: Reply with quote

Hmm, I can't use this with the nts version...

Any other ways of optimizing the performance between PHP and apache?
Back to top


Reply to topic   Topic: Reducing time to first byte for PHP files (FCGID) View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules