Hi all,
I’m new to linux and have default installation of Suse11.0
I have put some php files in the location file:///srv/www/htdocs/ i.e index.php etc.
When I point firefox to this location I get the message “You have chosen to open the file index.php which is a: PHP file from /srv/www/htdocs/ What should firefox do with this file (options open with Browse…/ Save file)”
Obviously I want firefox to run the script and display the resulting page.
The file permissions are set to “all read/write”.
What must I change??
Gaah, another one of those people who mindlessly chmod 777. >:( Write permission is not needed on file served by a web server. Exceptions being upload areas and you are not dealing with that.
These are the requirements for PHP files to be executed:
Apache, natch.
Apache PHP module
Installed from OpenSUSE and not somewhere else if you want to avoid hassles
Enable php5 in /etc/sysconfig/apache2
Use <?php ?> instead of short tags <? ?>
PHP doesn’t come enabled out of the box, you have to do a few things yourself.
Thanks for the reply.
I have had a look at “/etc/sysconfig/apache2” but can’t see which line has to be changed to enable php5. Most of the lines are commented out with ##.
The only lies that mention php5 are not commented out.
Can anyone explain the exact steps that I must do to get the apache server to run PHP files?
Install apache2-mod_php5.
Add php5 to the variable APACHE_MODULES in /etc/sysconfig/apache2. Alternatively:
a2enmod php5
Restart apache:
rcapache2 restart
Try a simple script, /srv/www/htdocs/info.php:
<?php
phpinfo();
?>
Ok now it’s working
thanks lol!