Questions regarding Lighttpd

@Fourdee

Your write up on Lighttpd (here: https://dietpi.com/forum/t/dietpi-software-details-for-all-installation-options/22/48 ) states, “Recommended for advanced users only” due to the incompatibility with the other web-based software that is included with your dietpi distro…

by incompatibility, I’m assuming that you just mean that you haven’t automated the other products to use the Lighttpd stack if selected. Is that correct?

Also, is there a quick list of which other apps will trigger a Webserver Stack to be installed?
personally, I’m interested in whether LinuxDash, PhpSysInfo, or phpMyAdmin are coded to trigger a webstack install?

I’m also curious if phpMyAdmin works with MariaDB? It’s my understanding that MariaDB is supposed to be a drop-in replacement for MySql, but I haven’t experimented with it yet.


P.S. I noticed that there isn’t a v109 posting in the Version History section.

thanks,
rob

Yup!

A few automated installations automatically install the LASP Stack.

In your Case:

LinuxDash installs LASP
PHPSysInfo installs LASP
phpMyAdmin doesn’t install any Stack but it requires MySQL to be preinstalled!

Maybe FourDee can do some Code Magic and instead of automatically installing LASP Stack, ask for what Stack should be installed while installing LinuxDash or PHPSysInfo or any other Package that automatically installs LASP Stack.

DietPiCam is the only piece of software where Apache or Nginx should be enforced…

thanks for the info…

you just saved me a couple re-imaging reboots and/or code combing tonight… :smiley:

instead, I’ll test phpMyAdmin with MariaDB. I’ve got to test if MySql gets installed automatically when you select phpMyAdmin, or if it just fails. I should also do some googling to see if MariaDB truly is a drop-in replacement.

thanks

Hi Rob,

Any software that requires a webserver will automatically have LASP installed. If the software also requires MySql, then LAMP is installed.

The current list of programs that will install LAMP/LASP are location here: DietPi/dietpi/dietpi-software at master · Fourdee/DietPi · GitHub

Having an option to choose between apache2/nginx/lighttpd stacks for the above software would be great. The only issue is the sheer amount of additional testing and coding for each program using all combinations of the stacks. Its a vast job.

We choose to stick with apache2 for simplicity reasons. Not just for the coding side, but also for the end user. An example of this is LetsEncrpt, which at the time of adding to DietPi only supported Apache2 stacks.
Also, most web based software tutorials and guide use Apache2 as the base, so this ensures the end user of DietPi (no matter their skill level) can follow the guide on their existing LAMP/LASP install.

The Lighttpd and Nginx stacks are there for advanced users who want an optimized installation and webserver stack. The user is then required to setup their website programs manually.

ps. Good spot on the release notes. Added to my “list of things to do”:slight_smile:

pps. MariaDB with phpymadmin. In theory it should work, both work in the same way, but i’ve not tried it yet.

Fourdee,
Thanks. that link was exactly what I needed. :slight_smile:


UPDATE:
on the Lighttpd/MariaDB/phpMyAdmin topic…
the short answer is yes… On my test Pi2, I’ve got Lighttpd, MariaDB and phpMyAdmin working together. There was a long of trial and error and “undoing that attempt” situations… so I’ve got to rebuild the machine again tonight and try again to see if I can accomplish the goal in 1 swoop that is automatable…

-rob

Excellent.

You can create a backup (system restore point) on your DietPi system. This will allow you to revert the root filesystem back to a previous state.

dietpi-backup

As an example:
When I do a fresh DietPi install for testing, once the basic installation process is completed (eg: nothing installed), I create a dietpi-backup before doing anything else.
Once I’ve finished “fiddling” and testing, i simply restore the previous backup. Means I dont need to rewrite the DietPi image :slight_smile:

NICE! I’ll read up on that.

Also… regarding Linux-Dash… I installed it manually the same way it’s coded in dietpi-software (DietPi/dietpi/dietpi-software at master · Fourdee/DietPi · GitHub)…
works perfectly.

UPDATE… same with phpSysInfo

Awesome.

Come to think of it, it’s only the web software that we install with apt-get that would be an issue for non-apache webstacks.
I know Owncloud is an apt-get (using opensuse repo), but I’ll have to look over the code for all of them to be sure.

here’s the patch for getting phpMyAdmin to work properly with Lighttpd and MySql or MariaDB…
basically 1 line to change on the debconf-set-selections and tweak the cgi.fix_pathinfo line of the php.ini

I’ve tested on my Pi2, but haven’t had a chance to steal the XU4 from the family yet…

--- dietpi/v109/dietpi-software 2016-02-21 21:30:25.637372620 -0500
+++ dietpi/v110/dietpi-software 2016-02-21 21:31:56.742372631 -0500
@@ -755,7 +755,11 @@
                        echo -e "phpmyadmin      phpmyadmin/password-confirm     password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/setup-password       password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/mysql/app-pass       password dietpi" | debconf-set-selections
-                       echo -e "phpmyadmin      phpmyadmin/reconfigure-webserver        multiselect     apache2" | debconf-set-selections
+                       if (( $WEBSERVER_LIGHTTPD > 0 )); then
+                               echo -e "phpmyadmin      phpmyadmin/reconfigure-webserver        multiselect     lighttpd" | debconf-set-selections
+                       else
+                               echo -e "phpmyadmin      phpmyadmin/reconfigure-webserver        multiselect     apache2" | debconf-set-selections
+                       fi
 
                        AGI phpmyadmin
 
@@ -2591,6 +2595,9 @@
                        if (( $WEBSERVER_NGINX == 2 )); then
                                ln -s /usr/share/phpmyadmin /var/www
                        fi
+                       if (( $WEBSERVER_LIGHTTPD == 2 )); then
+                               sed -i 's|\(^cgi.fix_pathinfo=\)0|\11|' /etc/php5/fpm/php.ini
+                       fi
 
                        WEBSERVER_MYADMINPHP=2
                fi

also, I’m sure the " if (( WEBSERVER_LIGHTTPD > 0 )); then" should be =1 or =2, but I wasn’t sure…

I’ve tested on my Pi2, but haven’t had a chance to steal the XU4 from the family yet…

This is a perfect chance to play the “I think we need another XU4” card :wink: Then explain everything possible the device can do. Works on my misses every time lol :slight_smile:

here’s the patch for getting phpMyAdmin to work properly with Lighttpd and MySql or MariaDB…

Nice one!

The values are:
0 = Not installed
1 = Selected for install
2 = Installed

The PHPmyadmin config section runs after lighttpd has finished installation, at which stage WEBSERVER_LIGHTTPD=2. So any of the following would work:

if (( $WEBSERVER_LIGHTTPD > 0 )); then
if (( $WEBSERVER_LIGHTTPD == 2 )); then

My XU4 is also busy doing other stuff. I cant see any issues cropping up on a device basis, but its worth a test.

I tried to patch dietpi-software last night, but it looks like I over simplified the logic or attempted too many changes at once… because it applied the LASP stack on the next reboot…

I’ll try again tonight.

argh… found my oversight… now I can’t wait to get home to verify… I’d have my wife swap out the cards, but she’s not home… ACK!

I’m pretty certain that all of these “default to LASP” packages can be added to the new if-block, but I have only tested DASH and PHPSYSINFO.

I found a PHP-FPM section further down in the code that was setting the cgi.fix_pathinfo=0, but this breaks phpMyAdmin. I couldn’t find any documentation to suggest why you set it to 0, so rather than add a specific WEBSERVER_LIGHTTPD test inside the WEBSERVER_MYADMINPHP block, i just set the original line equal to 1…

also, I found a potential bug in a couple of the debconf-set-selections lines of the phpMyAdmin install… per this doc: https://www.debian.org/releases/squeeze/i386/apbs03.html.en, there should only be 1 whitespace beteen and … any more and it is interpreted as part of the value. so, that’s fixed with this patch, as well.

--- dietpi/v109/dietpi-software 2016-02-23 13:48:59.470237319 -0500
+++ dietpi/v110/dietpi-software 2016-02-23 14:07:16.800237450 -0500
@@ -481,6 +481,16 @@
                #--------------------------------------------------------------
                # Apply all "combo" installs that require webserver stack

+               # - Installs that require at least 1 webserver stack
+               # -   If none set, then enable LASP stack
+               if (( $LINUXDASH == 1 || $PHPSYSINFO == 1 )); then
+                       if (( $WEBSERVER_LASP == 0 && $WEBSERVER_LAMP == 0 && $WEBSERVER_LAAP == 0 &&     \
+                             $WEBSERVER_LESP == 0 && $WEBSERVER_LEMP == 0 && $WEBSERVER_LEAP == 0 &&     \
+                             $WEBSERVER_LLSP == 0 && $WEBSERVER_LLMP == 0 && $WEBSERVER_LLAP == 0 )); then
+                               WEBSERVER_LASP=1
+                       fi
+               fi
+
                # - Installs that require WEBSERVER_LASP
                if (( $GRASSHOPPER == 1 )); then
                        WEBSERVER_LASP=1
@@ -488,12 +498,12 @@
                        WEBSERVER_LASP=1
                elif (( $RASPCONTROL == 1 )); then
                        WEBSERVER_LASP=1
-               elif (( $LINUXDASH == 1 )); then
-                       WEBSERVER_LASP=1
+#              elif (( $LINUXDASH == 1 )); then
+#                      WEBSERVER_LASP=1
                elif (( $PIHOLE == 1 )); then
                        WEBSERVER_LASP=1
-               elif (( $PHPSYSINFO == 1 )); then
-                       WEBSERVER_LASP=1
+#              elif (( $PHPSYSINFO == 1 )); then
+#                      WEBSERVER_LASP=1
                elif (( $PHPIMAGEGALLERY == 1 )); then
                        WEBSERVER_LASP=1
                fi
@@ -748,14 +758,18 @@
                        #Mysql must be running during install to allow debconf setup.
                        service mysql start &> /dev/null

-                       echo -e "phpmyadmin              phpmyadmin/dbconfig-install     boolean true" | debconf-set-selections
-                       echo -e "phpmyadmin      phpmyadmin/database-type        select  mysql" | debconf-set-selections
+                       echo -e "phpmyadmin      phpmyadmin/dbconfig-install      boolean true"   | debconf-set-selections
+                       echo -e "phpmyadmin      phpmyadmin/database-type          select mysql"  | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/app-password-confirm password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/mysql/admin-pass     password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/password-confirm     password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/setup-password       password dietpi" | debconf-set-selections
                        echo -e "phpmyadmin      phpmyadmin/mysql/app-pass       password dietpi" | debconf-set-selections
-                       echo -e "phpmyadmin      phpmyadmin/reconfigure-webserver        multiselect     apache2" | debconf-set-selections
+                       if (( $WEBSERVER_LIGHTTPD > 0 )); then
+                               echo -e "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd" | debconf-set-selections
+                       else
+                               echo -e "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"  | debconf-set-selections
+                       fi

                        AGI phpmyadmin

@@ -2478,7 +2492,7 @@
                                # - Php-FPM confs
                                cp /DietPi/dietpi/conf/php-fpm.conf /etc/php5/fpm/php-fpm.conf
                                cp /DietPi/dietpi/conf/php-fpm_pool.conf /etc/php5/fpm/pool.d/www.conf
-                               sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=0' /etc/php5/fpm/php.ini
+                               sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=1' /etc/php5/fpm/php.ini

                                # - PHP5-fpm optimizations based on total cores
                                sed -i "/pm.max_children = /c\pm.max_children = $CPU_CORES_TOTAL" /etc/php5/fpm/pool.d/www.conf

pretty sure that I found a good explanation (in the form of a question) of why you were setting cg.fix_pathinfo=0
here: http://serverfault.com/a/701500

But that explanation also explains how it’s not needed as of php5-fpm 5.3…
(I verified that 5.6.17 sets the security.limit_extensions by default)

security.limit_extensions = .php .php3 .php4 .php5

I cant honestly remember. I usually leave notes in the code, so its possible its not needed as you said.

Have you ever used GitHub before? I’am just curious as this would allow you to contribute to the DietPi code and it would give you full credit for any work you completed.
Here is the testing branch, you can create a fork of this, make the changes then send a pull request so I can accept the changes.

there should only be 1 whitespace beteen and … any more and it is interpreted as part of the value

Intresting. Seems to work currently, which would imply this isnt true? The extra whitespaces are only for my benefit to line up the code:


I’ve created a git ticket for the feature of allowing webserver stack choices: https://github.com/Fourdee/DietPi/issues/205
We should really take discussions to the Git ticket so everything can be tracked whilst working on it.