enabled apache now,php not working

Asked by aditya

i installed apache from synaptic package manager along with its extention of php and postgresql.
Installation completed without any errors.
But when put localhost or 127.0.0.1 as the URL in the browser i get the following error
Title: Problem loading page
Unable to connect
Firefox can't establish a connection to the server at localhost.
# The site could be temporarily unavailable or too busy. Try again in a few
    moments.
# If you are unable to load any pages, check your computer's network
    connection.
# If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.

Any help will be appreciated!!!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apache Edit question
Assignee:
No assignee Edit question
Solved by:
aditya
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Knut Karevoll (gnonthgol) said :
#1

Are you sure apache is running?
Run 'sudo /etc/init.d/apache* start' in a terminal.
If this does not work try to enter 'sudo netstat -lpt | grep apache' to see what ports apache is running on. You should configure apache to listen to the wanted ports (80 by default).

Revision history for this message
aditya (adityagada) said :
#2

Still getting some errors :::::::::

a@edubuntu:~$ sudo /etc/init.d/apache*
[sudo] password for a:
 * Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}
a@edubuntu:~$ sudo /etc/init.d/apache* start
 * Starting web server apache2 apache2: apr_sockaddr_info_get() failed for edubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                                                                                                      [ OK ]
a@edubuntu:~$
a@edubuntu:~$ sudo netstat -lpt | grep apache
a@edubuntu:~$

Revision history for this message
aditya (adityagada) said :
#3

Solved the above problem but still i am not able to view localhost or 127.0.0.1 in the browser.

a@edubuntu:~$ sudo /etc/init.d/apache*
[sudo] password for a:
 * Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}
a@edubuntu:~$ sudo /etc/init.d/apache* start
 * Starting web server apache2 apache2: apr_sockaddr_info_get() failed for edubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                                                                                                      [ OK ]
a@edubuntu:~$
a@edubuntu:~$ sudo netstat -lpt | grep apache
a@edubuntu:~$ sudo /etc/init.d/apache2 start
 * Starting web server apache2 apache2: apr_sockaddr_info_get() failed for edubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                                                                                                      [ OK ]
a@edubuntu:~$ sudo gedit /etc/apache2/apache2.conf
a@edubuntu:~$ sudo gedit /etc/apache2/apache2.conf
a@edubuntu:~$ gksu "gedit /etc/apache2/conf.d/fqdn"
a@edubuntu:~$ sudo /etc/init.d/apache2 start
 * Starting web server apache2 [ OK ]
a@edubuntu:~$ sudo /etc/init.d/apache2 start
 * Starting web server apache2 [ OK ]
a@edubuntu:~$ sudo netstat -lpt | grep apache
a@edubuntu:~$

Revision history for this message
aditya (adityagada) said :
#4

a@edubuntu:~$ sudo apache2ctl
Usage: /usr/sbin/apache2ctl start|stop|restart|graceful|graceful-stop|configtest|status|fullstatus
       /usr/sbin/apache2ctl <apache2 args>
a@edubuntu:~$ sudo apache2ctl start
a@edubuntu:~$ sudo apache2ctl full status
Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]
                         [-C "directive"] [-c "directive"]
                         [-k start|restart|graceful|graceful-stop|stop]
                         [-v] [-V] [-h] [-l] [-L] [-t] [-S] [-X]
Options:
  -D name : define a name for use in <IfDefine name> directives
  -d directory : specify an alternate initial ServerRoot
  -f file : specify an alternate ServerConfigFile
  -C "directive" : process directive before reading config files
  -c "directive" : process directive after reading config files
  -e level : show startup errors of level (see LogLevel)
  -E file : log startup errors to file
  -v : show version number
  -V : show compile settings
  -h : list available command line options (this page)
  -l : list compiled in modules
  -L : list available configuration directives
  -t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
  -S : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules
  -M : a synonym for -t -D DUMP_MODULES
  -t : run syntax check for config files
  -X : debug mode (only one worker, do not detach)
a@edubuntu:~$ sudo apache2ctl status
w3m: Can't load http://localhost:80/server-status.
a@edubuntu:~$ sudo apache2ctl restart
httpd not running, trying to start
a@edubuntu:~$ sudo apache2ctl start
a@edubuntu:~$ sudo apache2ctl restart
httpd not running, trying to start
a@edubuntu:~$

Revision history for this message
aditya (adityagada) said :
#5

i added "ServerName localhost" at /etc/apache2/conf.d/fqdn

a@edubuntu:~$ apache2 -k start
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

Revision history for this message
aditya (adityagada) said :
#6

problem solved but i cant find the www directory where i can place the .php .html files ????

Revision history for this message
aditya (adityagada) said :
#7

where is the www directory now ??

its not in var/www ........i mean there is a directory for the same but i am not getting any listed files there.
i have even installed php but it isnt showing in the localhost.

404 Not Found:
Not Found

The requested URL / was not found on this server.
Apache/2.2.4 (Ubuntu) Server at localhost Port 80

Revision history for this message
aditya (adityagada) said :
#8

changed the www directory successfully but php is not enabled now.........

i cant run php scripts.

Revision history for this message
aditya (adityagada) said :
#9

httpd.conf is empty in the folder /etc/apache2/

Revision history for this message
aditya (adityagada) said :
#10

problem solved.......installed again