Php doesn't work after installation

i was trying to install php on Leap 42.2. I was following the instructions from this webside:

apache2 works just fine, and I have access to .html files from public_html folder, but when I try to open*kon *in a browser, when public_html contins only index.php file, I get something like this:

Index of /~kon Name Last modified size= Description[HR][/HR] Parent Directory - index.php 2017-10-01 15:36 23

where is my mistake? I already add the phrase in mod_userdir.conf file.
I will appreciate any help. [/size]

You should make sure you’ve installed and enabled PHP properly - make sure the PHP module for apache is installed: apache2-mod_php5 or apache2-mod_php7 depending on what you need.

  1. Then make sure Apache is loading the module; sudo a2enmod php5 or sudo a2enmod php7 once again depending on what PHP you are using.
  2. Make sure Apache2 is restarted; sudo systemctl restart apache2

No further editing should be needed and index.php should be parsed in the users home directory as expected.

To my eye…
The SDB you’re following is so far out of date that a lot of what is in it is likely questionable…
Aside from the init commands instead of sytemd… and only regarding the Apache and PHP parts (I didn’t look at the MySQL part)

  1. I wasn’t aware that Apache supports a website at that specified location by default (it should be /srv/www/htdocs/). In any case you should configure your Apache webserver to support websites using the YaST apache web server configuration module. Install it using the following command (or use YaST Software Manager)
zypper in yast2-html-server
  1. Unlike the instructions in the SDB you reference, I create a phpinfo.php page with the php code, then access the page with


After a test I just ran on a 42.2 machine, it looks like the PHP installation is broken, Apache does not seem to recognize the php code on my machine and offers to download the file instead of executing. Didn’t look into this further for now (no time immediately, maybe someone else can pick up this thread).


The following SDB PHP should work which describes what I posted earlier (plus, you should enable PHP with a2enmod).


Will need to dig deeper to figure out why the PHP module isn’t working, though…


Thank you for your fast anserws!!!

After I enable the php using a2enmod, everything works fine. Sory for the problem!

Thank you Miuku and thank you tsu2 for the additional information!

Glad to hear it worked out for you!

Now, I can look for my own problem… :slight_smile: