ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have the following error messages in apache logs :
Code:
[Sat Nov 21 14:25:12 2009] [error] [client 10.14.236.140] PHP Warning: fgets(): supplied argument is not a valid stream resource in /var/www/notice.php on line 70, referer: http://<IP>/notice.php
any idea what is this all about?
Last edited by your_shadow03; 11-24-2009 at 10:12 PM.
Open /var/www_81/watch2.php in an editor, copy what's on line 70 and post it here. What's the program you're trying to run through apache when you get the error? Is it something you coded or did you get it from the web? If you got it from the web what is it?
I can't see what the each(handles);statement is doing (line 66), I'd remove it unless you can explain why it is there.
The earlier block of code (around line 57) sets up the file handlers but doesn't check that they are working correctly. If the fopen() failed then it will return false, it should also raise a warning.
PHP Code:
if ($_GET['mode']=='row') { $handles = array(); foreach ($files as $log_file) { $fh = fopen("$base_dir/$log_file",r); fseek($fh,0,SEEK_END); $handles[] = $fh; }
and where does the close brace for the first if occur?
It is expecting a handle to an open file, so that it (fgets) can then read data from this file. The block of code above this opens the file, but it never checks to see if the file has been opened successfully.
Have you looked at what graemef posted? He might be on to something. Also have a look a this. Like graemef states, the file opening doesn't get handled completely when failing what might result in this error.
By the way your concern about permission could be the problem (Post #5). You need to make sure that the Apache user has access to not just the files but the path to the files. A common problem would be that it doesn't by default have access to the directory /home/john/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.