How to enable PHP in Apache 2.2

I’ve read the apache docs and can’t seem to find anything saying how to get PHP “enabled”

Eg I have a file.php but when I browse to it, i just get the source-code instead of the wonderful “hello world” i was expecting lol

It’s an optional apache module. Install the apache2-mod_php5 package and any dependencies it pulls in, then add php5 to the /etc/sysconfig/apache2 setting: APACHE_MODULES, then reload apache2.

Thanks Ken, question: I installed apache2 from source, would I still use the above procedure, or would i need to re-compile with a --with-xyz option?

Why, why, why in gods name do new people always compile things from source.

You do not compile from sources on an RPM distribution because it’ll break things - badly.

lol, i had to compile from source in order to get web-dav working!
and what do you mean “new people” ?!

webdav has been part of the core functionality since 2.0 I think. You didn’t have to compile anything. If you roll your own, all the sysconfig stuff don’t apply and you are on your own.

DAV has been part of the Core package since the dark ages - it’s included with the distro itself as a module in the Apache2 package by default.

/usr/lib/apache2> ls dav

well bugger me
ok, so what you’re saying is “badger, you’re a complete NOOB, don’t ever try to do anything yourself again, you bad bad boy”?

cos i think i agree hehe!!
ok, ill un-install, whack on apache from yast2 instead and try again :wink:

Well, so far, everything has gone OK with the RPM install, PHP is working, my photo-album works and so on.

The only problem now is Webdav does not work!
Well, I’m not sure if it’s that, or the Digest authentication. Basically, I try to browse to the Dav folder and the username/password prompt appears as expected but whatever I try, does not work!!

I also downloaded an application called Litmus (which tests dav), provide the credentials and it fails with a 401 authentication error :frowning:

Is there anyone who can help a poor, confused badger noob?

To create the username/password, I used
htdigest2 -c /srv/www/dav/passwordfile dav wwwuser

the folders are:-

**bgrsvrx:/srv/www # ls -l
total 44
-rw-r–r-- 1 root root 588 Jul 28 11:08 401error.html
-rw-r–r-- 1 root root 570 Jul 28 10:55 403error.html
-rw-r–r-- 1 root root 636 Jul 28 11:08 404error.html
-rw-r–r-- 1 root root 580 Jul 28 11:09 500error.html
drwxr-xr-x 5 badger_fruit users 4096 Jul 28 17:01 album
drwxr-xr-x 2 root root 4096 Mar 29 22:58 cgi-bin
drwxrwx— 4 root www 4096 Jul 29 09:57 dav
-rw-r–r-- 1 root root 604 Jul 24 13:48 error.html
drwxr-xr-x 3 root root 4096 Mar 29 21:26 htdocs
-rw-r–r-- 1 root root 1313 Jul 28 20:08 index.html
drwxr-xr-x 2 root root 4096 Jul 28 17:00 php
bgrsvrx:/srv/www #

I found a guide Apache Howto WebDAV - openSUSE which I tried to follow but it lost me at " cat <<EOF

Put this into /etc/apache2/conf.d/$davdir.conf:


cat <<EOF


WOO YEAH! I have FINALLY sorted it out … how exactly, I am not sure but thanks to the /var/log/apache/error_log I saw that the realm was incorrect …

Digest: user `ausername' in realm `private area' not found: /mydav/

Actions taken:-
Removed the DAV and AUTH folders and followed the instructions I found earlier at Apache Howto WebDAV - openSUSE

There were a few other small changes though:-

htdigest2 $acldir/$davdir $auth_realm  ${user:-user1}

I changed this to

htdigest2 **-c** auth/mydavpwds mydav ausername
  1. from the section:-
 <IfModule mod_dav.c>
 <IfModule mod_dav_fs.c>
         Alias /$davdir /srv/www/$davdir
         <Location /$davdir>
                 DAV On
                 #ForceType text/plain
                 Order Deny,Allow
                 Deny from all
                 AuthType Digest
                 AuthName "private area"
                 AuthDigestFile /srv/www/ACL/$davdir
                 AuthDigestDomain /$davdir/
                 AuthName $auth_realm
                 Require valid-user
                 Satisfy Any

I changed this to

<IfModule mod_dav.c>
	<IfModule mod_dav_fs.c>
		Alias /mydav /srv/www/mydav
		<Location /mydav>
			DAV On
			AuthType Digest
			AuthName dav
 			AuthUserFile /srv/www/auth/mydavpwds
			AuthDigestDomain /mydav/
			Require user ausername

I then chown wwwrun:www all the files in mydav folder, restarted Sunbird and pointed to the dav/Cal.ics file and BINGO, it worked!!

Browsed to the http://…/dav/ via FF and received the username/password prompt, entered them and bish bash bosh, directory listing as expected!!

sigh perhaps I can actually get to sleep tonight … ?