HHVM FastCGI configuration issues - ProxyPass fails - php

I am on Ubuntu 12.04 running on Vagrant. Apache 2.2.22
I have been trying to test my app on hhvm. I configured everything following this: https://github.com/facebook/hhvm/wiki/fastcgi
After adding fastcgi module part in my vhost config, I started getting 404 not found error. Then I found out I needed to use ProxyPassMatch. After adding ProxyPassMatch line, I started getting 500 Internal Error. My apache log shows this:
[warn] proxy: No protocol handler was valid for the URL /index.php. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
All the modules are enabled.
Here is my vhost config:
ServerAdmin webmaster#localhost
DocumentRoot /opt/myapp/www/
ServerName myapp.demo
ServerAlias myapp.demo
ErrorLog /var/log/apache2/myapp.demo-error_log
CustomLog /var/log/apache2/myapp.demo-access_log common
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/opt/myapp/public/$1
<IfModule mod_fastcgi.c>
<FilesMatch \.php$>
SetHandler hhvm-php-extension
</FilesMatch>
<FilesMatch \.hh$>
SetHandler hhvm-hack-extension
</FilesMatch>
Alias /hhvm /hhvm
Action hhvm-php-extension /hhvm virtual
Action hhvm-hack-extension /hhvm virtual
FastCgiExternalServer /hhvm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
</IfModule>
Thanks!

Related

Adding CGI directives to vhost causes 404 / Not found error

I am trying to run two php versions with apache. One (PHP7) is setup with mod and the other (PHP8) I am trying to set up with CGI. I am currently testing both work using the different vhosts for https and http. I have the following virtual hosts in my httpd-vhosts.conf file:
<VirtualHost 0.0.0.0:80>
SetEnv PHPRC "C:/Program Files/PHP/php-8.1.12/"
ScriptAlias /php8112/ "C:/Program Files/PHP/php-8.1.12/"
Action application/x-httpd-8112 "/php8112/php.exe"
AddType application/x-httpd-8112 .php
<Directory "C:/Program Files/PHP/php-8.1.12/">
<Files "php.exe">
Require all granted
</Files>
</Directory>
DocumentRoot "D:/Test/Site/public"
ServerName test.local
CustomLog "C:/Users/me/Logs/test_access.log" combined
ErrorLog "C:/Users/me/Logs/test_error.log"
</VirtualHost>
<VirtualHost 0.0.0.0:443>
DocumentRoot "D:/Test/Site/public"
ServerName test.local
SSLEngine on
SSLCertificateFile "C:/Program Files/Apache24/conf/server.cert"
SSLCertificateKeyFile "C:/Program Files/Apache24/conf/server.key"
</VirtualHost>
and a simple index.php in D:/Test/Site/public:
<?php
phpinfo();
?>
Accessing via HTTPS works and correctly gives me the PHP Info page. Accessing via HTTP gives me a 404 Not Found error, however. Why would this be?
I have tried reordering the directives and adding a directory directive for the DocumentRoot directive. Neither seemed to make a difference.
I am using Apache 2.4 on Windows 10

Ubuntu 16.04 Vagrant box. PHP 5.6 fastcgi. I get a generic 500 error on page but no logs anywhere

New Vagrant box. I have a provision script that sets up PHP 5.6 and 7.1 using fastcgi as I'm doing an upgrade test so want to toggle versions. Starting with PHP5.6 enabled.
Virtual host is as follows:
ServerName local
DocumentRoot /var/www/html
<IfModule mod_fastcgi.c>
AddHandler php56-fcgi-www .php
Action php56-fcgi-www /php56-fcgi-www
Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -idle-timeout 1800 -pass-header Authorization
<Directory "/usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler php71-fcgi-www .php
Action php71-fcgi-www /php71-fcgi-www
Alias /php71-fcgi-www /usr/lib/cgi-bin/php71-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php71-fcgi-www -socket /run/php/php7.1-fpm.sock -idle-timeout 1800 -pass-header Authorization
<Directory "/usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<IfModule mod_fastcgi.c>
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler php56-fcgi-www
</FilesMatch>
</IfModule>
<Directory "/var/www/">
AllowOverride All
</Directory>
<VirtualHost *:80>
DocumentRoot /var/www/html/mysite/public-www
ServerName mysite.local
<IfModule mod_fastcgi.c>
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler php56-fcgi-www
</FilesMatch>
</IfModule>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/phpmyadmin
ServerName phpmyadmin.mysite.local
<IfModule mod_fastcgi.c>
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler php56-fcgi-www
</FilesMatch>
</IfModule>
</VirtualHost>
PHPMyAdmin functions fine. But the visiting mysite.local is displaying a generic browser 500 error. I added a phpinfo.php to check my settings. I'm happy to share the entire output, but here are the relevant basics:
display_errors = On
error_reporting = E_ALL
error_log = /var/log/php_errors.log
I found the error file above wasn't being created on error, so I manually created it and chmod it to 0777 for fun. It remains empty after I see the 500 load. I have also checked /var/log/apache2 logs. Access log shows the 500 response but there is nothing in error_log. Also looked in php5.6-fpm.log. Nothing.
Question is simple: How can I possibly find the reason for a 500 error?
Solved this with the help of this answer to a question involving nginx. I found that there were three include lines in this code with the # silencer operator. After removing the # the errors displayed on screen and in the log file defined above.

