Thread tagged as: Problem, Error, Hosting

PHP-FMP Breaks Perch


I'm looking into the PHP-FPM SERVER API for handling PHP (it should help boost my server's RAM efficiency).

However, when I activate the ProxyPassMatch in the apache 2.4 conf file with the following code:

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1

The page breaks - it looks like some of the perch functions are breaking, for example the perch_page_attributes() and perch_content() functions, yet perch_layout() works fine.

I know my implementation of PHP-FPM is correct, and it works well for non-perch sites.

Is there a known issue/fix for this?

My Server is on CentOS 7, Apache 2.4 if it helps.


Matthew Lymer

Matthew Lymer 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

My suspicion is that an expected environment variable is being lost.

Are you able to access your diagnostics report? If not, can you show me the output of print_r($_SERVER); ?


I can't access the diagnostic report, but here is the $_SERVER export;

[USER] => apache
[HOME] => /usr/share/httpd
[UNIQUE_ID] => VxDfty3elgDVjcKdFX1u7AAAAMA
[SCRIPT_URL] => /Test.php
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
[HTTP_ACCEPT_ENCODING] => gzip, deflate, sdch
[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8
[HTTP_COOKIE] => PHPSESSID=uqsi6um8c4i6ggo1h8jtsq0i05; _gat=1; _ga=GA1.2.173638888.1457025439
[PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
[SERVER_SOFTWARE] => Apache/2.4.6
[DOCUMENT_ROOT] => /home/theheritagefestival/public_html
[CONTEXT_DOCUMENT_ROOT] => /home/theheritagefestival/public_html
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /home/theheritagefestival/public_html/Test.php
[REMOTE_PORT] => 55042
[REQUEST_URI] => /Test.php
[SCRIPT_NAME] => /Test.php
[PHP_SELF] => /Test.php
[REQUEST_TIME_FLOAT] => 1460723639.7673
[REQUEST_TIME] => 1460723639

Anything look like it might clash with perch?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hmm, that looks ok.

Can you be more specific about the errors you're getting?

If it helps, the non php-fmp only has 6 variables now missing in $_SERVER:

[PHPRC] => /home/thebrinksfestival/fcgi-bin/../etc/php5.5
[PWD] => /home/thebrinksfestival/fcgi-bin
[SHLVL] => 0
[HTTPS] => on

Any of those look essential to perch?

Sadly I cannot - it just gives a blank screen (removing the perch functions like the attributes one allows the page to load everything up to the next perch function before stopping).

Drew McLellan

Drew McLellan 2638 points
Perch Support

I was mostly looking to see if REQUEST_URI and SCRIPT_NAME were being correctly populated - without those Perch doesn't know how to serve up a page.

Do you have an error log of any sort?

I have looked through my error log - but nothing really helps.

I have also tried it on a wordpress installation, and it gives the error "Your PHP installation appears to be missing the MySQL extension which is required by WordPress"

So possibly my php-fpm installation is stopping the server from using MySQL, but I don't know why it would be doing that?

PHP-MySQL is correctly installs, and runs fine. Possibly the ProxyPassMatch ^/(..php(/.)?)$ fcgi://$1 change stops mySQL from working?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have PDO installed? Does phpinfo() reveal anything?

PHP info has revealed that using proxypassmatch is swapping the PHP version being used by my virtualhost (causing issues) so I'll see if I can resolve this. Seems like it's not a perch issue at least!

Thanks for the help!