I have this setup in a debian: apache 2.4 proxy_fcgi and php-fpm (v5.5). In my virtualhost file i have:

<VirtualHost *:80>
DocumentRoot /var/www/html
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi://./var/www/html
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>

and everything works fine, i can see phpinfo() and every php file i request under /var/www/html/.

I continue with the phpmyadmin installation from the debian repo but when i browse to http://MY.IP/phpmyadmin i get a "File not found" error and in the apache error log

"[proxy_fcgi:error] AH01071: Got error 'Primary script unknown\n'"

Debian phpmyadmin package dumps the contents into /usr/share/phpmyadmin. If i create a test.html file under /usr/share/phpmyadmin i can see its contents from http://MY.IP/phpmyadmin/test.html

The problem is that php files under /usr/share/phpmyadmin are not being processed. The phpmyadmin apache configuration is this:

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
        Options FollowSymLinks
        DirectoryIndex index.php

        <IfModule mod_php5.c>
                AddType application/x-httpd-php .php
                <FilesMatch ".+\.php$">
                    SetHandler application/x-httpd-php
                </FilesMatch>

                php_flag magic_quotes_gpc Off
                php_flag track_vars On
                php_flag register_globals Off
                php_admin_flag allow_url_fopen Off
                php_value include_path .
                php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
                php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/:/usr/share/javascript/:/usr/share/php/tcpdf/
        </IfModule>

</Directory>
...

and is loaded in apache configuration file.

Since there is no mod_php installed there is no processing for the php files. How can i tell apache to use proxy_fcgi to process php files under /usr/share/phpmyadmin directory ?

>>update<< I added a proxypassmatch directive in phpmyadmin apache's conf

ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi:///usr/share/phpmyadmin/

expecting to work but i keep getting the same error.

>>update 2<< I replaced the php-fpm unix socket with network (127.1:9000) and replaced the virthualhost file's ProxyPassmatch with:

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1

and in phpmyadmin's apache conf:

ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/phpmyadmin/$1
ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/phpmyadmin$1index.php

and everything works.. when i go to MY.IP/phpinfo.php i get the phpinfo from /var/www/html/phpinfo.php and when i visit MY.IP/phpmyadmin/phpinfo.php i get the processed contents of /usr/share/phpmyadmin/phpinfo.php.

My problem is solved but i still don't understand why the network connection with php-fpm works but the unix socket doesn't.

share|improve this question
    
If I could kiss you I would, pure genious! – Creek Dec 11 '14 at 18:58
    
You saved my life! thanks a lot ! – Isma Haro Jun 2 '16 at 16:21
    
I have also tried working it with Unix sockets until I gave up. It won't work. So decided to fall back to tcp connection!! – David Okwii Jun 17 '17 at 11:53

I was struggling with this exact same issue and I could not get phpmyadmin to work. I was still getting the "File not found" mentioned above. My issue was I had to put mine in my ProxyPassMatch inside of my 000-default.conf file inside of my ./sites-available folder and I had to put these entries BEFORE my default one. This was outline at the very bottom of this page where I found the solution: http://jordanconway.com/set-up-apache-2-4-with-php-fpm-on-ubuntu-13-10/

Here is the way I have mine setup for reference.

<VirtualHost *:80>
   ...
    DocumentRoot /var/www/html
   ...
    ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/phpmyadmin/$1
    ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/phpmyadmin$1index.php
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
</VirtualHost>
share|improve this answer

Could this be due to a fact that sockets are being supported from Apache 2.4.9 and you used some earlier build of 2.4 perhaps?

share|improve this answer
1  
yup, that was the problem with unix socket, Apache supports unix socket from v2.4.9 and above (or with a patch for v2.4.7). I was using 2.4.7 but at that time Apache documentation didn't specify that the unix socket was not supported. – papasj Jul 21 '14 at 9:46

Looks like you solved this.

  1. Your PHPMyAdmin was set to use mod_php5, which likely wasn't installed since you are using PHP via PHP-FPM.
  2. You correctly identified that phpmyadmin setup required a proxypass which had the correct path to the PHP files.

For the last bit, usually php-fpm will listen on a unix socket or on TCP but not both. What's the listen directive set to in /etc/php5/fpm/pool.d/www.conf? Are there more than one listen directives defined?

I'm guessing there is just the one Listen 127.0.0.1:9000 set in there.

share|improve this answer
    
Feel free to upvote my comment if it helped :) – purpler Jul 21 '14 at 13:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.