Getting apache2-mod_php5 Working - some missing magic?

So, I am a bit baffled on what magic you need to do to get PHP working with Apace on Suse. This is normally extremely simple on CentOS, but I seem to be missing something here.

PHP is installed and php scripts run fine in cli mode - but Apache refuses to show them, it just opens the download popup - and does not actually parse the php. But for the life of me I can see no reason why it should not.

My environment is:

Installed PHP rpms

Callandor:/etc/apache2 # rpm -qa | grep php
php5-5.2.9-0.1.1
apache2-mod_php5-5.2.9-0.1.1
php5-mysql-5.2.9-0.1.1

Apache loads the php module:

Callandor:/etc/apache2 # apache2ctl -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_default_module (shared)
 authz_user_module (shared)
 authn_dbm_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 include_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 suexec_module (shared)
 userdir_module (shared)
 php5_module (shared)

Module is specified to load here:

Callandor:/etc/apache2 # cat /etc/sysconfig/apache2 | grep APACHE_MODULES
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5"

Permissions look okay on document root:

Callandor:/etc/apache2 # ls -l /srv/www/
total 8
drwxr-xr-x 2 root root 4096 Dec  3  2008 cgi-bin
drwxr-xr-x 4 root www  4096 Aug 28 23:00 htdocs

User and Group for Apache are

Callandor:/etc/apache2 # cat uid.conf
User wwwrun
Group www

Perhaps I am missing something obvious, but I sure am not seeing it.

Thanks for any input you can give.
Lews Therin

Are you using short tags by any chance? <? ?>

You should use <?php ?>

Hi Ken,

That was a good idea - but no, I am not using short tags. I copied my script to one with the same permissions, but with .PHP and it worked. Then the lowercase .php subsequently worked too. Ummm . . . I have nothing. But its working now, thank you.

Lews Therin

Yeah that’s what I figured. The scripts should end in .php, or Apache doesn’t know that it’s supposed to run them through the PHP interpreter.

The really weird thing though was that the original script did end in .php, but it just would not run at fist. Maybe just a browser refresh thing or something. Ug - so simple.

Thanks Ken.

Lews Therin