Home » Php » php – Configuring HHVM 3.7 with Apache 2.4 gives me a 404?

php – Configuring HHVM 3.7 with Apache 2.4 gives me a 404?

Posted by: admin July 12, 2020 Leave a comment

Questions:

I can’t seem to configure HHVM and Apache, it keeps giving me a 404 file not found error. My configuration file for the website is saved as www.example.com.conf, it contains:

<VirtualHost *:80>
        ServerName website.com
        ServerAdmin [email protected]

        DocumentRoot /var/www/website.com/public_html/
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/website.com.com/public_html/$1

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Note that I’ve removed my actual website name, but it’s for a subdomain so it’s this: subdomain.xyz.com. I’ve tried looking up how to fix this, but whatever I’ve tried doesn’t seem to work; even the GitHub issues people have posted on the official repository don’t seem to work. I also haven’t changed the default apache configuration, the only thing I have changed is the root directory of my website which does much up to the directory in the configuration file above.

Any ideas? Thanks.

How to&Answers:

I know it’s been two months already, but maybe it helps someone else (I had a similar issue occur many times when configuring HHVM + Apache2).

  1. Try to enable the vhost if you haven’t yet done so. Issue sudo a2ensite www.example.com and reload apache afterwards with sudo service apache2 reload.
  2. If the vhost is ok and you have your browser requests visible in the vhost access log, then it means that it’s not Apache2 that’s the culprit there.
  3. So if you’re still with me and the first two steps didn’t help, try the following, although in HHVM 3.7 it shoulnd’t be the case anymore (but it might, I just follow the try-and-check method when it comes to configuring HHVM, and it usually works). Open /etc/hhvm/server.ini and append the following line to that file:

    hhvm.server.fix_path_info = true
    
  4. After changing the HHVM’s configuration, issue sudo service hhvm restart. Then try to refresh your website. It should be all good.

I had similar issues and back then it was the most common fix on all webservers I configured to work with HHVM. But, after the latest updates, I had to comment that line out of my hhvm server.ini in order for my code to work – I read that they have somehow changed the parameters of the server and this parameter does no good anymore, AFAIK.

I have also tried to put that line in /etc/hhvm/php.ini but as far as I remember, it should go to server.ini because it’s a server parameter.

So. Try it and let me know if that helped. If not then please issue the following commands on your webserver and paste the output here, so I can see if you have the necessary modules installed

ls  /etc/apache2/mods-available | grep -E 'proxy|alias|fcgi|hhvm'
ls  /etc/apache2/mods-enabled | grep -E 'proxy|alias|fcgi|hhvm'

Oh, and please include your full HHVM and Apache2 version output:

hhvm --version
apache2 -v