LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Reply
 
LinkBack Search this Thread
Old 06-14-2004, 07:53 AM   #1
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Rep: Reputation: 0
Question Red Hat 9 server can't write PHP script, problem in httpd.conf file?


Hello everyone!

I have a problem. I'm a newbie in Linux and I recently installed Linux Red Hat for Server purposes. I have installed and configured everything with the help of a Linux networking home guide (siliconvalleyccie).

Well, I hosted a site and it works perfect when I browse through it with Internet explorer on Windows, except for one php file which doesn't write the code it's supposed to. It's a PHP file which writes a code for a guestbook. I have looked everywhere on the website and here on the forums but I couldn't find a solution.

When I browse through the website when I'm behind my Red Hat server, it writes the code perfectly, but not on other machines. So I guess this is a security problem? (it writes the PHP file locally on the server but not when you view it with an connection from outside)


Extra info:

Red Hat Linux 9 Server

directory website is hosted:

/var/www/html/tijlsite

guestbook with php file

/var/www/html/tijlsite/prikbord/prikbord.php


The PHP file is located in the directory "prikbord". I have put the users and right on this directory as "nobody" and "write and read". I also used the "chmod 777" commando, and it doesn't work either.

Also, somebody told me the problem could be solved somewhere in the http.conf file. Now I have looked on this guide I mentioned earlier (siliconvalleyccie), and it says that I should add a line or should change something on the httpd.conf.

My question is: what line should I add in the http.conf file and where? Or is there another solution?

Thank you very very much!
 
Old 06-14-2004, 09:19 AM   #2
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Sounds like you need to spend some time looking at your log files. You can learn a great deal by looking at the logs. Anytime somethign happens on your server, apache logs it. Especially when it comes to errors. Try looking at /var/log/apache or /var/log/httpd and look at the error log, or suexec log. Anytime you click on the link to your PHP script, if something fails, a message will be written to the error log. I suggested also looking at the suexec log because it may be an ownership problem.
 
Old 06-14-2004, 11:03 AM   #3
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks!!! I'll do that!
 
Old 06-15-2004, 03:11 AM   #4
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Well, I have looked at the logs, but I couldn't find any clue to what the problem with the php file or security is.

Although, I saw this error over and over again: "warning: child process *digits* still did not exit, sending a SIGTERM". Is this something relevant?

Also, I couldn't find an apache directory in the /var/log. Strange, because, to my knowledge, I have installed Apache. Because if I didn't I couldn't host my website, right?...

thanks so much!
 
Old 06-15-2004, 06:42 AM   #5
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Sounds like your log files must be located in some non-standard place. Try opening the file /etc/httpd/conf/httpd.conf or maybe it's under /etc/apache/conf... .either way, locate and open the httpd.conf file.

Once its open, look for something in the virtual hosts that talks about the location of your log files. It should be showing a full path to them. If there is nothing in the virtual host section, look around in other areas of the httpd.conf file to find the path to your log files. If you can, try searching the file for the "ErrorLog" directive. This will tell you where to look for the error log on your system.

Its possible that you found an error log but it wasn't the right one. I would stay focused on locating the correct error log and see if you can find out what error apache is giving for this problem. If you know a little something about writing php code, you may want to try changing it slightly and see what happens. Unfortunately, I'm a Perl man, myself, so I don't know enough about php to help you very much. Normally I troubleshoot scripting problems by telling my perl script to print out some line of text and then exit immediately after that. This way, I can see if the script is successful up to that point. If it is, then I move those lines to a place later on in the script and try again. You may want to try the equivalent.
 
Old 06-18-2004, 02:29 AM   #6
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Well, I have looked in the httpd.conf, and it says my Error Logs should be in the following file:

/var/log/httpd/error_log

Well, looking in that particular error log, I can't find any clues to what could be wrong. I do get, however, some error about the DNS settings.

Failed to resolve server name to *IP address* (Check DNS) or specify an explicite server name.

That could be true because I haven't configured the DNS yet (I get the error every time I restart Apache), but that should be no problem for getting the PHP file to work, right? And furthermore I still have those digest and child errors, whatever that may be.

Yes, I could post the PHP codes here, but my PHP knowledge isn't so good either.

