Ortix
By:
Ortix

Run IP.Board (invision power board) on droplet with nginx and hhvm

May 2, 2015 3.2k views
Configuration Management Nginx Applications Ubuntu

I'm running nginx and hhvm on a ubuntu 14.04 droplet (provisioned by Forge). However, I can't for the life of me get IPB to install. All I get is a blank page. There must be something very specific going on in the config since all my laravel instances work fine on the server. I can also die and dump in the installation and public index file so nginx is able to communicate with HHVM.

The log files don't give out any warnings or errors. Perhaps I can get them to be more verbose?

Any help would be greatly appreciated

I have attached my nginx config file

server {
access_log off;
error_log  /var/log/nginx/forums.animekyun.com-error_log warn;

        listen 80;
    server_name  forums.animekyun.com www.forums.animekyun.com;

        # static file configuration
        location ~* .(gif|jpg|jpeg|png|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|js|css|wml|swf)$ {
        root   /home/forge/forums.animekyun.com;
                expires max;
                add_header Pragma public;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        }

        # site configuration
        location / {
                root   /home/forge/forums.animekyun.com;
                index  index.php index.html index.htm;

                # IPB configuration
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        # php-fpm configuration
        location ~ .php$ {
            root           /home/forge/forums.animekyun.com;
            try_files $uri =404;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 4k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
        }

}
2 comments
  • A lot of PHP Solutions don't work without modification on HHVM as HHVM cuts a lot of corners and tweaks the functionalities of PHP. Contact IPBoard Support to see if they even support HHVM or not. If not then your trying is for nothing

  • IP.Board 4 supports hhvm according to the developers

1 Answer

@Ortix

HHVM can be a bit finicky at times, so the first thing I'd recommend is:

1). Shutdown HHVM; verify that no instances are running.
2). (Re)Install & Start PHP-FPM. Does it work as-is? If no;
3). Load your sites PHP-FPM configuration file and look at:

listen =

  • Since you're using a port in your NGINX configuration, make sure this isn't configured to use a socket.

user =
group =

  • Make sure the user this pool is running as has proper permissions to read/write.

listen.allowed_clients

  • If this is commented out, it shouldn't be an issue, though if it's not, make sure the IP('s) are valid.

security.limit_extensions

  • If this is commented out, remove the ; and use valid extensions (which would be .php).

4). You're defining the root directory in each location block which isn't needed. Ideally, unless you're defining aliases, root should only be defined once and it should be before your location blocks. So instead defining the same root in each location, remove all 3 instances and place a single instance below

server_name  forums.animekyun.com www.forums.animekyun.com;

You should end up with the following (and all other instances removed):

server_name  forums.animekyun.com www.forums.animekyun.com;
root         /home/forge/forums.animekyun.com;

It's also safe to remove:

index  index.php index.html index.htm;

..from the server block and move it to nginx.conf unless your Droplet is setup to where you need to define this per site. If that's the case, instead of defining it per location, move it to right below the root definition.

server_name  forums.animekyun.com www.forums.animekyun.com;
root         /home/forge/forums.animekyun.com;
index        index.php index.html index.htm;

The other thing that popped out when looking over the server block was that in most all configurations I've dealt with, there's a \ before the . in the location block for PHP. So instead of using:

location ~ .php$ {

use:

location ~ \.php$ {

Altogether this would give you a final modified configuration that looks like:

server {
    listen         80;
    server_name    forums.animekyun.com www.forums.animekyun.com;
    root           /home/forge/forums.animekyun.com;
    index          index.php index.html index.htm;

    access_log     off;
    error_log      /var/log/nginx/forums.animekyun.com-error_log warn;

    # static file configuration
    location ~* .(gif|jpg|jpeg|png|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|js|css|wml|swf)$ {
        expires    max;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    # site configuration
    location / {
        # IPB configuration
        try_files  $uri $uri/ /index.php?q=$uri&$args;
    }

    # php-fpm configuration
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 4k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }
}

If none of that works, while PHP-FPM is running, check your error log and see if anything is popping up.

  • I was looking in the wrong logs.. I found the hhvm log and this is the output when refreshing the page (i did manage to install it with php-fpm)

    \nFatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function fetch_fields() on a non-object (boolean)' in :\nStack trace:\n#0 /home/forge/forums.animekyun.com/system/Db/Db.php(391): mysqli_stmt->store_result()\n#1 /home/forge/forums.animekyun.com/system/Db/Db.php(622): IPS\\_Db->preparedQuery()\n#2 /home/forge/forums.animekyun.com/system/Session/Front.php(274): IPS\\_Db->replace()\n#3 (): IPS\\Session\\_Front->write()\n#4 (): call_user_func()\n#5 (): __SystemLib\\SessionForwardingHandler->write()\n#6 (): session_write_close()\n#7 {main}
    

    I'm going to take this to the developers

    • In the past I was using HHVM with IP Board 3.4 and it worked without bigger problems but since the upgrade to IP Board 4 I am also getting "BadMethodCallException" error and had to switch to PHP7 because of it. Unfortunately IP Board is not so efficient with PHP7 as it was with HHVM. Waiting for Invision to fix it.

Have another answer? Share your knowledge.