This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Configuration for Apache mod_proxy_fcgi and PHP-FPM

Discuss installing Symfony 2 here

Configuration for Apache mod_proxy_fcgi and PHP-FPM

by microUgly » Wed Feb 12, 2014 11:33 pm

I am running Apache using mod_proxy_fcgi and PHP-FPM and am trying to get it to work Symfony. This is my first project using Symfony and am just getting a feel for it at the moment.

My vhost definition currently looks like:
Code: Select all
<VirtualHost *:80>
  ServerName symfony.dev
  Documentroot "/vagrant/symfony/web"
  DirectoryIndex app.php

  ProxyTimeout 600
  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:5090/vagrant/symfony/web/$1

  <Directory "/vagrant/symfony/web">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>


When I go to http://symfony.dev/app_dev.php/, the page loads, but all the links/paths include the full filesystem page. For example, the link for "Run the demo" is http://symblog.dev/vagrant/symfony/web/app_dev.php/demo/.

Is there a different ProxyPassMatch rule that would work, or a Symfony config that can compensate?

I tried ^/(.*\.php)(/.*)?$ which gets app_dev.php/ to load, but then app_dev.php/demo/ seems to load app_dev.php and not the demo, with broken paths to inline resources.
microUgly
Junior Member
 
Posts: 3
Joined: Wed Feb 12, 2014 11:18 pm

Re: Configuration for Apache mod_proxy_fcgi and PHP-FPM

by microUgly » Sun Jul 13, 2014 12:54 am

Can anyone suggest another forum that I might be able to seek an answer for this? I feel like I must be looking in the wrong place as I would expect this to be a fairly common question but I can't find an answer.

I have searched for hours and posted on Stack Overflow, and can't find a single reference to anyone trying to use Symfony with Apache and PHP FPM.

Symfony has only documented FPM configuration for Nginx.

By now I would expect most peers to know that they can get similar performance gains from Apache, as you get with Nginx, if they configure it to use FPM as well. So I'm stumped as to why I can't find a single reference to using Symfony this way.
microUgly
Junior Member
 
Posts: 3
Joined: Wed Feb 12, 2014 11:18 pm

Re: Configuration for Apache mod_proxy_fcgi and PHP-FPM

by microUgly » Mon Jul 14, 2014 2:05 pm

This appears to be a known bug with PHP.

Using PHP FPM with Apache's mod_proxy will result in incorrect values set for PHP_SELF and SCRIPT_NAME.

Information about this isn't as common as I would expect. Obviously everyone is still using mod_php or jumped ship to Nginx.

I'm really surprised this bug could exists after so long. The only work around appears to be to set these variables yourself.
microUgly
Junior Member
 
Posts: 3
Joined: Wed Feb 12, 2014 11:18 pm