Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi ,
I am trying to set up an apache server.
However when I type http://localhost/test.php I get an error mesage "Error reading WWW server response (HTTP Header)".
test.php only has the simple code:
<?php
echo "hallo world";
?>
Apache server is running.
Anyone a clue; I am using redhat8
kind regards
Patrick
PS html files will not work neither.
I don't know PHP, so I have no idea whether or not that's valid. However, I can offer up simple troubleshooting logic for you. Have you tried a basic HTML file instead? Or is it only PHP that's not working? Tried getting it from another client machine/browser?
Instead of http://localhost/test.php did you try http://127.0.0.1/test.php? I know it sounds basic, but sometimes we overlook the small stuff. If using the exact local IP works, then it could be a problem with the domain name of localhost. Have you changed the hostname of your box? Mine is now frankenstein so if I use "localhost" it might not find it whereas it might find "frankenstein". I don't have apache running and haven't tried this, but sometimes name associations with IPs can get muddled. Try it with the IP first and then if it works, try it with your hostname instead of localhost (if you've changed it).
[root@frankenstein]# hostname
frankenstein
Typing "hostname" at a prompt should give you your box's correct hostname to use in your URL test.
Just some more basic questions. Is the test.php file in the /var/www/html/ directory? Are you connecting to the right port? This has got me before. If you changed the default port from 80. You will need to specify it in the url. (e.g. http://127.0.0.1:85). This little overlooked problem has made me bang my head on the wall a few times. What does your httpd.conf file say. If you need to find it. It is usually located in the /etc/httpd/conf/ directory. Remember if you make changes to this file you will need to restart or graceful apache. ('apachectl restart' or 'apachectl graceful' as root.
Oh are you actually seeing plain html? If you arent you may be blocked from your firewall. Check your httpd.conf file and .htaccess (which is located in your www directories as a hidden folder - you will see it with 'ls -la'). You may need to allow php.
I am pretty sure a firewall can prevent localhost. Maybe one of the more advanced Linux users may be able to answer that.
Whats in your httpd.conf files?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.