12/4/2015 - 4:54 AM

Hiphop-php HHVM working with Codeigniter and Nginx

Hiphop-php HHVM working with Codeigniter and Nginx

I managed to make Codeiniter work with HHVM, using
nginx as a proxy. My problem was that hhvm has problems
with path_info, so I was not able to run /index.php/controller/action or
/controller/action/params -> /index.php/controller/action.params.

I used nginx as a proxy to hhvm. I changed the way codeigniter process
the url. Steps bellow:

Cleaned my HHVM .hdf file:
Server {
  Port = 9000
  SourceRoot = /usr/share/nginx/www/mysystem

VirtualHost {
  * {
  	Pattern = .*

Configure Nginx:

server {
	server_name mymachine;
	root /usr/share/nginx/www/mysystem;
	index index.php index.html index.htm;
	proxy_redirect off;
	# Copy request_uri to variable $myuri before processing
	set  $myuri  $request_uri;
	location / {
		# Check if a file exists, or route it to index.php.
		try_files $uri $uri/ /index.php;
	# Send *.php to Hiphop hhvm
	location ~ \.php$ {
		proxy_set_header MY_SCRIPT $myuri;

Changed Codeigniter file /application/config/config.php
$config['index_page'] = '';
$config['uri_protocol']	= 'HTTP_MY_SCRIPT';

Restart eveything and it is working for me