Results 1 to 6 of 6

Thread: PHP files download for fresh LAMP install

  1. #1

    Default PHP files download for fresh LAMP install

    Hi

    I've been working through the LAMP tutorial here:

    SDB:Linux Apache MySQL PHP - openSUSE

    I've installed the default "Web and LAMP Server" package as instructed and I'm falling down at the "Confirming PHP works" stage, with the PHP file downloading instead of running. As the guide instructs I've attempted adding a line to the /etc/apache2/mod_userdir.conf file, but to no avail. A little net surfing points me in so many directions that I just don't know where to look.

    Given that this is a new install under OpenSUSE 13.1, can I get some experienced views on where I go next?

    Thanks

    Stuart

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,645
    Blog Entries
    14

    Default Re: PHP files download for fresh LAMP install

    Hey Stuart,

    I guess you missed something: openSUSE's patterns.
    Start Yast - Software - Softwaremanager
    Go View - Patterns
    Check the box left of the LAMP server pattern. All packages needed will be installed.
    Next start Yast - System - Services, enable and start mysql
    Next Yast - Networkservices - HTTP server. Make it start en open ports in the firewall. Adjust configs or leave default first.
    Navigating to 127.0.0.1 should give "It works!".
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: PHP files download for fresh LAMP install

    Thanks Knurpht, but it hasn't helped. I'd already got as far as 'it works' successfully. I'd added the "web and LAMP server" pattern already, though this did not install all of the packages within (mainly the PostgreSQL stuff, but also a couple of the PHP extensions). I added in the lot and turned on MySQL in Service Manager for completeness, but no change.

    The apache2 server is clearly running - it just trying to download PHP files rather than execute them?

    Stuart

  4. #4
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,645
    Blog Entries
    14

    Default Re: PHP files download for fresh LAMP install

    First: php files are not executable, never. You open them in a browser, they interact with the webserver (which should have php compiled in, installing the LAMP server takes care of all that), or you use some commandline tool to process them.

    In the root folder of your webserver, mostly /srv/www/htdocs :
    remove / rename index.html (it contains the "It works!" html)
    create a file "testphp.php" containing:
    Code:
    <?php
    $msg = "Seeing this means php is working";
    echo $msg;
    ?>
    then use a browser and navigate to localhost/testphp

    If you don't see the $msg string displayed, check the settings in Yast - Networkservices - HTTP server, first screen after clicking "Next". "Enable PHP scripting" should be enabled.

    If you put in files manually in the webroot, make sure their permission are: wwwrun as the owner, www for the group.

    One remark: I can't see what other things you've done/added, so unless you tell exactly what you've done I can only state how the defaults should work.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  5. #5

    Default Re: PHP files download for fresh LAMP install

    I can't explain why, but it's decided to start working!

    I originally installed just the default packages in the "web and LAMP server" pattern, but was getting the problem of the browser trying to download when I went to localhost/~stuart/index.php. After adding the extra line to /etc/apache2/mod_userdir.conf and restarting the server as the tutorial suggested, there was no change.

    After I posted here, I re-checked the "web and LAMP server" pattern and installed all of the packages in there and also enabled MySQL in Services Manager - again no change, even after restarting the server (and the computer).

    I put the php script in "/srv/www/htdocs" as you suggested and it worked! Tried the same script in /home/stuart/public_html and this time it worked!

    As far as I know I followed the tutorial exactly (or as exactly as I could considering I'm running OpenSUSE 13.2 and the tutorial is for 11.1), and the only non-default change made was to add the line to /etc/apache2/mod_userdir.conf as described in the tutorial.

    Colour me confused (but happy that it's working).

    Thanks

    Stuart

  6. #6
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,645
    Blog Entries
    14

    Default Re: PHP files download for fresh LAMP install

    Nice to hear you've got it working now
    It looks like you were both missing some package(s) and forgot to tell us everything. By default the webserver uses /srv/www/htdocs. Yast can be used to configure differently.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

Posting Permissions

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