How do I make PHP work with Nginx on the BBB?

Hi guys

I’m very new to the Linux world, and I’m trying to setup a LEMP on my BBB.

So far, I have Nginx running (couldn’t do it through opkg, so got it here: http://nginx.org/download/nginx-1.4.1.tar.gz).

Now, to get PHP working I’ve tried install php-fpm, which installs a package, but I’m not sure whether this gives me what I need to run PHP. I’ve seen different posts (ex.: here) on how to get PHP to work with Nginx on another distribution, but after installing php-fpm they mention files (/etc/php5/fpm/php.ini) that I do not see - nor does php -v work. Do I need to install other packages? I read that php-fpm contains a daemon process, but I have no idea whether it also includes the php framework, and what to do about that.

I think I’m missing some basic knowledge of how to install PHP. I’ve now seen a ton of different ways of installing it - and I have no idea about which is the right way for Nginx. I’m hoping that someone can shed some light on this.

Thanks!

/Torst

Well, turns out you have to do the following:

  1. Install PHP framework with this command:

opkg install php php-cgi php-cli

  1. Install the daemon worker with this command
    opkg install php-fpm

  2. Make sure you have the PCRE library installed. If not, install it using command:
    opkg install libpcre libpcre-dev
    …and recompile Nginx, if you had to install PCRE, otherwise Nginx does not recognize PCRE.

  3. In your nginx.conf, edit the fastcgi_param variable from:
    SCRIPT_FILENAME /scripts$fastcgi_script_name;

to:
SCRIPT_FILENAME /path-to-your-site$fastcgi_script_name;

There are many tutorials on getting Nginx to serve PHP, but the above details were hard to find for me.

  • Torsten

For those of you who want the steps to do all this, they’re described here: http://www.drsugus.com/beaglebone-black-web-server-lemp/

Also, that site linked to runs on the the BBB.