Hello all, new to the forums but not overly new to openSUSE… Been following the LAMP how to guide located here: Linux Apache MySQL PHP Server (lamp - openSUSE and i have followed it to the letter yet i am unable to use PHP files, whenever i try to use a php file it offers me the chance to download rather then apache try to load it. I was wondering if anyone had any insight or help that they could offer thank you in advance
install apache php package
already have done
Enable the php5 module. Either:
a2enmod php5
or edit /etc/sysconfig/apache2 and add php5 to the list in APACHE_MODULES (the live line, not the comment line)
Then restart apache2
/etc/init.d/apache2 restart
are you placing your files in $HOME/public_html? if so, you need to enable php support in the /etc/apache2/mod_userdir.conf file. Add the below line inside the <Directory /home/*/public_html> stuff
Include /etc/apache2/conf.d/php5.conf
EDIT: and of course, whenever you change something to the apache configs, restart the server
unfortunatly i have tried the suggestions from both of you and neither seems to work
well, then you did something wrong. Works here with no problems at all. Also, do your php scripts begin with <? only? If so, you need to change them to <?php instead
Also, post your mod_userdir.conf file
all my scripts start with the full (<?php) tag.
UserDir: The name of the directory that is appended onto a user’s home
directory if a ~user request is received.
<IfModule mod_userdir.c>
Note that the name of the user directory (“public_html”) cannot easily be
changed here, since it is a compile time setting. The apache package
would have to be rebuilt. You could work around by deleting
/usr/sbin/suexec, but then all scripts from the directories would be
executed with the UID of the webserver.
To rebuild apache with another setting you need to change the
%userdir define in the spec file.
not every user’s directory should be visible:
UserDir disabled root
to enable UserDir only for a certain set of users, use this instead:
#UserDir disabled
#UserDir enabled user1 user2
the UserDir directive is actually used inside the virtual hosts, to
have more control
#UserDir public_html
<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>
Include /etc/apache2/conf.d/php5.conf
</Directory>
</IfModule>
Do
/usr/sbin/httpd2 -M
and see if php5 is on the list. If it isn’t you haven’t really enabled it.
You’ve placed the Include stuff in the wrong line That’s the correct way
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
**Include /etc/apache2/conf.d/php5.conf**
<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>
thank you it is working now kudos to you. Thank you to everyone who spent their time trying to give helpful suggestions
You’re welcome… now where’s my money??? rotfl!
Relevant section of the wiki updated
http://en.opensuse.org/Linux_Apache_MySQL_PHP_Server_(lamp)#Confirming_PHP_works