Red Hat 9 server can't write PHP script, problem in httpd.conf file?
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!
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Yes, I have tried changing my Servername to my IP address, but that doesn't work. I also have the </VirtualHost> at the end of my http yes. Forgot to mention that, sorry.
But now I have discovered I did something very wrong! You've asked earlier in this thread what the content of my resolv.conf was. I said this was the IP address: 184.108.40.206, but I've discovered that's my DNS! I had it all the time!
So, here is the correct information:
my IP address: 10.21.100.152
my DNS: 220.127.116.11
So, do I have to change my resolv.conf like this?:
*search localdomain* (delete this right?)
(where do I have to put my DNS?)
And where in the http.conf file do I have to fill in my DNS address? In the ServerName of NameVirtualHost?
Oh yes, I think that the 10.21.11.152 is inrelevant for me, because I don't need a connection with internet, because the server is for the local network here in the company (intranet).
It's important to have the word "nameserver" at the beginning right before the IP address. And yes, you want to try deleting the "localdomain" line. Of course, my suggestion was to simply comment this line by putting a # symbol at the beginning of the line until you're sure you don't need it.
You don't actually define the DNS anywhere in the httpd.conf file. It looks at resolv.conf automatically when it needs to lookup a name in DNS and convert it to an IP address.
By the way... I was looking back at your first post, and I noticed something odd. You said that everything was working fine in internet explorer except for one PHP script. Is this still true? Are you able to browse sites in your browser that are being served from apache?
Also, you said...
(it writes the PHP file locally on the server but not when you view it with an connection from outside)
So it's not entirely for your LAN... it will also need outside access for this PHP script, right? Just making sure I understand everything correctly.
Yes indeed. That's why I made this thread in the first place, because of that PHP write problem.
I can still browse through my hosted files on internet explorer on any computer here in the company, except it doesn't write that specific PHP file. It does, however, write the PHP locally on my Linux server.
I have changed the resolv.conf like you said, but still... when I restart httpd I still get the same error (*Failed to resolve server name to 10.21.100.152 (Check DNS) or specify an explicite server name*).
It looks to me like it's actually working. Better look around and see where the output may be going. Perhaps you're writing to a mysql database? Maybe to a text file somewhere? The messages in your logs are showing a return code of 200, which is success.
Hard for me to advise any better because I have no idea what the script looks like or what its doing, but from the apache side it looks like everything is working as it should be.
Maybe you should create a very very simple PHP script like "Hello world" and be sure that works. When you're done, start adding functionality, like maybe have it write a simple file on your server into a directory you can find easily and you know it's got the right permissions. Make the path to the file (in your script) hard coded so there are no mistakes about the path it's writing to or the file it's writing to.
Yes, you're right. It's writing data to a txt file. But there's nothing in the txt file.
Oh, by the way, I asked the person who wrote the php file if it writes to a mysql database. This is not the case. But he said something else: there's another PHP file who controls the visitor counter. This is working properly!
So, you can ask yourself: if apache is working, what can it be? A fault in the code? Can't imagine because it works on another server (Apache on Windows NT).
Hmmm, well, like I said, without seeing the script, I really have no idea. Maybe it's something about the difference between unix and windows. Maybe it's a permissions thing. Maybe you need write permission on the file and all directories that lead up to it. Maybe you want to post this question in a PHP forum so it can have the attention of the PHP gurus.
I would like to be able to say that we've totally ruled out all apache problems, but I can't really say that without sitting at your machine myself and looking around. I keep getting this feeling like maybe it's writing to a different error log that you haven't been checking.
Like I said, if you're getting no errors in apache logs, then it means the PHP script returned true and succeeded in everything it tried to do. That would mean there are no apache errors and all of the problem lies within your script.
Yes, well... today was my last day at my company (I had my work placement there, which has now ended). They won't be doing anything with the Red Hat server anymore. Thank you very very much for the help anyway!
I will set up my own Red Hat server at home one day, and will see if I get the same probleme with another PHP file. Anyway, I know what to do by then. THANKS!