Apache does not run PHP pages

Hi,

I have installed SuSE on Amazon Web Services.

When I try and access a PHP file, it downloads instead of running the script / loading the page. I have tried running PHP scripts from the command line and this works OK. The issue is limited to pages served by Apache2. I’ve tried removing Apache2 and reinstalling Apache2 with PHP 5.3

I have tried…

<?
phpinfo();
?>

and checked that…

short_open_tag = On

…in php.ini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You need to tell Apache to parse files ending in .php with the PHP
module. The PHP documentation covers this, and one example shows this:

<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>

http://www.php.net/manual/en/install.unix.apache2.php

You may also need to load the module for PHP, but I think SUSE does that
automatically as long as you have the RPMs installed properly… I
think. If not, something like:

LoadModule php5_module modules/libphp5.so

Good luck.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQouEgAAoJEF+XTK08PnB5H6UQALhvwxOy9JoJ5iUn/qbPVsUs
ONKpZmYMbQb4zKEJf06KaqWqHgRutq6xNKA+Pr/XpeiX8TB3BViI7UGzZ6sL/2D7
zEDDcPE/pY27gJMuSh43mLWNXF+5B51gW5OEiTqBLJKvW9pvO/M32PnaDOPHU396
b9xmxxAlQIDOuBV1YAUtWcnS1TUyHdpTm+y0fdoUG0d5Xc9Z3UyMkRfhOvijZ2rW
Vo8OHIHgs8YJCySNyB+Y15JRcx1AlHqtsDjHTgV8DAPrkVA/6tvgiS6yk76tlN6r
JnvRcLzBVir61gGAmlZTnalQRuWpHSVjBr0+YZ7zqO9LbF9AM31BNwWlUBafD8bG
RFz8QX7NmTo+wW91iROKUNO2BBWAwbQCqTF8ceL0DouBN7vMuwWQDqBromvPqzn8
E5HpPSmukGeia4Zhb8sNafAuuY1f2gUondK6OsLaKZG2K1eVK9HpO0n5KLSZurT2
5r89pa0UAvzCKEFvL/XTRC+D7a/JVLF6DGAl7GNhKcpM/fz9d0r0Nbl0/Zc3Ygz7
2HAzLlNRDcgD6PC2ipwbAqkjwm08ww+qSfZtaSgTs0krbuPOJ1oB0G6+tyZJCJ9h
7dYflyBq0WZt6WocTsIlooImyBXhx7T0/I3I0T5MNxGdfLSOxunCH5XlhXDWpIT7
pum1Sa4XgtA69WS4PT6H
=WGwZ
-----END PGP SIGNATURE-----

You did get an answer already, but I am not sure that you are at the correct place at all. You talk about having SuSE without any further specification (which makes all sorts of answering in any case a bit of a guess). But there is no SuSE for years. The forums here are about openSUSE. There is also SUSE LInux Enterprise (SLED/SLED), but hthey have different forum.

Can you please state what openrating system you have, including it’s version? That would help your potential helpers not to poke around in the dark (or even skipping your question at all).

Hi,

Thank you for your responses. The version I am using is suse-sles-11-sp2-v1.00.x86_64 as used in Amazon EC2. As you correctly identify, it is not OpenSuSE. Following some other issues and some advice by others, I have terminated this instance and I have have found an AMI of OpenSuSE 12.2 v4 by SUSE Studio, which I am currently installing and await a result.

Many thanks,

Jason

While waiting, you could try to get used to the real name of your new operating system: openSUSE.
Else people will again wonder about what you realy use.

And also be aware that many people here simply have the plain vanilla openSUSE 12.2 and not one from SUSE Studio. Thus when you come with any questions, it is up to you to explain where your version differs from what most here have. Else I foresee a lot of misunderstanding.

I had the same problem. The solution for me was to set (uncomment)
short_open_tag = On

in these two files
/etc/php5/apache2/php.ini

/etc/php5/cli/php.ini
and restart apache2 on my openSUSE 12.2

The change would only be needed in /etc/php5/apache2/php.ini, that’s the config for the apache module. The other one is only used if you run a php script on the command line by typing f.e.:

php *myscript.php*

And if you don’t set “short_open_tag = on”, your php statements have to be enclosed in php tags like this:

<?php
phpinfo();
?>