Any suggestions?
thanks so much!!
 
Old 06-18-2004, 06:55 AM   #7
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
It sounds like you need to edit /etc/resolv.conf and put your DNS servers in there. Can you tell us the contents of that file? You can test by doing a "ping aol.com" and see if it works. If it gives you an error about not being able to resolve the domain name, then you may have a DNS problem. You'll need to get that working before apache can do it's job. The stuff to go into resolv.conf is whatever nameservers your ISP provided to you. Here's mine...

nameserver 127.0.0.1
nameserver 66.93.87.2

The localhost address (127.0.0.1) is there because I'm running a DNS server on my box. So it's looking to the localhost first because there is already a DNS cache there that it can use... the second address is a merely backup for me. Yours may be 2 seperate IPs, or maybe just one IP.
 
Old 06-18-2004, 09:18 AM   #8
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks!

Here's the content of my resolv.conf file:

search localdomain
nameserver 212.52.1.0

When I do the ping command it doesn't give an error, it doesn't do anynthing. I also get no prompt so I guess it gives an error.

So, I have to make a DNS? And this will solve that error with Apache?

Thanks so much! You're a real help!
 
Old 06-18-2004, 09:47 AM   #9
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
That has to be the wrong IP... that IP address ends with a zero, which is usually to indicate a whole network and not a specific machine. And when I try to ping that IP address, I just get timeouts. What's the content of your /etc/hosts file?

You may need to verify that the IP address in that file is OK to use. Your internet provider should have given you an IP address to use for the DNS servers.
 
Old 06-21-2004, 03:31 AM   #10
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Ah yes. I forgot to say that I'm in a big network. The intranet server is for the company where I work, for the local network, but not for the outside network (WAN).

The content of my /etc/hosts :

# bla
# bla
127.0.0.1 localhost.localdomain localhost

So I should ask my boss for new IP address?

Thanks!
 
Old 06-21-2004, 06:50 AM   #11
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Well, I would definitely make sure the IP of your DNS servers is correct. It's the "nameserver" directive I'm wondering about. The error message you are getting in the log files is explained here...

http://www.linuxhomenetworking.com/l...pachebasic.htm

Just scroll down to the very bottom and read the last entry under troubleshooting. Look for ServerName directive in your conf file and be sure it's been changed to a "real" hostname or IP address or simply "localhost".

When you try to restart apache, look in the logs again and see if you are getting the same message. I suspect that your config file has not been fully configured. Try to look at each set of comments in the config file and determine if you need to adjust the settings to some other value instead of just accepting the defaults on everything. If you're not sure what some directive is used for, just look around at apache.org. They have some of the best documentation ever written and it should explain each directive in great detail.

If you're still stuch, you probably also need to post the contents of your httpd.conf file so we can see how you've got it configured, or at the very least, post the directives you're not sure about.
 
Old 06-23-2004, 04:07 AM   #12
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Oke thanks!

Here's some excerpts of the content of my httpd.conf file:

***********************************************

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile "/var/run/httpd.pid"

