Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 404 File Not Found on Apache 2.4, FastCGI and Ubuntu 14.04 #3472

Closed
Zeokat opened this issue Aug 14, 2014 · 18 comments
Closed

Getting 404 File Not Found on Apache 2.4, FastCGI and Ubuntu 14.04 #3472

Zeokat opened this issue Aug 14, 2014 · 18 comments

Comments

@Zeokat
Copy link

Zeokat commented Aug 14, 2014

My first step was install HHVM following this guide: https://github.com/facebook/hhvm/wiki/Prebuilt-packages-on-Ubuntu-14.04

Then i run the script with the command: ´sudo /usr/share/hhvm/install_fastcgi.sh´

Then i test if hhvm was installed with command ´php -v´ and the output is OK, says that HIPHOP VM is runing.

The problem arrives when i try to access to a PHP file, Apache always return 404 error. In the other hand html files and static files works good. I only receive 404 error with php files.

I search on Google and found many people with same issue but no solutions. Perhaps someone can help.

@RandyHandy
Copy link

I have exactly same problem, i have followed documentation instructions and i get error 404 with PHP files. Exists a solution?

@SiebelsTim
Copy link
Contributor

Do you directly access the php file? Like http://mysite.com/path/index.php not http://mysite.com/path/.
Does hhvm.server.fix_path_info help?

@Zeokat
Copy link
Author

Zeokat commented Aug 29, 2014

Hi SiebelsTim,
i´m accessing directly to the php file, something like http://127.0.0.1/test.php and i always get 404 error on php files. On the other hand, html files, images, etc... can be accessed OK.

Didn´t explore hhvm.server.fix_path_info, don't know exactly what it do :/ (searching now)

Ok, i found this #3285 and seems a bug that they not solved.

@SiebelsTim
Copy link
Contributor

I tested it earlier today, it worked for me.
What are your settings in /etc/apache2/apache2.conf?

All other files probably can be accessed because apache handles them itself. Only PHP files should be sent to hhvm (ProxyPassMatch sets this)

@Zeokat
Copy link
Author

Zeokat commented Aug 29, 2014

I don't have the machine runing now, but i not modified /etc/apache2/apache2.conf bymyself at all, i simply run script sudo /usr/share/hhvm/install_fastcgi.sh as stated in documentation. Perhaps the bug was fixed in latest build, i will retry in a few hours and if the error continues i will post my config files contents.

Did you tryed on Ubuntu 14.04 x64?

@Zeokat
Copy link
Author

Zeokat commented Aug 30, 2014

Ok i tested and have exact same issues. My config files:
/etc/apache2/apache2.conf > https://gist.github.com/Zeokat/3b5c1273a7da48e1ad94
/etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf > https://gist.github.com/Zeokat/609b7313b8f9ab0ebe80
/etc/hhvm/php.ini > https://gist.github.com/Zeokat/bd05ca589d5581ff23f9
/etc/hhvm/server.ini > https://gist.github.com/Zeokat/f87002e5046f3a2fb3e2

I have no luck at all runing it and i have no idea what is wrong.

@filippouni
Copy link

As SiebelsTim said, you could put "hhvm.server.fix_path_info = true" in /etc/hhvm/server.ini and restart hhvm with "/etc/init.d/hhvm restart".
I tested it today, it worked for me.

@Zeokat
Copy link
Author

Zeokat commented Sep 23, 2014

Thanks @filippouni i will test again but i think that i already tested that and didn't helped.

@simonmilz
Copy link

I got the same problems with 404 errors under Ubuntu 12.04 with Apache 2.2 and FastCGI. After i put "hhvm.server.fix_path_info = true" everything works fine.

@patrickfabrizius
Copy link

The issue seems to be with /etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf - it overrides the proxy config in the vhost. Removing the whole file (symlink) and restarting apache made it work for me. You need a ProxyPassMatch or ProxyPass in your vhost though.

@Dantali0n
Copy link

hhvm.server.fix_path_info = true is required if you use any mod_rewrite rule just FYI.

@ghost
Copy link

ghost commented Apr 7, 2015

As the issue still persists for fresh installations on Ubunty 14.04 (x64), here is what worked for us when testing HHVM.

As removing "/etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf" from the system will result in PHP scripts not being served by HHVM, it is not a solution for the issue at hand.

Instead we had to do the following:

  1. Login to your server via SSH

  2. sudo nano /etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf

  3. Find:
    ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1

    Replace with:
    ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1

  4. Save the file (CTRL+X, y)

  5. Restart Apache (service apache2 restart)

Hope this is of any help :-)

@patrickfabrizius
Copy link

@SpamTrawler, it seems to me that hhvm_proxy_fcgi.conf sets a global proxypass. This might work on a single-site installation, but adding "html/" only makes that global proxy look in another directory - it still blocks any vhost config. Removing the file and setting ProxyPass directives locally (vhost conf) made it work for me.

I'm sure there is a more clean solution, but I havn't found it ...

@fatbattk
Copy link

So I had the exact same problem, tried all the suggestions here, but for some reason it still 404'd.

Thanks to #hhvm chat, I tried hhvm.server.fix_path_info = false and oddly, that worked for me (I do use mod_rewrite).
So if you're stuck too, give it a shot!

HipHop VM 3.7.0 (rel)
Compiler: tags/HHVM-3.7.0-0-gc8baf9cd3cb603e030969bfe24634d5e85549915

@herrbischoff
Copy link

Also had this issue and had to do a mixture of steps:

  1. Delete /etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf
  2. Add ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1 to Apache site config
  3. Set hhvm.server.fix_path_info = false in /etc/hhvm/server.ini
  4. Restart both Apache and hhvm

Environment

$ uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ hhvm --version
HipHop VM 3.7.1 (rel)
Compiler: tags/HHVM-3.7.1-0-g111c76378ac29aa8f25e6bb3c5f15b628e6bbea1
Repo schema: be14a89778f35ca7f7dd4aca7fff0793e8ae3334

@opensourcelib
Copy link

Setting HHVM with apache 2.4 running fastcgi:
#nano /etc/apache2/mods-enabled/hhvm_proxy_fcgi.conf
comment this line
#ProxyPassMatch ^/(.+.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1
Why did we comment that line? to avoid having it running globally on apache instead we are going to edit each virtualhost on apache to make it run by each virtualhost

Edit nano /etc/apache2/sites-available/virtualhost.conf
#beginning of virtualhost file
<VirtualHost *:80>
ServerName example.com

    ServerAdmin webmaster@partshighway.com
    DocumentRoot /home/www/public_html
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/www/public_html/$1

    ErrorLog /home/www/log/error.log
    CustomLog /home/www/log/access.log combined

    <Directory /home/www/public_html/>
            DirectoryIndex index.php
            AllowOverride All
            Require all granted
    </Directory>

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

#end of virtualhost file

#sudo service apache2 stop
#sudo service hhvm stop
than
#sudo service hhvm start
#sudo service apache2 start

@Maxence
Copy link

Maxence commented Mar 31, 2016

Thanks @SiebelsTim, hhvm.server.fix_path_info solved my issue here.

@paulbiss
Copy link
Contributor

Looks like there's a resolution here. fix_path_info is now documented here: https://docs.hhvm.com/hhvm/configuration/INI-settings#common-options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests