Apache not parsing PHP files

I just had a confusing problem: instead of interpreting PHP-scripts in our webserver’s userdir apache serves them for download!

It’s caused by an upgrade from lenny to squeeze and I spend a lot of ours with fixing.

This is really a serious problem, these sites aren’t able to read for those people/search engines etc. that are browsing and, more fatal, if clients are able to access the PHP code of our students/staff they might explore security issues or passwords stored in these PHP files, so first of all I disabled the public access to the webserver.

So what was the problem? When I recognized that phpMyAdmin and other not userdir related stuff still works fine, I searched for issues that differ for userdirs. At long last I took a look into the libapache2-mod-php5 config file located in /etc/apache2/mods-available/php5.conf :

<IfModule mod_php5.c>
    <FilesMatch "\\.ph(p3?|tml)$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>

As you can see, PHP is disabled if the userdir module was enabled… Disgusting! Commenting these lines out switched PHP for users on. Very annoying!

It's squeeezzed

Yes, Debian’s 6th release, codename squeeze, has become stable yesterday!

Those of you following Debian on twitter should have noticed yet, they announced it in about 4 million tweets ;-)

To mark the occasion the also redesigned the whole web presence, just take a look at their new layout!

This article is just a small THANK YOU to the whole Debian team, they are working hard to make your life much more comfortable! Great work guys!

By the way I send some greetings to all the administrators out there running Debian. Just have a look at figure 1 :-P

X deletes input devices

Today I restarted my notebook to boot into another kernel. Unfortunately I couldn’t log-in to the desktop because neither the mouse nor the keyboard was working. The Xorg.log gave me a hint what happened.

That all affected my GRML installation. Unfortunately you can’t change to a virtual terminal while there is no keyboard control, so to change anything you have to connect via SSH or boot from live CD or USB. The error reported in /var/log/Xorg.0.log looks like:

(WW) AllowEmptyInput is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
(WW) Disabling Mouse0
(WW) Disabling Keyboard0

So you see, all input device are turned off. Annoying!! To avoid this problem you have to add the following section to your /etc/X11/xorg.conf :

Section "ServerFlags"
        Option "AutoAddDevices" "False"
        Option "AllowEmptyInput" "false" 
EndSection

That should solve the problem. If you don’t have a xorg.conf yet you can create one with:

Xorg -configure

This will create /root/xorg.conf.new , so you just have to copy it to /etc/X11/xorg.conf .

Since it was the first reboot for about 30 days and I updated/installed a lot of new software, so I’m not able to blame anyone generating this bug. But if you are feel free to do so ;-)

Alternative to vzprocps

As far as I know the OpenVZ associated vzprocps-tools are just available in version 2.0.11, at least for Debian. Unfortunately they are damn buggy in this version, so unusable…

There are two smart tools included in vzprocps : vztop and vzps . These programs help you a lot dealing with processes of your running containers. But in 2.0.11 they aren’t working:

root@serv: ~ $ vzps
Segmentation fault
root@serv: ~ $ vztop
 00:29:11  up 1 day,  5:18,  3 users,  load average: 1.14, 1.26, 1.23
1949 processes: 1946 sleeping, 2 running, 1 zombie, 0 stopped
CPU0 states:   0.1% user   0.1% system    0.0% nice   0.0% iowait  98.0% idle
CPU1 states:   4.1% user  15.0% system    0.0% nice   0.0% iowait  80.0% idle
CPU2 states:   2.0% user   3.0% system    0.0% nice   0.0% iowait  94.0% idle
CPU3 states:  14.0% user  20.1% system    0.0% nice   0.0% iowait  64.1% idle
Segmentation fault
root@serv: ~ $

It seems that there is an update, but not available as .deb yet. Here is an example for an alternative to vzps to find zombies:

CONTAINER=$(/usr/sbin/vzlist | /bin/grep running | /usr/bin/awk '{print $5}')
for ct in $CONTAINER;
do
	echo "processing: $ct";
	/usr/sbin/vzctl exec $ct '/bin/ps -ef | /bin/grep defunct';
done

It’s a bit complicated, but you can write a small script to grep for further things..



Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!