[OpenSUSE+PHP] Enable PHP for UserDir in OpenSUSE 12

Problem


in OpenSUSE you can easily enable user dir (user/public_html which maps to http://host/~user) but it was non-trivial how to enable PHP scripts within the public_html directory.


Solution


Default /etc/apache2/mod_userdir.conf for OpenSUSE looks like this:

<IfModule mod_userdir.c>
        UserDir disabled root
 

        <Directory /home/*/public_html>

                AllowOverride FileInfo AuthConfig Limit Indexes
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

                <Limit GET POST OPTIONS PROPFIND>
                        Order allow,deny
                        Allow from all
                </Limit>

                <LimitExcept GET POST OPTIONS PROPFIND>
                        Order deny,allow
                        Deny from all
                </LimitExcept>

        </Directory>

</IfModule>


To enable PHP just remove IncludesNoExec from the options list for the directory, i.e.

        Options MultiViews Indexes SymLinksIfOwnerMatch

No comments: