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.
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 >.>
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.
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.
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?
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.
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
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.
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!
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?
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?