Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: php scripts not processed by browser on 12.04.1

  1. #1
    Join Date
    Aug 2012
    Beans
    19

    php scripts not processed by browser on 12.04.1

    I am running Ubuntu 12.04.1 and trying to get a php script to work within the browser. I am not very experienced with these things, and searching the issue on the net brought no real clue what I am missing. If, for any reason, this problem is nor well described or belongs to another forum, please let me know!

    On the system I seem to have apache2 running, the file /etc/apache2/httpd.conf is empty, and a httpd service does not seem to exist. What do I need to check/enable/install to be able to get a php script interpreted by the browser (current firefox).

  2. #2
    Join Date
    Apr 2012
    Location
    Detroit, MI USA
    Beans
    32
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: php scripts not processed by browser on 12.04.1

    Hey Alex,

    On Ubuntu, things are in different locations that say CentOS. The service name for Apache is apache2, you can test to see if it is running by using the following command:

    Code:
    service apache2 status
    Did you install services on this server? Did you install PHP? Examples may be helpful also.

  3. #3
    Join Date
    Aug 2012
    Beans
    19

    Re: php scripts not processed by browser on 12.04.1

    Here is the requested output:

    Code:
    service apache2 status
    Apache2 is running (pid 7197).
    Here is the test file (located in /var/www - do I have to store the php file there or can I store it anywhere?):

    Code:
    <html>
    <body>
    
    <?php
    echo "Hello World<br>";
    echo $_SERVER['HTTP_USER_AGENT'];
    phpinfo();
    ?>
    
    </body>
    </html>
    and the command

    Code:
    php5 -r 'phpinfo();'
    gives a lot of output.

  4. #4
    Join Date
    Jan 2009
    Beans
    20

    Re: php scripts not processed by browser on 12.04.1


  5. #5
    Join Date
    Aug 2012
    Beans
    19

    Re: php scripts not processed by browser on 12.04.1

    Hi,

    I have tried the instructions in the link, but I still have the identical behavior. The browser is trying to download the php file instead of processing it.

  6. #6
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,537
    Distro
    Ubuntu Development Release

    Re: php scripts not processed by browser on 12.04.1

    Is libapache2-mod-php5 installed? How to check:
    Code:
    doug@doug-64:~$ dpkg -l | grep libapache
    ii  libapache2-mod-php5              5.3.10-1ubuntu3.4            server-side, HTML-embedded scripting language (Apache 2 module)
    And if not, how to install:
    Code:
    sudo apt-get install libapache2-mod-php5
    Edit: what is the file name you are using? and will it be recognised as a php file?
    Last edited by Doug S; January 22nd, 2013 at 07:18 PM.

  7. #7
    Join Date
    Jan 2009
    Beans
    20

    Re: php scripts not processed by browser on 12.04.1

    You might also need to change DocumentRoot in
    "/etc/apache2/sites-enabled/000-default" from "/var/www" to the folder with your php file (~/public_html). (or put your index.php file in "/var/www").

    The browser should be pointing to http://localhost when you try to test it locally.


    Quote Originally Posted by alex2356 View Post
    Hi,

    I have tried the instructions in the link, but I still have the identical behavior. The browser is trying to download the php file instead of processing it.

  8. #8
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: php scripts not processed by browser on 12.04.1

    Quote Originally Posted by alex2356 View Post
    I am running Ubuntu 12.04.1 and trying to get a php script to work within the browser. I am not very experienced with these things, and searching the issue on the net brought no real clue what I am missing. If, for any reason, this problem is nor well described or belongs to another forum, please let me know!

    On the system I seem to have apache2 running, the file /etc/apache2/httpd.conf is empty, and a httpd service does not seem to exist. What do I need to check/enable/install to be able to get a php script interpreted by the browser (current firefox).
    One more thing - PHP is no interpreted client-side, it is interpreted server side.
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  9. #9
    Join Date
    Aug 2012
    Beans
    19

    Re: php scripts not processed by browser on 12.04.1

    First, libapache2-mod-php5 is installed. Second, I always tried to open the php file with File -> Open File. Third, when I navigate to the test php file through http://localhost this seem to work now.


    However, what I really wanted to do is to follow some PHP tutorial on forms, given here:http://www.tizag.com/phpT/forms.php . Now I am at a stage where I put the two files described in this tutorial into /var/www, but have problems to open the order.html file in the browser as http://localhost/order.html. I get an Internal Server error.

    Why am I unable to see a simple html page now? What am I missing this time?

  10. #10
    Join Date
    Apr 2012
    Location
    Detroit, MI USA
    Beans
    32
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: php scripts not processed by browser on 12.04.1

    Are you able to provide details of your error log? Sounds like a MIME Type issue.

    The error log should be located in /var/log. You can perform a command like cat, to view the file.
    Code:
    cat /var/log/error_log

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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