Results 1 to 10 of 10

Thread: How to enable PHP in Apache 2.2

  1. #1
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default 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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: How to enable PHP in Apache 2.2

    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.

  3. #3
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default Re: How to enable PHP in Apache 2.2

    Quote Originally Posted by ken_yap View Post
    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?

  4. #4
    Join Date
    Jun 2008
    Location
    Finland, European Union
    Posts
    1,879

    Default Re: How to enable PHP in Apache 2.2

    Quote Originally Posted by badger_fruit View Post
    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.

  5. #5
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default Re: How to enable PHP in Apache 2.2

    Quote Originally Posted by Chrysantine View Post
    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" ?!

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: How to enable PHP in Apache 2.2

    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.

  7. #7
    Join Date
    Jun 2008
    Location
    Finland, European Union
    Posts
    1,879

    Default Re: How to enable PHP in Apache 2.2

    Quote Originally Posted by badger_fruit View Post
    lol, i had to compile from source in order to get web-dav working!
    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*
    mod_dav.so mod_dav_fs.so mod_dav_lock.so

  8. #8
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default Re: How to enable PHP in Apache 2.2

    Quote Originally Posted by Chrysantine View Post
    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*
    mod_dav.so mod_dav_fs.so mod_dav_lock.so
    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

  9. #9
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default Re: How to enable PHP in Apache 2.2

    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

    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:
    #

    EOF

    cat <<EOF
    "

    PLEASE HELP!!!!!

  10. #10
    Join Date
    Jun 2008
    Location
    /earth/europe/uk/england/west-yorkshire/leeds/mystreet/myhouse
    Posts
    248

    Default Re: How to enable PHP in Apache 2.2

    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 ...

    Code:
    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:-
    1.
    Code:
    htdigest2 $acldir/$davdir $auth_realm  ${user:-user1}
    I changed this to
    Code:
    htdigest2 -c auth/mydavpwds mydav ausername
    2. from the section:-
    Code:
     <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
             </Location>
     </IfModule>
     </IfModule>
    I changed this to

    Code:
    <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
    		</Location>
    	</IfModule>
    </IfModule>
    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 ... ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •