Results 1 to 9 of 9

Thread: PHP file gets downloaded when I browse in any of my browser

  1. #1

    Default PHP file gets downloaded when I browse in any of my browser

    I followed the following step given on an openSuSE site but I am still encountering the same problem i.e. a phpinfo.php file gets downloaded when I browse it in my browser.

    In case the browser wants to save your php files instead of displaying the content, you should enable php support in the /etc/apache2/mod_userdir.conf file. Add the following line to it, just after the <Directory /home/*/public_html> line and restart the server.

    Include /etc/apache2/conf.d/php5.conf
    phpinfo.php
    Code:
    <?
    phpinfo();
    ?>
    Also, I restarted apache using following command but it din solve the problem either.
    # rcapache2 restart

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,114

    Default Re: PHP file gets downloaded when I browse in any of my browser

    The short tag
    Code:
    <?
    is long depricated. Use
    Code:
    <?php
    instead.
    Henk van Velden

  3. #3

    Default Re: PHP file gets downloaded when I browse in any of my browser

    Sorry that was a typo. I tried it with following but same problem is occuring.

    <?php
    phpinfo();
    ?>
    Quote Originally Posted by hcvv View Post
    The short tag
    Code:
    <?
    is long depricated. Use
    Code:
    <?php
    instead.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,114

    Default Re: PHP file gets downloaded when I browse in any of my browser

    From your adding a line to mod_userdir.conf, I guess that you serve from the public_html directory in the home directories of your users and not from /srv (would have been nice you explained this). I also guess that the file you get served as text is in such a public_html directory.

    I am in doubt if adding this line in that place is correct. I am serving from /srv/www/htdocs and some other directories, but not from users. In my default-server.conf all files in conf.d/ are included automaticaly. Thus, if you have the mod_php5 module installed, this is allready done without any further action.
    Henk van Velden

  5. #5

    Default Re: PHP file gets downloaded when I browse in any of my browser

    Sorry for not explaining that earlier. I am also serving from /srv/www/htdocs. I have removed the public_html line from mod_userdir.conf. I added it just because it was mentioned in a forum as a solution to the problem i am facing.

    But I am still facing the same problem even after removing that line and restart apache.

  6. #6
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,114

    Default Re: PHP file gets downloaded when I browse in any of my browser

    But do you have /etc/apache2/conf.d/php5.conf? And is the package apache2-phpp_mod5 installed? I gave you a lot of points to check and to report about, but we do not get anything back.

    And that test file, is it now in /srv/www/htdocs or elsewhere? Do not less us guess so many things. Take the trouble to type, to post configuration files (within CODE tags), in short you should tell as much as possible.
    Henk van Velden

  7. #7
    Join Date
    Mar 2009
    Location
    sri mayapur, west bengal, india
    Posts
    958

    Default Re: PHP file gets downloaded when I browse in any of my browser

    On Mon, 04 Jul 2011 01:06:02 +0530, usmanajml
    <usmanajml@no-mx.forums.opensuse.org> wrote:

    >
    > Sorry for not explaining that earlier. I am also serving from
    > /srv/www/htdocs. I have removed the public_html line from
    > mod_userdir.conf. I added it just because it was mentioned in a forum as
    > a solution to the problem i am facing.
    >
    > But I am still facing the same problem even after removing that line
    > and restart apache.
    >



    you said you followed some advice from an openSUSE forum, if i remember
    correctly. you didn't say how you installed apache2 & php5 though. to make
    sure you actually have the necessary packages installed, you could run
    from a terminal as root:

    rpm -qa | grep .*php.*

    that should result in a list of installed packages that have "php" in
    their name. for php to work via apache, these modules have to be among
    them: php5 and apache2-mod_php5.

    if installed via yast or zypper, on a recent openSUSE release, you'll have
    to enable php5 in /etc/sysconfig/apache2.

    that's a text file with a lot of commented-out examples. the important
    line starts with "APACHE_MODULES=", without "#" in front. That line has to
    include "php5" somewhere, for apache to handle php files.


    --
    phani.

  8. #8

    Default Re: PHP file gets downloaded when I browse in any of my browser

    @Phani
    Thanks phani, I had to just put in php5 in /ets/sysconfig/apache2. info.php is loading fine now.

  9. #9

    Default Re: PHP file gets downloaded when I browse in any of my browser



    PHP file gets downloaded when I browse in any of my browser

    couldnot find php support in the /etc/apache2/mod_userdir.conf file.

Tags for this Thread

Posting Permissions

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