Everything looks right. Can you try using php-fpm
with the exact same ngingx config and see if it works? Maybe you have a directory permission issue or something. Also make sure you are actually starting the hhvm-fastcgi
process using /etc/init.d/hhvm-fastcgi start
and that nothing was listening on port 9000 before you ran that. You can run ps auxf | grep hhvm
to make sure it is running and listening.
HHVM with Nginx fastcgi not working properly
Domanda
I would like to use HHVM via Nginx. (Ubuntu 12.04.2 LTS, PHP 5.3.10)
I've followed the steps mentioned here:
http://www.hhvm.com/blog/1817/fastercgi-with-hhvm
This is how my Nginx setup looks:
server {
listen 80;
server_name demo1.dev
server_name_in_redirect off;
root /var/www/demo1;
location / {
index index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
location @handler {
rewrite / /index.php;
}
location ~ .php$ {
fastcgi_keep_conn on;
if (!-e $request_filename) { rewrite / /index.php last; }
expires off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param PHP_VALUE "error_log=/var/report/PHP.error.log";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}
}
I have a file called hhvm.php that contains this:
function is_hhvm() {
return defined('HHVM_VERSION');
}
if (is_hhvm()) {
echo "HHVM is working\n";
} else {
echo "HHVM is not working\n";
}
What am I doing wrong and how can I see if HHVM is working properly?
UPDATE:
Output of: ps auxf | grep hhvm
root 15164 0.0 0.0 9360 660 pts/0 S+ 13:55 0:00 \_ grep --color=auto hhvm
www-data 15142 4.2 6.3 576564 122484 ? Ss 13:54 0:01 /usr/bin/hhvm --config /etc/hhvm/server.hdf --user www-data --mode daemon
www-data 15154 7.0 6.3 580668 122636 ? Ss 13:54 0:01 /usr/bin/hhvm --config /etc/hhvm/server.hdf --user www-data --mode daemon -vServer.Type=fastcgi -vServer.Port=9000 -vPidFile=/var/run/hhvm/hhvm-fastcgi.pid
Soluzione
Altri suggerimenti
Do you have PHP5-FPM installed and working on your server before HHVM?
If yes then you need to stop PHP5-FPM using command
service php5-fpm stop
Then start / restart HHVM
service hhvm restart
If you have created hhvm.php in your web server root then browsing that file using any browser should output HHVM is working.
Also you can use FETCH with Google to see header of your page.The header will contain HHVM if it is generated using HHVM.
You can read https://udinra.com/blog/hhvm-fastcgi-nginx-speedup-php for more details of HHVM setup and trouble shooting.