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 ...
- 02-15-2008 #1Just 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"
- 02-15-2008 #2Linux 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.
- 02-16-2008 #3Just 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.
- 02-17-2008 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
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.
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.
- 02-18-2008 #5Just Joined!
- Join Date
- Feb 2008
- Posts
- 7
- 02-18-2008 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
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:
I hope that helps.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.
- 03-03-2008 #7Just 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
(9
Address 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.


Reply With Quote
