Find the answer to your Linux question:
Results 1 to 3 of 3
I am running Ubuntu 9.04. After many failures trying to get Apache, PHP and MySQL configured, I have started all over, so I'm posting a new thread with only my ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40

    [SOLVED] How to get Apache to run PHP script

    I am running Ubuntu 9.04. After many failures trying to get Apache, PHP and MySQL configured, I have started all over, so I'm posting a new thread with only my current problem. After completed uninstalling and deleting all related directories, I used the Synaptic Package Manager to install Apache2, MySQL, PHP5 and several related packages. These are the final selections I made:

    Code:
    apache2 (version 2.2.11-2ubuntu2) will be installed
    apache2-doc (version 2.2.11-2ubuntu2) will be installed
    apache2-mpm-prefork (version 2.2.11-2ubuntu2) will be installed
    apache2-utils (version 2.2.11-2ubuntu2) will be installed
    apache2.2-common (version 2.2.11-2ubuntu2) will be installed
    libapache2-mod-perl2 (version 2.0.4-5ubuntu1) will be installed
    libapache2-mod-php5 (version 5.2.6.dfsg.1-3ubuntu4.1) will be installed
    libapache2-reload-perl (version 0.10-2) will be installed
    libapr1 (version 1.2.12-5) will be installed
    libaprutil1 (version 1.2.12+dfsg-8) will be installed
    libbsd-resource-perl (version 1.2901-1) will be installed
    libdbd-mysql-perl (version 4.008-1) will be installed
    libdbi-perl (version 1.607-1) will be installed
    libdevel-symdump-perl (version 2.08-1) will be installed
    libgtkhtml3.8-15 (version 1:3.13.5-1ubuntu2) will be installed
    libhtml-template-perl (version 2.9-1) will be installed
    libmysqlclient15off (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    libnet-daemon-perl (version 0.43-1) will be installed
    libplrpc-perl (version 0.2020-1) will be installed
    libpq5 (version 8.3.7-1) will be installed
    libqt3-mt (version 3:3.3.8-b-5ubuntu1) will be installed
    mysql-admin (version 5.0r12-1ubuntu1) will be installed
    mysql-client (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    mysql-client-5.0 (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    mysql-common (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    mysql-doc-5.0 (version 5.0.56-0ubuntu1) will be installed
    mysql-gui-tools-common (version 5.0r12-1ubuntu1) will be installed
    mysql-navigator (version 1.4.2-11) will be installed
    mysql-query-browser (version 5.0r12-1ubuntu1) will be installed
    mysql-server (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    mysql-server-5.0 (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    mysql-server-core-5.0 (version 5.1.30really5.0.75-0ubuntu10.2) will be installed
    php5 (version 5.2.6.dfsg.1-3ubuntu4.1) will be installed
    php5-common (version 5.2.6.dfsg.1-3ubuntu4.1) will be installed
    php5-mysql (version 5.2.6.dfsg.1-3ubuntu4.1) will be installed
    I used Firefox to open HTML Code:
    HTML Code:
    http://localhost
    successfully.

    However, when I try to open a sample PHP file that I created called PHPINFO.PHP using this URL:
    HTML Code:
    http://localhost/phpinfo.php
    I get the following message that I don't know how to resolve:

    Code:
    Opening phpinfo.php
    You have chosen to open phpinfo.php which is a: PHP file from: http://localhost
    What should Firefox do with this file?
    Open with [Browse...]
    Save File
    Do this automatically for files like this from now on.
    How do I get Apache to handle PHP programs?

    The /etc/apache2/httpd.conf file is empty. I'm not sure if this should be configured?

    I have been seeking documentation on how to configure this, but my Google searches only find outdated information for previous versions. Can someone tell me what I need to do?

  2. #2
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Location
    Mountain View, CA
    Posts
    132
    Perhaps adding:
    Code:
    AddType application/x-httpd-php .html
    to /etc/apache2/httpd.conf
    will do it.

  3. #3
    Just Joined!
    Join Date
    May 2009
    Location
    Deep in the heart of Texas
    Posts
    40
    Thank you for the response.
    Add

    AddType application/x-httpd-php .html

    to /etc/apache2/httpd.conf
    I believe that solved my main problem. I actually had already added that line to /etc/apache2/apache2.conf since my post, but it did not do the trick by itself. After doing that, I was then just getting a blank page with no error messages when I tried to navigate to it.

    I eventually determined that my PHP syntax was also wrong. After correcting the syntax, my page now works!

    Thank you for your help.

Posting Permissions

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