We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Apache deployment

Hello, We are lauching a really big application that will interacts with TV Campaigns, Radio, etc. The front-end applications, is written with Phalcon, and then we have a service tier running with java. Our devopts team is configuring the apaches with fpm. However, during the stress test we are not having the results that we are expecting.

Could you please point us how is the best aproach to configure it?



Can you show ur results and how are you configuring phalcon, apache and php-fpm?

Version of php will also help alot



The best command to configure Apache :

$ apt-get remove apache && apt-get install nginx


$ apt-get remove apache && apt-get install lighttpd


You can't use fpm with apache. Use php module for apache - libphp5.so. It work faster in default


We're running on Amazon Linux (which is a slim version of CentOS 6.X). We're using httpd 2.4 (2.4.12), with event_mpm on defaults settings. We're connecting to php-fpm (5.4.40) with php 5.4 (5.4.40). We're connecting to php-fpm through mod_proxy_fcgid.

These are the relevant apache configs. As you can see, we're been playing around with it. We did not make any change to the default mpm settings

# PHP-FPM FastCGI Proxying
#ProxyPassmatch ^/(.*\.php)$ unix:/var/run/php-fpm/www.sock|fcgi://
#ProxyPassmatch ^/(.*\.php)$ fcgi://$1
<FilesMatch "\.php$">
    SetHandler "proxy:unix:/var/run/php-fpm/www.sock|fcgi://"

Right now we're using some default settings for php-fpm

;emergency_restart_threshold = 0 ;emergency_restart_interval = 5s

We're running on an 8 cores, 15 gb server (AWS c4.2xlarge).. if we use pm.max_children = 50 we get 90rps, but our load is 12 with no errores. If we set up a higher number (e.g.: 1024) we get a load of 40, no errors as well. If we set it to 10, we get a sane load (6, 7) but we start getting 408 errors, even without traffic.

As a side note, we also included and removed apc without significant changes.



I would recommend two things

  • Upgrade to php 5.6 or 5.5 if you cant go to 5.6
  • Activate opcache (do not use apc)

Regaring the test , you are getting high loads without traffic. what type of system is it? high # of db connection? what is the system doing



The system just consumes from using Curl JSON services exposes from the java tier. We do not use database within the php side; just services


edited Apr '15

Then something is off, I cant tell since I cant view the code but getting such hight load without traffic something has to be configure wrong, add opcache and run it again.

Are you guys also viewing the logs while running the test?

Also what happends if you change from apache to nginx?



Any update?