title: apache2.4 + php-fpm + phpmyadmin in debian
body: <p>I have this setup in a debian: apache 2.4 proxy_fcgi and php-fpm (v5.5). In my virtualhost file i have:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  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
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>and everything works fine, i can see phpinfo() and every php file i request under /var/www/html/. </p>
  
  <p>I continue with the phpmyadmin installation from the debian repo but when i browse to <a href="http://MY.IP/phpmyadmin" rel="noreferrer">http://MY.IP/phpmyadmin</a> i get a "File not found" error and in the apache error log</p>
  
  <pre><code>"[proxy_fcgi:error] AH01071: Got error 'Primary script unknown\n'"
  </code></pre>
  
  <p>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 <a href="http://MY.IP/phpmyadmin/test.html" rel="noreferrer">http://MY.IP/phpmyadmin/test.html</a></p>
  
  <p>The problem is that php files under /usr/share/phpmyadmin are not being processed. The phpmyadmin apache configuration is this:</p>
  
  <pre><code># phpMyAdmin default Apache configuration
  
  Alias /phpmyadmin /usr/share/phpmyadmin
  
  &lt;Directory /usr/share/phpmyadmin&gt;
          Options FollowSymLinks
          DirectoryIndex index.php
  
          &lt;IfModule mod_php5.c&gt;
                  AddType application/x-httpd-php .php
                  &lt;FilesMatch ".+\.php$"&gt;
                      SetHandler application/x-httpd-php
                  &lt;/FilesMatch&gt;
  
                  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/
          &lt;/IfModule&gt;
  
  &lt;/Directory&gt;
  ...
  </code></pre>
  
  <p>and is loaded in apache configuration file.</p>
  
  <p>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 ?</p>
  
  <p><strong>>>update&lt;&lt;</strong>
  I added a proxypassmatch directive in phpmyadmin apache's conf</p>
  
  <pre><code>ProxyPassMatch ^/phpmyadmin/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi:///usr/share/phpmyadmin/
  </code></pre>
  
  <p>expecting to work but i keep getting the same error.</p>
  
  <p><strong>>>update 2&lt;&lt;</strong>
  I replaced the php-fpm unix socket with network (127.1:9000) and replaced the virthualhost file's ProxyPassmatch with:</p>
  
  <pre><code>ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
  </code></pre>
  
  <p>and in phpmyadmin's apache conf:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>My problem is solved but i still don't understand why the network connection with php-fpm works but the unix socket doesn't.</p>