#
# Timeout: The number of seconds before receives and sends time out.
#
TimeOut 3600

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive false

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
MaxClients 150
MaxRequestsPerChild 100
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
</IfModule>

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to 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 (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 10.21.100.152:80


#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

### Section 2: 'Main' server configuration

#
User apache
Group apache

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost

#
ServerName tijlsite
NameVirtualHost 10.21.100.152

#
UseCanonicalName on

#
DocumentRoot "/var/www/html/tijlsite"

#
<LocationMatch "^/$">
Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>

#
<IfModule mod_userdir.c>

#
UserDir "disable"

#
#UserDir public_html

#
DirectoryIndex

#
AccessFileName .htaccess

#
HostNameLookups Off

#
ErrorLog "/var/log/httpd/error_log"

#
# Virtual hosts
#

# Virtual host Default Virtual Host
<VirtualHost 10.21.100.152>
DocumentRoot /var/www/html

ServerSignature email

DirectoryIndex index.php index.htm index.html index.shtml

**************************************************

Thank you very much again!
 
Old 06-23-2004, 06:36 AM   #13
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Here are some directives from my config file. I think these are ones that you may want to consider changing in yours. Tinker with these and also check the documentation for these, as you may want them to be something else depending on your needs.

ServerName 66.92.204.251:80
UseCanonicalName Off
Timeout 300
KeepAlive On
NameVirtualHost 66.92.204.251:80

Also, you have some stuff that is messed up. Right under the userdir section, you had a DirectoryIndex statement sitting all by itself with no arguments. I suspect this was formerly listed under the userdir section, but it was somehow left behind. You should remove that, since it conflicts with your other statement that is shown at the bottom of your config file.

Also, you had ServerSignature email, which I don't really know what that does... mine says ServerSignature Off.

Fiddle with those and see what you get.

Last edited by Donboy; 06-23-2004 at 06:42 AM.
 
Old 06-23-2004, 09:32 AM   #14
x_menno_x
LQ Newbie
 
Registered: Jun 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Oke thanks!!

I have changed the bits like you said, but I didn't change the IP address (10.21.100.152). So I restart Apache and I still get the same error (*Failed to resolve server name to 10.21.100.152 (Check DNS) or specify an explicite server name*). And the PHP file still doesn't write.

Well, if I change my IP address to 10.21.11.152 (the "11" here means you can have internet access in our company) it gives an error that it couldn't assign the IP address.

So I guess I have to look for the DNS server information?

That LISTEN part in the httpd.conf, is that ok?

Also, I have looked in the /etc/init.d/httpd file; is there some relevant information here?


Oh, and I got this on my error log when I changed the things in the httpd.conf like you said:

[Wed Jun 23 16:08:57 2004] [warn] child process 2259 still did not exit, sending a SIGTERM
[Wed Jun 23 16:08:58 2004] [notice] caught SIGTERM, shutting down
[Wed Jun 23 16:10:08 2004] [notice] Digest: generating secret for digest authentication ...
[Wed Jun 23 16:10:08 2004] [notice] Digest: done
[Wed Jun 23 16:10:09 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
 
Old 06-23-2004, 10:02 AM   #15
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Yeah, I really think this is a DNS issue. One of your DNS guru's at your office needs to come down off Mount Olympus and give you a hand with this. Your Listen directive is fine, I think. On mine, I just have the port number only, so mine just says "Listen 80" and that's all, so you may try changing to that if you want, but I don't think it matters. The messages in your logs look OK. Doesn't seem to be any major problems being reported there. The stuff in /etc/init.d/httpd is just for starting apache when the system boots.

I don't know if you did this already, but did you try changing your ServerName to be your IP address? Notice mine is the full IP and port number. The critical ones here are NameVirtualHost, ServerName, and UseCanonicalName. The other 2 directives I mentioned before are simply for performance reasons, which isn't such a big deal right now.

Also, I'm just assuming you had the closing </VirtualHost> tag at the end? I think you were just giving me a clipped version of your config file, so I didn't think much about it, but at this point, I'm just wondernig if we've covered all the obvious stuff.

Quote:
Well, if I change my IP address to 10.21.11.152 (the "11" here means you can have internet access in our company) it gives an error that it couldn't assign the IP address
I believe what you're saying is... the DNS guru's have said this is an IP address you can use for DNS lookups? If so, then you want to change your nameserver directive in /etc/resolv.conf to this address. I would also comment out the line that says "search localdomain" and see if that helps. I don't have this line for mine, but I don't really know what this is doing for you. That's why I say comment out the line so you can try it both ways and see if it starts working. Also, be sure you have a blank line at the end of your resolv.conf file. This sometimes matters, and if you dont' have it, sometimes you'll see an error popping up in /var/log/messages with regard to the resolv.conf file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anyone know how to write a date server in C for Red Hat linux? jcchenz Linux - Networking 1 10-26-2005 03:49 PM
php script can not write text file lemotion Linux - Newbie 5 04-20-2004 10:14 PM
PHP - What to add to Apache httpd.conf file? maktos Linux - Software 9 04-17-2004 08:18 PM
Red Hat 9 HTTPD Server Fonke0412 Linux - Newbie 6 08-09-2003 12:08 PM
Modifying Red Hat 7.3 Grub conf. file nixdisciple Linux - General 4 06-02-2002 10:37 PM


All times are GMT -5. The time now is 12:51 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration