Results 1 to 6 of 6

Thread: Php doesn't work after installation

  1. #1
    Join Date
    Oct 2017
    Posts
    11

    Default Php doesn't work after installation

    Hi,
    i was trying to install php on Leap 42.2. I was following the instructions from this webside:
    https://en.opensuse.org/SDB:Linux_Ap...P#Introduction

    apache2 works just fine, and I have access to .html files from public_html folder, but when I try to open http://127.0.0.1/~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
    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.

  2. #2
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,004

    Default Re: Php doesn't work after installation

    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.
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,937
    Blog Entries
    2

    Default Re: Php doesn't work after installation

    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)
    Code:
    zypper in yast2-html-server
    2. Unlike the instructions in the SDB you reference, I create a phpinfo.php page with the php code, then access the page with

    http://localhost/phpinfo.php

    But,
    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).

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,937
    Blog Entries
    2

    Default Re: Php doesn't work after installation

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

    SDB:LAMP_setup
    https://en.opensuse.org/SDB:LAMP_setup

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

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  5. #5
    Join Date
    Oct 2017
    Posts
    11

    Default Re: Php doesn't work after installation

    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!

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,937
    Blog Entries
    2

    Default Re: Php doesn't work after installation

    Quote Originally Posted by kon View Post
    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...

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •