Problem with php loading through browser

Hi guys,

Had similar problem with SUSE 11 because it was outdated, so I decided to try the same on my SUSE 12 box. So all I want to do is get dokuwiki on my server, but php has been giving me so much trouble lately. I installed apache, tested it with a few webpages, and that works. I tried to do the same with php, and it wont load through the browser.

I installed php by entering:

zypper install apache2-mod_php5
Refreshing service 'spacewalk'.
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 11 NEW packages are going to be installed:
  apache2-mod_php5 php5 php5-ctype php5-dom php5-iconv php5-json php5-pdo php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter

The following 8 recommended packages were automatically selected:
  php5-ctype php5-dom php5-iconv php5-json php5-sqlite php5-tokenizer php5-xmlreader php5-xmlwriter

11 new packages to install.
Overall download size: 3.4 MiB. Already cached: 0 B  After the operation, additional 20.0 MiB will be used.
Continue? [y/n/? shows all options] (y): u
Invalid answer 'u'. [y/n/? shows all options] (y): y
Retrieving package php5-5.5.14-42.2.x86_64                                                                                                (1/11),   1.5 MiB ( 10.0 MiB unpacked)
Retrieving: php5-5.5.14-42.2.x86_64.rpm ..................................................................................................................................[done]
Retrieving package php5-xmlwriter-5.5.14-42.2.x86_64                                                                                      (2/11),  52.1 KiB ( 51.0 KiB unpacked)
Retrieving: php5-xmlwriter-5.5.14-42.2.x86_64.rpm ........................................................................................................................[done]
Retrieving package php5-json-5.5.14-42.2.x86_64                                                                                           (3/11),  55.6 KiB ( 42.7 KiB unpacked)
Retrieving: php5-json-5.5.14-42.2.x86_64.rpm .............................................................................................................................[done]
Retrieving package php5-dom-5.5.14-42.2.x86_64                                                                                            (4/11),  90.6 KiB (184.2 KiB unpacked)
Retrieving: php5-dom-5.5.14-42.2.x86_64.rpm ..............................................................................................................................[done]
Retrieving package php5-tokenizer-5.5.14-42.2.x86_64                                                                                      (5/11),  46.3 KiB ( 18.5 KiB unpacked)
Retrieving: php5-tokenizer-5.5.14-42.2.x86_64.rpm ........................................................................................................................[done]
Retrieving package apache2-mod_php5-5.5.14-42.2.x86_64                                                                                    (6/11),   1.3 MiB (  9.4 MiB unpacked)
Retrieving: apache2-mod_php5-5.5.14-42.2.x86_64.rpm ......................................................................................................................[done]
Retrieving package php5-ctype-5.5.14-42.2.x86_64                                                                                          (7/11),  44.6 KiB ( 14.4 KiB unpacked)
Retrieving: php5-ctype-5.5.14-42.2.x86_64.rpm ............................................................................................................................[done]
Retrieving package php5-pdo-5.5.14-42.2.x86_64                                                                                            (8/11),  81.0 KiB (131.5 KiB unpacked)
Retrieving: php5-pdo-5.5.14-42.2.x86_64.rpm ..............................................................................................................................[done]
Retrieving package php5-iconv-5.5.14-42.2.x86_64                                                                                          (9/11),  56.2 KiB ( 42.9 KiB unpacked)
Retrieving: php5-iconv-5.5.14-42.2.x86_64.rpm ............................................................................................................................[done]
Retrieving package php5-xmlreader-5.5.14-42.2.x86_64                                                                                     (10/11),  51.1 KiB ( 35.0 KiB unpacked)
Retrieving: php5-xmlreader-5.5.14-42.2.x86_64.rpm ........................................................................................................................[done]
Retrieving package php5-sqlite-5.5.14-42.2.x86_64                                                                                        (11/11),  64.2 KiB ( 79.9 KiB unpacked)
Retrieving: php5-sqlite-5.5.14-42.2.x86_64.rpm ...........................................................................................................................[done]
Checking for file conflicts: .............................................................................................................................................[done]
( 1/11) Installing: php5-5.5.14-42.2 .....................................................................................................................................[done]
( 2/11) Installing: php5-xmlwriter-5.5.14-42.2 ...........................................................................................................................[done]
( 3/11) Installing: php5-json-5.5.14-42.2 ................................................................................................................................[done]
( 4/11) Installing: php5-dom-5.5.14-42.2 .................................................................................................................................[done]
( 5/11) Installing: php5-tokenizer-5.5.14-42.2 ...........................................................................................................................[done]
( 6/11) Installing: apache2-mod_php5-5.5.14-42.2 .........................................................................................................................[done]
( 7/11) Installing: php5-ctype-5.5.14-42.2 ...............................................................................................................................[done]
( 8/11) Installing: php5-pdo-5.5.14-42.2 .................................................................................................................................[done]
( 9/11) Installing: php5-iconv-5.5.14-42.2 ...............................................................................................................................[done]
(10/11) Installing: php5-xmlreader-5.5.14-42.2 ...........................................................................................................................[done]
(11/11) Installing: php5-sqlite-5.5.14-42.2 ..............................................................................................................................[done]

restarted apache2 as mentioned in the guide:

service apache2 restart

Then checked my php version:

php -v
PHP 5.5.14 (cli) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Then created info.php inside /srv/www/htdocs with the code:

<?php
phpinfo();
?>

Just to verify my php version which I verified earlier through the command line, and the file will not load through the browser when I call on it using http://myservername/info.php

PHP still will not load through my browser. Any idea on why this is happening?

Thanks in advance for youre help guys.

Hi KingGoon,

Just to verify my php version which I verified earlier through the command line, and the file will not load through the browser when I call on it using http://myservername/info.php

could you please b ea bit more specific on “will not load”? Empty page? HTTP error code? Or do you see the source code of the document?

In the latter case, have you verified the module is not only installed, but also activated in httpd’s configuration?

Regards,
Jens

PS: “as mentioned in the guide” - which guide is that?

Hi KingGoon,

just out of curiosity: Why did you post this in the “SLES Virtualization” section of the forum? You might get a broader audience in “Networking”, I 'd guess… “virtualization” is about problems running SLES as a virtualization host or as a guest on some virtualization platform…

Regards,
Jens

Hi jmozdzen,

I was not sure where exactly to post, since the forum titles were very vague to me personally.

As for calling on the file, as mentioned in my post earlier, the file requests to be downloaded, instead of just loading the php version through the browser when I call on it, as mentioned in this guide

I am not sure what you mean by it being activated in httpd’s configuration file? I followed the guide posted above, and it just said to install php, restart apache, and it should be running.

Thanks for youre help

Hi KingGoon,

I followed the guide posted above, and it just said to install php, restart apache, and it should be running.

Well, it also says it’s for OpenSUSE 13.1, so will probably work there. You’re using SLES 12, so https://www.suse.com/documentation/sles-12/book_sle_admin/data/cha_apache2.html might be more appropriate and https://www.suse.com/documentation/sles-12/book_sle_admin/data/sec_apache2_configuration.html#sec_apache2_configuration_yast is specific to your situation.

I am not sure what you mean by it being activated in httpd’s configuration file?

I wrote “configuration”, not “configuration file” :slight_smile: The formal way to activate PHP5 is via YaST, see my above links to the docs.

Modules need to be activated, not only installed. You could also do so by editing /etc/sysconfig/apache2 directly, and other ways, but I feel directing you to the admin interface may be easier for you.

Regards,
Jens

Hi Jens,

I searched both of those links and could not find anything that could help me with my php5 installation, only found material related to apache2, which I already have installed and working properly.

Also I used another guide which pretty much had the same directions for 13.1 or 12.1, and it is this guide. http://www.itzgeek.com/how-tos/linux/opensuse/install-apache2-with-php5-and-mysql-lamp-on-opensuse-12-1.html

I tried entering YaST into the command line, and my server does not recognize the command.

YaST
If 'YaST' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf YaST
cnf YaST
YaST: command not found   

Any further recommendations?

Hi KingGoon,

[QUOTE=KingGoon;31463]Hi Jens,

I searched both of those links and could not find anything that could help me with my php5 installation, only found material related to apache2, which I already have installed and working properly. [/QUOTE]

not from my POV: I believe you need to activate PHP5 support in Apache httpd2 - explicitly described in above docs . Hence my reference to the doc, describing exactly that (https://www.suse.com/documentation/sles-12/book_sle_admin/data/sec_apache2_configuration.html#sec_apache2_configuration_yast_server_configuration_modules, first line in the depicted module list…)

Again, OpenSUSE. Not SLES.

The command line invocation is via “yast” or “yast2”, all lower-case.

(I strongly suggest to read some basic SLES docs - it describes how to interact with the system’s shipped administration tools.)

Regards,
Jens

Awesome! Found an easier way to get it working. All i had to do was run

a2enmod php5

And php is successfully showing up! I made it ! :wink:

Thanks for you’re help Jens