How to configure PHP and lighttpd for use on Colibri iMX6DL w/ stock linux image

Hello,

This may seem like a silly question but here goes…

Where is the php.ini file and where are the script files that should have been created by the lighttpd package install? I did the following to try and find the php.ini file…

root@colibri-imx6:/etc# php-cgi -i | grep php.ini
<tr><td class="e">Configuration File (php.ini) Path </td><td class="v">/usr/lib </td></tr>
root@colibri-imx6:/etc# ls -l /usr/lib | grep php
root@colibri-imx6:/etc#
root@colibri-imx6:/etc# ls | grep php
root@colibri-imx6:/etc#

I used opkg to install both php-cgi and lighttpd and I believe the server and php are installed corrctly.

root@colibri-imx6:/etc# lighttpd -v
lighttpd/1.4.33 - a light and fast webserver
Build-Date: Oct 29 2014 16:41:06
root@colibri-imx6:/etc# php-cgi -v
PHP 5.4.14 (cgi-fcgi) (built: Jul  8 2014 14:13:56)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
root@colibri-imx6:/etc#

Here is the output when I try to run the server.

root@colibri-imx6:/etc# lighttpd -f lighttpd.conf
2015-01-10 03:49:07: (/build/jenkins/angstrom-v2014.06/machine/beaglebone/build/tmp-angstrom_v2014_06-eglibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/lighttpd/1.4.33-r1/lighttpd-1.4.33/src/plugin.c.169) dlopen() failed for: /usr/lib/mod_fastcgi.so /usr/lib/mod_fastcgi.so: cannot open shared object file: No such file or directory
2015-01-10 03:49:07: (/build/jenkins/angstrom-v2014.06/machine/beaglebone/build/tmp-angstrom_v2014_06-eglibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/lighttpd/1.4.33-r1/lighttpd-1.4.33/src/server.c.676) loading plugins finally failed
root@colibri-imx6:/etc#

I also tried to use mod_cgi…

root@colibri-imx6:/etc# lighttpd -f lighttpd.conf
2015-01-10 03:50:36: (/build/jenkins/angstrom-v2014.06/machine/beaglebone/build/tmp-angstrom_v2014_06-eglibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/lighttpd/1.4.33-r1/lighttpd-1.4.33/src/plugin.c.169) dlopen() failed for: /usr/lib/mod_cgi.so /usr/lib/mod_cgi.so: cannot open shared object file: No such file or directory
2015-01-10 03:50:36: (/build/jenkins/angstrom-v2014.06/machine/beaglebone/build/tmp-angstrom_v2014_06-eglibc/work/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/lighttpd/1.4.33-r1/lighttpd-1.4.33/src/server.c.676) loading plugins finally failed
root@colibri-imx6:/etc#

If I remove all the php configuration from the lighttpd.conf file the server runs correctly but (clearly) does not run .php files.

Thank you in advance,

Physineer

Hi

Configuring web servers is not exactly our main expertise. So, even though the following works there might be more to it.

The following lets one assume that the lighttpd cgi module is broken in jethro, so lets go for fastcgi anyway.
Actually I tried installing lighttpd-module-cgi and enabled it in the configuration. lighttpd refused to start with the mentioned error message.

I did install from feeds:

root@colibri-imx6:~# opkg install lighttpd lighttpd-module-fastcgi php-cgi

Then I had to make the following changes to /etc/lighttpd.conf

root@colibri-imx6:/www# diff /etc/lighttpd.*orig /etc/lighttpd.conf                                                                                           
--- /etc/lighttpd.conf.orig
+++ /etc/lighttpd.conf
@@ -21,7 +21,7 @@
 #                               "mod_auth",
 #                               "mod_status",
 #                               "mod_setenv",
-#                               "mod_fastcgi",
+                                "mod_fastcgi",
 #                               "mod_proxy",
 #                               "mod_simple_vhost",
 #                               "mod_evhost",
@@ -140,7 +140,7 @@
 ######### Options that are good to be but not neccesary to be changed #######
 
 ## bind to port (default: 80)
-#server.port                = 81
+server.port                = 80
 
 ## bind to localhost (default: all interfaces)
 #server.bind                = "grisu.home.kneschke.de"
@@ -211,14 +211,14 @@
 #### fastcgi module
 ## read fastcgi.txt for more info
 ## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
-#fastcgi.server             = ( ".php" =>
-#                               ( "localhost" =>
-#                                 (
-#                                   "socket" => "/tmp/php-fastcgi.socket",
-#                                   "bin-path" => "/usr/local/bin/php"
-#                                 )
-#                               )
-#                            )
+fastcgi.server             = ( ".php" =>
+                               ( "localhost" =>
+                                 (
+                                   "socket" => "/tmp/php-fastcgi.socket",
+                                   "bin-path" => "/usr/bin/php-cgi"
+                                 )
+                               )
+                            )
 
 #### CGI module
 #cgi.assign                 = ( ".pl"  => "/usr/bin/perl",

and added /www/pages/hello.php

<?php
phpinfo();
?>

Restarting the webserver

systemctl restart lighttpd

Gives access to http://<module ip>/hello.php


I guess there is no php.ini file installed.

One can check what file have been installed by a package with:

opkg files <package-name>

The lighttpd-module-cgi seemed to do the trick :slight_smile:

Thanks much