Windows 8.1 Apache 2.4.20
PHP 5.5.15
When I run a php file only the code shows in the browser (chrome). I searched all over the internet but find no solutions. I tried altering the apache config with no success. Please help
>Apache is running on port 80 for sure
That is out of question. But another webserver already is installed and listens to port 80 that will not help to get a consistent response for localhost requests, if you knwo what I'm indicating.
You can start cmd.exe as Administrator and then do >netstat -aonb >connections.txt
Look out for :80 in the output text file.
On PC IIS works and there still are several entries listening to port 80, so that is not necessarily an issue. I assume two webservers listening for http protocoll messages might disturb each other.
[Sat Jan 17 13:51:46.436302 2015] [:error] [pid 4420:tid 1724] [client ::1:60037] script 'C:/xampp/htdocs/xampp/imdex.php' not found or unable to stat
I did a fresh install and still can't view a php file above is the error I get when I do localhost. I wrote apache and friends and waiting for a response. Please Please help
Aha, when you request a domain name only (or localhost) the web server looks for default files configured in webserver config.
So look out for imdex in apache.conf, maybe you altered something there.
It seems either the xampp installer has this wrong already or does not touch existing config.
You should perhaps deinstall xampp, delete C:\XAMPP and only after that is removed install back.
Just a word of caution. It doesn't seem you invested much work in htdocs already, aside of your php test script, but if there is work in it, eg by colleagues, instead of deleting c:\xampp after deinstallation you can of course also rename it. Just so the new install really is fresh and not mixing with already/still existing files.
If the bug to let the default file point to imdex.php instead of index.php is part of the xampp download I suggest you download another version.
OK, I made an attempt to install XAMPP myself, though I already have IIS, PHP and MySQL installed.
The installation itself is xampp-win32-5.6.3-0-VC11-installer.exe, so Version 5.6.3.0
The installer detected UAC on and suggested C:\XAMPP. That's OK
Starting XAMPP control panel it reports a problem starting apache:
[pre]20:59:39 [Apache] Problem detected!
20:59:39 [Apache] Port 80 in use by "Unable to open process" with PID 4!
20:59:39 [Apache] Apache WILL NOT start without the configured ports free!
20:59:39 [Apache] You need to uninstall/disable/reconfigure the blocking application
20:59:39 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
20:59:39 [Apache] Attempting to start Apache app...
20:59:39 [Apache] Status change detected: running
20:59:40 [Apache] Status change detected: stopped
20:59:40 [Apache] Error: Apache shutdown unexpectedly.
20:59:40 [Apache] This may be due to a blocked port, missing dependencies,
20:59:40 [Apache] improper privileges, a crash, or a shutdown by another method.
20:59:40 [Apache] Press the Logs button to view error logs and check
20:59:40 [Apache] the Windows Event Viewer for more clues
20:59:40 [Apache] If you need more help, copy and post this
20:59:40 [Apache] entire log window on the forums[/pre]
So there you also have info about what already uses a certain port.
I did as is suggested and clicked on the Config button of the XAMPP control panel to open httpd.conf. In that config file you find this section:
[pre]# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80[/pre]
And here I changed the 80 to 8080. That's a well usable alternative. If you create a webapp in IIS it suggests using port 81,82,83 and so on. Those are also fine.
Anyway as said I changed port to 8080 here.
Now start succeeds. Next message is coming from Windows Firewall and says Windows Firewall is blocking some functions. I clicked on Allow access and Yes in the follow up dialog.
And voila, XAMPP control panel shows Apache green and says it's running as some PID and using ports 443 and 8080.
And now
Even though its unclear what happens at your PC, the XAMPP installation is not faulty and the config not false for systems not running anything previously installed/configured. You just have to read and react to the messages given, see the signals and all is well.
If you installed once again I suggest you keep an eye on what happens, if you click on Apache Start Button. You also may find a blockade in your Firewall, if you ever reacted to the first firewall warning with not allowing Apache. You have to allow it to work.
Thank you for all your help. I got past the php problem. When I display my page using sublime view in browser all is well. But when I try to view using localhost:8000 I get 404 errors unable to find my css or js. Here is my code:
<head>
</head>
I've tried putting the css in the same folder I tried assets and can't get it to view properly using any browser. Any ideas when I physically put the css code directly in the html file it worked but I must be able to point to an external file. Again thank you very much you are very helpful.
Relative paths have to begin with ./, or no thing at all, If you begin a path with / you refer to root. HTML never uesed windows path conventions, as you can simply see by it using slashes and not backslashes.
For example <a href="mysecond.php">click here</a> refers to a script mysecond.php in the same folder as the current. The same applies if writing <a href="./mysecond.php">click here</a>, but not in general with <a href="/mysecond.php">click here</a>, only if the current html is in the root folder, too.
So / means root, ./ or nothing means current folder, ../ means one folder up.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.