Results 1 to 9 of 9

Thread: php problem

  1. #1
    Join Date
    Jul 2009
    Beans
    4

    php problem

    My php codes in html file are not processed. All the items inside <html> and </html> except those within <php and ?> are processed. No error message also shown. Can anybody help???
    I get the following error message when I try to restart apache.
    apache2: Could not reliably determine the server's fully qualified domain name, using XXX.X.X.X for ServerName (in the place of X digits appear). Is this the reason for php problem????

  2. #2
    credobyte is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Jun 2009
    Beans
    1,559
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: php problem

    No, that's not the case ( tough, you can fix it by adding ServerName myserver to /etc/apache2/apache2.conf ).

    Try this :
    Code:
    sudo apt-get install php5 libapache2-mod-php5

  3. #3

    Re: php problem

    Hi,

    PHP code should be contained within these tags like this:
    Code:
    <?php
    
    echo "This works";
    
    ?>
    If your HTML page contains ANY php it will need to be saved with php extension. If you are getting an error is it possible for you to post the php script for us to look at?

    Thanks,

    -Silver Fox

  4. #4
    Join Date
    Jul 2009
    Beans
    4

    Re: php problem

    Dear Silver_fox_
    nobody ever told me abt renaming the file as .php. when i renamed and tried to open with firefox it says - you hav chosen to open a php file from ...... directory, what should firefox do with this file - open with/save file. which appln should i select in open-with and from which directory??? thanx in advance.

  5. #5
    credobyte is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Jun 2009
    Beans
    1,559
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: php problem

    Quote Originally Posted by chettiyar View Post
    Dear Silver_fox_
    nobody ever told me abt renaming the file as .php. when i renamed and tried to open with firefox it says - you hav chosen to open a php file from ...... directory, what should firefox do with this file - open with/save file. which appln should i select in open-with and from which directory??? thanx in advance.
    You can't open .php file with Firefox directly ! You need to upload it to your server ( apache2 ). If you do not have one, follow this guide : https://help.ubuntu.com/community/ApacheMySQLPHP

  6. #6
    Join Date
    Jan 2009
    Beans
    367

    Re: php problem

    Quote Originally Posted by chettiyar View Post
    Dear Silver_fox_
    nobody ever told me abt renaming the file as .php. when i renamed and tried to open with firefox it says - you hav chosen to open a php file from ...... directory, what should firefox do with this file - open with/save file. which appln should i select in open-with and from which directory??? thanx in advance.
    Php is code that runs on a webserver and the results of the code execution gets delived to your web browser. Thats why you cant run it directly in the browser. Its a server side language.

    if you want a client side language that runs in the web browser, try JavaScript.

  7. #7
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: php problem

    Quote Originally Posted by Silver_fox_ View Post
    If your HTML page contains ANY php it will need to be saved with php extension. If you are getting an error is it possible for you to post the php script for us to look at?
    Must be an Ubuntu specific requirement. It might be advisable but it is not required.

    As reference a quote from http://osdir.com/ml/php.general/2002-05/msg01167.html:
    Your apache on linux must be configured to parse .html files through php
    while your apache on your noteb.. must not, in your apache's httpd.conf
    look for the foll. line:
    AddType application/x-httpd-php4 .php
    AddType application/x-httpd-php4 .phtml
    so if you want to parse html files thru php add:
    AddType application/x-httpd-php4 .html
    Note: you must just search for those addtypes because the may be in another file when using Ubuntu.
    If you don't make backups of your important data, your data is obviously not important to you.

  8. #8
    Join Date
    Nov 2006
    Location
    Montreal, Canada
    Beans
    485
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: php problem

    Quote Originally Posted by Wim Sturkenboom View Post
    Must be an Ubuntu specific requirement. It might be advisable but it is not required.

    As reference a quote from http://osdir.com/ml/php.general/2002-05/msg01167.html:


    Note: you must just search for those addtypes because the may be in another file when using Ubuntu.
    With PHP and Apache installed, they'll be in /etc/apache2/mods-enabled/php5.conf

  9. #9
    Join Date
    Jul 2009
    Beans
    4

    Re: php problem

    dear credobyte,
    seems ur suggestion solved the problem. thanq very much

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
  •