Apache2 not processing PHP5 in openSUSE 12.2

Attempting to set up a LAMP server. Installed the LAMP files from YaST patterns “Web and Lamp Server”.
Apache works. Apache also displays HTML files. Apache doesn’t process PHP5. The test code is as follows:

<html>
<head>
<title>PHP Test</title>
<body>
html works<br>
<?php
phpinfo();
?>
</body>
</html>


The result indicates “html works”. There is no display for phpinfo().

On Thu, 06 Dec 2012 23:46:02 +0000, Parthenolide wrote:

> Attempting to set up a LAMP server. Installed the LAMP files from YaST
> patterns “Web and Lamp Server”.
> Apache works. Apache also displays HTML files. Apache doesn’t process
> PHP5. The test code is as follows:

What configuration have you done beyond installation to enable PHP?

Jim

Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Good question. I didn’t know any configuration was required. Is there a guide?

On Fri, 07 Dec 2012 01:26:01 +0000, Parthenolide wrote:

> Good question. I didn’t know any configuration was required. Is there a
> guide?

A quick google turned up this:

http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-
on-opensuse-11.2-lamp

It’s for 11.2 but the principles should be very similar, as apache and php
haven’t changed much. :slight_smile:

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

The link wasn’t all that helpful.
I tried the following link: https://en.opensuse.org/SDB:Linux_Apache_MySQL_PHP
Again, not all that helpful.

#ls /etc/apache2
There is no mod_php.conf file. Looking through httpd.conf, there also is no include statement for PHP. My guess is that this is the problem. However, none of the on-line guides discuss this. Any help would appreciated.

On Tue 11 Dec 2012 10:56:01 PM CST, Parthenolide wrote:

The link wasn’t all that helpful.
I tried the following link:
SDB:Linux Apache MySQL PHP - openSUSE Wiki
Again, not all that helpful.

#ls /etc/apache2
There is no mod_php.conf file. Looking through httpd.conf, there also
is no include statement for PHP. My guess is that this is the problem.
However, none of the on-line guides discuss this. Any help would
appreciated.

Hi
Use fgrep…


cd /etc/apache2
fgrep -r php *

conf.d/php5.conf:<IfModule mod_php5.c>
conf.d/php5.conf:           SetHandler application/x-httpd-php
conf.d/php5.conf:       <FilesMatch "\.php[345]?s$">
conf.d/php5.conf:           SetHandler application/x-httpd-php-source
conf.d/php5.conf:        DirectoryIndex index.php4
conf.d/php5.conf:        DirectoryIndex index.php5
conf.d/php5.conf:        DirectoryIndex index.php
httpd.conf:#  |   |-- mod_php4.conf . . . . . . . . . .  (example) conf that comes with apache2-mod_php4
mime.types:application/x-php php php3 php4
sysconfig.d/loadmodule.conf:LoadModule php5_module                    /usr/lib/apache2/mod_php5.so
vhosts.d/vhost.template:    # Include /etc/apache2/conf.d/mod_php4.conf
vhosts.d/vhost-ssl.template:	<Files ~"\.(cgi|shtml|phtml|php3?)$">

So if it’s not in the sysconfig.d file to load…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.11-2.16-desktop
up 2:12, 3 users, load average: 2.32, 2.11, 1.53
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

here is the result of
cd /etc/apache2
fgrep -r php *

conf.d/php5.conf:<IfModule mod_php5.c>
conf.d/php5.conf: SetHandler application/x-httpd-php
conf.d/php5.conf: <FilesMatch “.php[345]?s$”>
conf.d/php5.conf: SetHandler application/x-httpd-php-source
conf.d/php5.conf: DirectoryIndex index.php4
conf.d/php5.conf: DirectoryIndex index.php5
conf.d/php5.conf: DirectoryIndex index.php
default-vhost.conf: # Include /etc/apache2/conf.d/mod_php4.conf
default-vhost-ssl.conf: <FilesMatch “.(cgi|shtml|phtml|php)$”>
httpd.conf:# | |-- mod_php4.conf . . . . . . . . . . (example) conf that comes with apache2-mod_php4
mime.types:application/x-php php php3 php4
sysconfig.d/loadmodule.conf:LoadModule php5_module /usr/lib64/apache2/mod_php5.so
vhosts.d/vhost-ssl.template: <FilesMatch “.(cgi|shtml|phtml|php)$”>
vhosts.d/vhost.template: # Include /etc/apache2/conf.d/php5.conf


It looks like I have two more lines

Hi
So the module should be loaded, do you see php5_module (shared) in the output from;


apache2ctl -M

If not, check in YaST -> /etc/sysconfig editor under Network->WWW->Apache2 APACHE_MODULES php5 is in the list?

Thanks for the help Malcolm.
Here is the output from running the suggested code.

linux-xxx:/etc/apache2 # apache2ctl -M
httpd2: apr_sockaddr_info_get() failed for linux-t6xe
httpd2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
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)
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)
userdir_module (shared)
php5_module (shared)
reqtimeout_module (shared)
Syntax OK

Here is the html test page

<html>
<head>
<title>PHP Test</title>
<body>
html works<br>
<?php
phpinfo();
?>
</body>
</html>


It displays “html works”, and nothing else.

Any help would be appreciated.

Hi
Strange indeed, not sure if the error you see about the FQDN is causing an issue… any reason not to correct that?

Are you running vhosts?

Your test page works fine here on my server… assuming it’s being saved as somename.php.

Oops. The file was labeled index.html. It worked once I renamed it to index.php.

On Thu 13 Dec 2012 05:36:01 PM CST, Parthenolide wrote:

Oops. The file was labeled index.html. It worked once I renamed it to
index.php.

Ahhh Haaah :wink: File extensions seem to be important… :slight_smile:

So are you planning to expose this server to the internet?

If so (and since your running php) I would suggest setting up something
like awstats to monitor, and a very important thing, move or remove any
setup files used by php, mysql etc from anything in the web root they
are prime for attack from hackers…

Read up on web security and locking things down…

And remember to have a lot of fun…


Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.11-2.16-desktop
up 1 day 17:22, 3 users, load average: 0.16, 0.15, 0.23
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

I’m trying to get zabbix installed using OpenSuse 12.3 and I’m running into a install problem:
https://www.zabbix.com/forum/showthread.php?t=26871
which leads me to this topic. So also I tested this simple html page and got the very same experiance, i.e. phpinfo() not processed and the Apache2 php5 module is installed.