Apache2 problem on OS X 10.5.8

Matsaki

Registered
I can't get http://localhost to work even though I can see in the terminal that Apache is running.

Macintosh:~ mats$ sudo apachectl start
Password:
org.apache.httpd: Already loaded

Also I made a restart of Apache, and checked the the "File sharing" and "Web Sharing" is checked and on in the prefs pane.

When I try to gom to localhost I get the error:

Safari can’t open the page “http://localhost/” because Safari can’t connect to the server “localhost”.

I did some thing but don't know what. I have PHP5 and MySQL installed also. MySQL running fine. One example I used was this site http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/
 
Run the terminal command:
Code:
sudo apachectl -t

Do this to see if you have a screwup in the Apache configuration.
 
Thanks!
That gave me the info where it's going wrong (httpf.conf) But I have not been able to fix it yet as I have no backup file to start all over as there seems to be harder to fix the erros.
 
What is your document root? Look in /etc/apache2/httpd.conf for a line like this.

DocumentRoot "/Library/WebServer/Documents"
 
Fixing last night i now come to my DocumentRoot ok. (DocumentRoot "/Users/mats/Sites") but now it will not work with .php sites. Only HTML. I have PHP installed in /usr/local

Also in httpd.conf on line 114 I have deleted the "#" before LoadModule php5_module libexec/apache2/libphp5.so
 
Still in httpd.conf, do you find lines like this?
<IfModule dir_module>
DirectoryIndex index.html​
</IfModule>​
If so, change to this.
<IfModule dir_module>
DirectoryIndex index.html index.php index.htmls index.htm​
</IfModule>​
 
Thanks,
Now it's up and running. I have one more question. That is if I want to create some virtual hosts. Should I make the in the httpd.conf or in in i.e. /users catalog ?
 
Now I'm into trouble again! Working with my Macbook Pro Apache and MySQL config. I was using MAMP but want to configure my self downloaded and installed PHP and MySQL. Fore some reason I think maybe MAMP have fiddled with the configurations.

When I followed the setup procedures from tutorials I get MySQL running but when typing "mysql" in the terminal I get nothing. Here is some of the results I get.

1. When I open the terminal window it starts with "-bash: Add: command not found
MacBookPro:~ matsaki$ sudo apach"

2. When running "sudo apachectl -t" I get "Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist
Warning: DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist
[Sat Sep 18 00:44:50 2010] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Sep 18 00:44:50 2010] [warn] NameVirtualHost *:80 has no VirtualHosts
Syntax OK"

Maybe uninstall MAMP and start all over again with the configs.? But the PHP test page "<?php phpinfo() ?>" looks ok and Apache is working.
 
Back
Top