khoffman22 Posted September 19, 2006 Share Posted September 19, 2006 Hi,I've been using the sourceforge project phpffl (great project if you are into fantasy football) to set up a fantasy football league for my friends and have run into a kind of odd php problem. The guys over at phpffl tried to help but gave me a test to determine if it was just phpffl or php in general and it looks like php in general so here I am...Here's the scoop:there is a update that is run to get player stats for scoring (statistics.php). If I run a cron job that runs this file (php /pathname/statistics.php > stats.out) (the redirect is just so I can see some results, actual updating is in a mysql database), it works fine.If I run the file from the browser (which the guys at phpffl says should work), a la http://somename.com/path/statistics.phpit doesn't work. I get a sort of empty set results. Turning on more error handling for php reveals the following error:Warning: fsockopen() [function.fsockopen]: unable to connect to myffl.net:80 (Permission denied) in /var/www/html/ffl/program_files/autorun/myffl/functions/statistics_functions.php on line 55Now, why isn't this a phpffl problem? Well, I created the following file in the same directory:[code]<?phpini_set("display_errors", "On");$fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);if (!$fp) { echo "$errstr ($errno)<br />\n";} else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp);}?>[/code]I get the same error:Warning: fsockopen() [function.fsockopen]: unable to connect to www.google.com:80 (Permission denied) in /var/www/html/ffl/program_files/autorun/myffl/test.php on line 4Permission denied (13)So I guess php isn't being allowed to open a connection. I'm pretty new to fooling with php but have some knowledge about stuff otherwise.Oh, I'm running Fedora Core 5 with pretty standard firewall/SELinux settings (ports open for HTTP, SSH, mail, TS) behind a consumer wireless router.Thanks for any help you can give me.Keith Quote Link to comment Share on other sites More sharing options...
trq Posted September 20, 2006 Share Posted September 20, 2006 You'll want to look in your php.ini for [i]allow_url_fopen[/i], make sure it is switched to On. Quote Link to comment Share on other sites More sharing options...
khoffman22 Posted September 25, 2006 Author Share Posted September 25, 2006 Thanks for the suggestion. Didn't see your reply for awhile. New to phpfreaks.com and didn't realize that it doesn't auto-notify.allow_url_fopen is on. Any other suggestions? Here is that section of my php.ini file.[code];;;;;;;;;;;;;;;;;;; Fopen wrappers ;;;;;;;;;;;;;;;;;;;; Whether to allow the treatment of URLs (like http:// or ftp://) as files.allow_url_fopen = On; Define the anonymous ftp password (your email address);from="john@doe.com"; Define the User-Agent string; user_agent="PHP"; Default timeout for socket based streams (seconds)default_socket_timeout = 60; If your scripts have to deal with files from Macintosh systems,; or you are running on a Mac and need to deal with files from; unix or win32 systems, setting this flag will cause PHP to; automatically detect the EOL character in those files so that; fgets() and file() will work regardless of the source of the file.; auto_detect_line_endings = Off:[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.