Find the answer to your Linux question:
Results 1 to 7 of 7
hello i am trying to learn php. i am using ultimate ubuntu 1.4. i think it has apache installed. Now i am suppose to create a file hello.php and put ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    7

    running php

    hello
    i am trying to learn php. i am using ultimate ubuntu 1.4. i think it has apache installed.

    Now i am suppose to create a file hello.php and put it in my web server's root directory (DOCUMENT_ROOT).

    i don't know where is this "web server's root directory"

  2. #2
    Linux User
    Join Date
    Jan 2006
    Posts
    414
    The server's document root is in /var/www

    If you're not using the server on the web, just locally for testing, then you should be safe to open a terminal and:

    sudo chmod 777 /var/www/

    so you can read and write to that directory. Go to http://localhost/hello.php in your browser to view your page.

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    7
    thank you darkrose0510.

    Now when i type
    http://localhost/hello.php
    in my browser (Mozilla Fireforx)
    instead of showing my page
    it asks whether to save this file or open it (with which
    software)?

    i am not using the server on the web.it is just for locally testing so that i could learn php.

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by darkrose0510 View Post
    The server's document root is in /var/www

    If you're not using the server on the web, just locally for testing, then you should be safe to open a terminal and:

    sudo chmod 777 /var/www/

    so you can read and write to that directory. Go to http://localhost/hello.php in your browser to view your page.
    Note that, depending on the configuration of the server, this might have some serious security implications. It doesn't matter if you just enable it localy for testing purposes. But even if you just use it locally, you need to know that, unless you forbid the access via a firewall or something it will be open to the whole world, and to every hacker or attacker under the sun.

    Quote Originally Posted by dcbc View Post
    thank you darkrose0510.

    Now when i type
    http://localhost/hello.php
    in my browser (Mozilla Fireforx)
    instead of showing my page
    it asks whether to save this file or open it (with which
    software)?

    i am not using the server on the web.it is just for locally testing so that i could learn php.
    Probably, your server is not configured to use php properly, so, it acts just like when you try to open any other file that the browser can't understand.

    You need to check your distro's docs, it surely must have instructions on how to enable php for your particular web server.

  5. #5
    Just Joined!
    Join Date
    Feb 2008
    Posts
    7
    Quote Originally Posted by i92guboj View Post
    Probably, your server is not configured to use php properly, so, it acts just like when you try to open any other file that the browser can't understand.

    You need to check your distro's docs, it surely must have instructions on how to enable php for your particular web server.
    thanks for the reply.

    i don't know what is distro's docs.where can i find it.does it come with dvd.i just downloaded the ultimate ubuntu 1.5 edition and installed it in my computer.

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by dcbc View Post
    thanks for the reply.

    i don't know what is distro's docs.where can i find it.does it come with dvd.i just downloaded the ultimate ubuntu 1.5 edition and installed it in my computer.

    I mean the documentation for your distro.

    On a quick search, I found this:
    https://help.ubuntu.com/community/ApacheMySQLPHP

    There's a section called "Installing PHP5", on it, you can read this:

    Troubleshooting

    Does your browser ask if you want to download the php file instead of displaying it? If Apache is not actually parsing the php after you restarted it, install libapache2-mod-php5. It is installed when you install the php5 package, but may have been removed inadvertently by packages which need to run a different version of php. You may also need to actually enable it, by doing sudo a2enmod php5 followed by sudo /etc/init.d/apache2 restart. Be sure to clear your browser's cache before testing your site again.
    I hope that helps.

  7. #7
    Just Joined!
    Join Date
    Feb 2008
    Posts
    7
    i92guboj
    thanks for the reply
    i tried

    sudo a2enmod php5
    Password:
    This module is already enabled!

    ^ this is what i got

    then i tried
    sudo /etc/init.d/apache2 restart

    i got
    * Forcing reload of web server (apache2)... apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    httpd (no pid file) not running
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    (9Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    [fail]



    what should i do.

Posting Permissions

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