Results 1 to 6 of 6

Thread: Newbie - PHP files don't parse

  1. #1

    Question Newbie - PHP files don't parse

    Hi all,
    I'm new to linux and have default installation of Suse11.0
    I have put some php files in the location file:///srv/www/htdocs/ i.e index.php etc.
    When I point firefox to this location I get the message "You have chosen to open the file index.php which is a: PHP file from /srv/www/htdocs/ What should firefox do with this file (options open with Browse.../ Save file)"
    Obviously I want firefox to run the script and display the resulting page.
    The file permissions are set to "all read/write".
    What must I change??

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Newbie - PHP files don't parse

    Gaah, another one of those people who mindlessly chmod 777. Write permission is not needed on file served by a web server. Exceptions being upload areas and you are not dealing with that.

    These are the requirements for PHP files to be executed:

    Apache, natch.
    Apache PHP module
    Installed from OpenSUSE and not somewhere else if you want to avoid hassles
    Enable php5 in /etc/sysconfig/apache2
    Use <?php ?> instead of short tags <? ?>

    PHP doesn't come enabled out of the box, you have to do a few things yourself.

  3. #3

    Default Re: Newbie - PHP files don't parse

    Thanks for the reply.
    I have had a look at "/etc/sysconfig/apache2" but can't see which line has to be changed to enable php5. Most of the lines are commented out with ##.
    The only lies that mention php5 are not commented out.

  4. #4

    Default Re: Newbie - PHP files don't parse

    Can anyone explain the exact steps that I must do to get the apache server to run PHP files?

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Newbie - PHP files don't parse

    Install apache2-mod_php5.

    Add php5 to the variable APACHE_MODULES in /etc/sysconfig/apache2. Alternatively:

    Code:
    a2enmod php5
    Restart apache:

    Code:
    rcapache2 restart
    Try a simple script, /srv/www/htdocs/info.php:

    Code:
    <?php
    phpinfo();
    ?>

  6. #6

    Default Re: Newbie - PHP files don't parse

    Ok now it's working thanks

Posting Permissions

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