laravel and apache mod_status

I have enabled Apache mod_status on my server:
OS: centos 6
Server version: Apache/2.2.15 (Unix)
php version 7.1
I get a 404 error page for example.com/server-status as i dont know how can i serv this route, with laravel(5.2) route api or any other way?
my configuration in httpd.conf:
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from .example.com
Allow from xxx.xxx.xxx.xxx #my ip address
</Location>
and in .htaccess
RewriteCond %{REQUEST_URI} !=/server-status
I use the following code on my .htaccess to server-info and server-status:
RewriteRule ^(server-info|server-status) - [L]
Make sure first you get server-info and server-status working.
Them, read the logs about permission issues (mostly are because of order from rules).
My system:
Laravel 6
Apache 2.4.1
FreeBSD 12.1
Try placing it inside the virtualhost tag
<VirtualHost *:80>
ServerAdmin tecmint#example.com
DocumentRoot /var/www/html/example.com
ServerName example.com
ErrorLog logs/example.com-error_log
CustomLog logs/example.com-access_log common
<Location /server-status>
SetHandler server-status
Order allow,deny
Deny from all
Allow from example.com
</Location>
</VirtualHost>

kerberos apache php partialy working

have a problem with kerberos authentication on apache php
Setup = RHEL 7
apache 2.4 from rhscl
php7 from rhscl configured with php-fpm
Kerberos is working perfectly on http://site.domain/
but not on http://site.domain/index.php
The same problem occurs for all sub directories when accessing a .php file.
There is a rewrite for php to fcgi in the vhost setup.
index.php => $_SERVER['REMOTE_USER']
vhost setup
<VirtualHost *:443 >
## Vhost docroot
DocumentRoot /opt/code70
<Directory /opt/code70>
Options Indexes MultiViews
Options FollowSymLinks
IndexOptions FancyIndexing HTMLTable VersionSort IgnoreCase
IndexOrderDefault Descending Date
IndexIgnore *.php
AuthType Kerberos
AuthName "Kerberos"
KrbMethodNegotiate On
KrbMethodK5Passwd On
KrbAuthRealms ....
....
KrbVerifyKDC Off
KrbSaveCredentials Off
KrbLocalUserMapping On
KrbAuthoritative On
Order allow,deny
Allow from all
Require valid-user
</Directory>
## SSL directives
SSLEngine on
SSLCertificateFile ......
SSLProtocol -ALL +TLSv1
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
SSLHonorCipherOrder On
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://localhost:9000/opt/code70/$1
</VirtualHost>

php fpm on ubuntu 14 throwing Service Unavailable

I ran this following command to find out which port is being occupied by php-fpm
netstat -pl | grep fpm
(No info could be read for "-p": geteuid()=1000 but you should be root.)
unix 2 [ ACC ] STREAM LISTENING 9500 - /var/run/php5-fpm.sock
I have this following proxypassmatch in my web configuration file
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9500/var/www/html/$1 timeout=1800
I have all the necessary dependencies installed for processing php fpm as a fastcgi module.
<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
<Directory /usr/lib/cgi-bin>
Options ExecCGI FollowSymLinks
SetHandler fastcgi-script
Require all granted
</Directory>
</IfModule>
My VirtualHost directives are in the following set:
<VirtualHost *:443>
ServerName domain.com
ServerAlias www.domain.com
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/apache2/ssl/private/ec1ed7d470bd0db4.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/.key
SSLCertificateChainFile /etc/apache2/ssl/.crt
DocumentRoot /var/www/html/dir
# Setup php-fpm to process php files
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9500/var/www/html/dir/$1
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9500/var/www/html/$1 timeout=1800
</VirtualHost>
I still get the following message after restarting Apache and php fpm
Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems

Categories