banjopaul67 — 2009-02-17T18:26:17-05:00 — #1
I am working with Head First's "PHP & MySQL" book, and following along in the appendix for installing the development environment on my local machine. I installed MySQL, PHP, and Apache successfully. When I enter "http://localhost" in a browser, all I get is a browser error. I made the small test PHP script that the book shows and put it in C:\Inetpub\wwwroot but of course can't execute the script because I can't access localhost.
I didn't even have the Inetpub folder on my machine until I followed another on-line tutorial for activating the Vista server on my local machine. I followed their steps (it was geared at turning on IIS) and now have the Inetpub folder, but it appears there's much more setup I still need to do, or something I missed. After reading other Sitepoint posts, I see that Windows Vista is a big part of my problem, but all the same can someone help to get things operating right with my Vista environment? Any tech help needs to be written for a complete newbie who is unfamiliar with going into the windows environment and making behind the scenes changes. Thanks in advance.
imaginethis — 2009-02-17T19:09:36-05:00 — #2
You may want to switch to Apache instead of IIS. The majority of the servers running PHP current run under Apache. Installing Apache, MySQL and PHP is as simple as running 3 installers, so you might want to give it a try -- if you can't get IIS working >.>
banjopaul67 — 2009-02-17T19:12:29-05:00 — #3
Thanks for the quick reply but apparently my original post wasn't clear. I did install Apache and it's this that I can't get working. My reference to IIS was only in that I followed a tutorial for turning on the Vista Server on my local machine which was geared at IIS, and when turned on allowed me to see the Inetpub\wwwroot folder finally. But I am trying to figure out how to work with Apache. I cannot access http://localhost even after installing Apache, MySQL and PHP. Thanks again.
logic_earth — 2009-02-17T19:23:01-05:00 — #4
PHP + IIS 7 on Windows Vista SP1, nothing easier then reading the documentation at the official IIS website.
Using FastCGI to Host PHP Applications on IIS 7.0
banjopaul67 — 2009-02-17T19:28:34-05:00 — #5
Guys thanks for the help. However, what I'm trying to do is work with Apache, not IIS. Am I going to be able to use the Apache server that I just installed on my machine? I can't access http://localhost now that I've installed it. My system tray icon shows that all Apache services are running, but I still get a browser error.
simshaun — 2009-02-17T20:05:11-05:00 — #6
Do this the easy way... take all the stuff you installed back off, and then get [XAMPP or [url=http://www.wampserver.com/en/]WAMP](http://www.apachefriends.org/en/xampp.html).
imaginethis — 2009-02-17T20:11:14-05:00 — #7
try going to http://127.0.0.1 does it work? If it doesn't you may need to check if the service is actually running.
banjopaul67 — 2009-02-17T20:26:46-05:00 — #8
Well, actually I did that too. I started with the individual programs, then when that failed I picked up on the WAMP tip by reading other posts, so I uninstalled everything and installed WAMP. WAMP would not run, and I still couldn't access http://localhost. I uninstalled WAMP and went back to the original three programs and began asking for help on this forum. I'm still wondering if I can use Apache with Windows Vista. Anyone know?
banjopaul67 — 2009-02-17T20:29:01-05:00 — #9
Oops, I didn't see the tip about going to http://127.0.0.1! I clicked on that and it worked! What does this mean?
imaginethis — 2009-02-17T20:36:34-05:00 — #10
That means apache is running >.>... You don't by chance have a firewall running do you? If so, kill the firewall temporarily and check if http://localhost works. If that works, you may need to open up port 80 in your firewall.
logic_earth — 2009-02-17T20:39:48-05:00 — #11
C:\Windows\System32\drivers\etc, open "hosts", check to make sure localhost is pointed to 127.0.0.1 or that it is not commented out.
awright418 — 2009-02-17T20:43:00-05:00 — #12
Go to Windows->System32->drivers->etc and open the hosts file using Wordpad.
The file should contain the following under the commented out description section:
If those lines are not there add them to to the file and save the file. You may need to change the file permissions in order to save the file.
logic_earth — 2009-02-17T20:46:02-05:00 — #13
Or copy to the desktop, then move it back after the changes have been made. Or start notepad with admin rights then open the files from there.
t11 — 2009-02-17T20:50:52-05:00 — #14
Vista has a habit of mapping localhost to IPv6 instead of IPv4, so you need to set up IIS or Apache or whatever you're using to bind ports on both IPv6 and IPv4 to get localhost to work
banjopaul67 — 2009-02-17T20:53:49-05:00 — #15
Hey thanks everyone for jumping in on this. However, I turned off Windows Firewall, but got the same result. I also went into C:\Windows\System32\drivers\etc\hosts, then opened hosts with notepad, and found out that the local host was exactly as the previous posts indicated they'd be.
banjopaul67 — 2009-02-17T20:55:41-05:00 — #16
Thanks so much for these tech tips. Can you next tell me how to do this with Apache?
imaginethis — 2009-02-17T21:04:34-05:00 — #17
Check in C:\Windows\system32\drivers\etc\HOSTS file for the IPv6 setting (open and edit the HOSTS file by dragging it into a text editor).
Find this IPv6 line:
Comment it out so it looks like this:
Make sure the first uncommented line is:
Save the file, restart Apache and then try to access your localhost again.
banjopaul67 — 2009-02-17T21:26:07-05:00 — #18
This is so much appreciated everyone! What a wonderful resource. I made the changes to the host file, and now when I go to http://localhost, I actually get "IT WORKS!" returned to me.
So now...I have a PHP script called "test.php" in C:\Inetpub\wwwroot which contains:
<?php phpinfo(); ?>
This script doesn't execute when I go to http://localhost, I just get the above mentioned "IT WORKS!" I then went to http://localhost/test.php and the results were that I received a page back that said "<?php phpinfo(); ?>"
Is C:\Inetpub\wwwroot the actual file that localhost points to, or should I be putting my scripts in a different spot? Thanks!
imaginethis — 2009-02-17T21:32:50-05:00 — #19
Your going to need to alter you httpd.conf file to forward files with extention .php to the php interpreter. Though, the PHP installer does this for you. Have you already installed PHP?
banjopaul67 — 2009-02-17T21:35:56-05:00 — #20
Yes, PHP is installed, and I have seen the httpd file so I can get into that fine. I looked in once but it's all greek to me at this early stage in my development. Can you be more specific on how to alter the file so as to send .php files to the interpreter?
next page →