Suse Apache and PHP Configuration

Configuring Apache with SSL and PHP on Suse Linux

There are some slight differences on configuring PHP and Apache on Suse.

Firstly of course you need to have installed the proper packages. At a minimum:

Callandor:/etc # 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

Callandor:/etc # rpm -qa | grep apache
apache2-2.2.10-2.5
apache2-utils-2.2.10-2.5
apache2-mod_php5-5.2.9-0.1.1
apache2-prefork-2.2.10-2.5

In Suse, the Apache modules to load are specified differently than in some other distros;

Note: You can now simply use a2enflag and a2enmod to enable modules in /etc/sysconfig/apache2

a2enmod ssl
a2enflag SSL
a2enmod php5

Verify modules in /etc/sysconfig/apache2

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"

Create a dummy SSL cert (Or create a self signed cert in the command line or via yast2-ca-management, and documentation here which is helpful for this):

/usr/bin/gensslcert

Now, create an SSL vhost.conf from the provided vhost-ssl.template

cd /etc/apache2/vhosts.d 
cp vhost-ssl.template ssl.conf
service apache2 restart

Verify the PHP module is loaded:

Callandor:/etc/apache2 # apache2ctl -M

<output omitted>
 php5_module (shared)

Verify SSL is working https://localhost

Also, the User and Group Apache runs as (normally set in httpd.conf) are in a separate file as well:

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

Reference Sites

Some good sites on Suse configurations, and for Apache and PHP in general:

http://opensuse.swerdna.org/suseapache.html

For more info on vhosts and SNI in Suse see:

http://doc.opensuse.org/documentation/html/openSUSE/opensuse-reference/cha.apache2.html#sec.apache2.ssl

For an example of using the yast2-http-server GUI method for Apache and vhost config see this site. NOTE: Using this will tend to destroy any manual configs you have made!

http://www.linuxtopia.org/online_books/opensuse_guides/opensuse11.1_reference_guide/sec_apache2_configuration.html

Looking for something?

Use the form below to search the wiki:

 

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!