|  | New to PHP and Apache |  | |
| | | Joseph |  |
| Posted: Mon Sep 01, 2008 6:26 pm Post subject: New to PHP and Apache |  |
| |  | |
I am migrating from Windows (C,C++ Windows servers) to PHP and Apache. I started out testing out a small program to read RSS feeds, process and display results. I tried running it on the Apache server (Red Hat Linux), and this is the message I received:
Warning: file_get_contents() [function.file-get-contents]: URL file- access is disabled in the server configuration in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 4
Warning: file_get_contents(http://rss.news.yahoo.com/rss/software) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/.xxx/xxxx/xxxx.com/TestRSSFeed.php on line 4
Warning: Invalid argument supplied for foreach() in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 7
Is this some security setting I need to change on the Apache server? The program is very simple, and here's the source code (I made sure the PHP script properties are set to 0755 Octal)
<?php
$request = "http://rss.news.yahoo.com/rss/software"; $response = file_get_contents($request); $xml = simplexml_load_string($response); echo "<h1>{$xml->channel->title}</h1>"; foreach($xml->channel->item AS $story) { echo "<a href=\"$story->link\" title=\"\">$story->title</a><br>"; echo "<p>$story->description</p><br><br>"; } ?> |
| |
| | | Jerry Stuckle |  |
| Posted: Mon Sep 01, 2008 6:26 pm Post subject: Re: New to PHP and Apache |  |
| |  | |
Joseph wrote:
| Quote: | I am migrating from Windows (C,C++ Windows servers) to PHP and Apache. I started out testing out a small program to read RSS feeds, process and display results. I tried running it on the Apache server (Red Hat Linux), and this is the message I received:
Warning: file_get_contents() [function.file-get-contents]: URL file- access is disabled in the server configuration in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 4
Warning: file_get_contents(http://rss.news.yahoo.com/rss/software) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/.xxx/xxxx/xxxx.com/TestRSSFeed.php on line 4
Warning: Invalid argument supplied for foreach() in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 7
Is this some security setting I need to change on the Apache server? The program is very simple, and here's the source code (I made sure the PHP script properties are set to 0755 Octal)
?php
$request = "http://rss.news.yahoo.com/rss/software"; $response = file_get_contents($request); $xml = simplexml_load_string($response); echo "<h1>{$xml->channel->title}</h1>"; foreach($xml->channel->item AS $story) { echo "<a href=\"$story->link\" title=\"\">$story->title</a><br>"; echo "<p>$story->description</p><br><br>"; } ?
|
This is the wrong place to ask about Apache configuration.
But chances are it's a problem in your php.ini file, especially allow_url_open.
Look at the output from phpinfo(). Pay particular attention to the php.ini file you're using, and check the allow_url_fopen parameter.
-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |
| | | Michael Vilain |  |
| Posted: Tue Sep 02, 2008 12:16 am Post subject: Re: New to PHP and Apache |  |
| |  | |
In article <018c3b34-5ff0-4726-b2ea-1ad01f5237b0@i24g2000prf.googlegroups.com>, Joseph <northwestdev@gmail.com> wrote:
| Quote: | I am migrating from Windows (C,C++ Windows servers) to PHP and Apache. I started out testing out a small program to read RSS feeds, process and display results. I tried running it on the Apache server (Red Hat Linux), and this is the message I received:
Warning: file_get_contents() [function.file-get-contents]: URL file- access is disabled in the server configuration in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 4
Warning: file_get_contents(http://rss.news.yahoo.com/rss/software) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/.xxx/xxxx/xxxx.com/TestRSSFeed.php on line 4
Warning: Invalid argument supplied for foreach() in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 7
Is this some security setting I need to change on the Apache server? The program is very simple, and here's the source code (I made sure the PHP script properties are set to 0755 Octal)
?php
$request = "http://rss.news.yahoo.com/rss/software"; $response = file_get_contents($request); $xml = simplexml_load_string($response); echo "<h1>{$xml->channel->title}</h1>"; foreach($xml->channel->item AS $story) { echo "<a href=\"$story->link\" title=\"\">$story->title</a><br>"; echo "<p>$story->description</p><br><br>"; } ?
|
I think your ISP has disabled the ability of the file_get_contents() function from reading URLs. Contact your sysadmin to fix it or start looking for another ISP.
-- DeeDee, don't press that button! DeeDee! NO! Dee... [I filter all Goggle Groups posts, so any reply may be automatically by ignored] |
| |
| | | C. (http://symcbean.blogs |  |
| Posted: Tue Sep 02, 2008 12:15 pm Post subject: Re: New to PHP and Apache |  |
| |  | |
On 2 Sep, 03:16, Michael Vilain <vil...@NOspamcop.net> wrote:
| Quote: | In article 018c3b34-5ff0-4726-b2ea-1ad01f523...@i24g2000prf.googlegroups.com>,
Joseph <northwest...@gmail.com> wrote: I am migrating from Windows (C,C++ Windows servers) to PHP and Apache. I started out testing out a small program to read RSS feeds, process and display results. I tried running it on the Apache server (Red Hat Linux), and this is the message I received:
Warning: file_get_contents() [function.file-get-contents]: URL file- access is disabled in the server configuration in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 4
Warning: file_get_contents(http://rss.news.yahoo.com/rss/software) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/.xxx/xxxx/xxxx.com/TestRSSFeed.php on line 4
Warning: Invalid argument supplied for foreach() in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 7
Is this some security setting I need to change on the Apache server? The program is very simple, and here's the source code (I made sure the PHP script properties are set to 0755 Octal)
?php
$request = "http://rss.news.yahoo.com/rss/software"; $response = file_get_contents($request); $xml = simplexml_load_string($response); echo "<h1>{$xml->channel->title}</h1>"; foreach($xml->channel->item AS $story) { echo "<a href=\"$story->link\" title=\"\">$story->title</a><br>"; echo "<p>$story->description</p><br><br>"; } ?
I think your ISP has disabled the ability of the file_get_contents() function from reading URLs. Contact your sysadmin to fix it or start looking for another ISP.
-- DeeDee, don't press that button! DeeDee! NO! Dee... [I filter all Goggle Groups posts, so any reply may be automatically by ignored]
|
From the content of the post - he seems to own the box.
The most likely place something will need fixed is in the php.ini file - I'd look for allow_url_fopen and open_basedir
Some PHP directives from the ini file can be overridden by the Apache config file, and some can be overridden in .htaccess files - see LINK but the 2 above cannot be overridden here.
HTH
C. |
| |
| | | Jerry Stuckle |  |
| Posted: Tue Sep 02, 2008 6:39 pm Post subject: Re: New to PHP and Apache |  |
Joseph wrote:
| Quote: | The Apache server has a WHM management panel. Anyone familiar with it, and where I can go to make modifications to php.ini? If I do the mods manually, then WHM will overwrite it.
|
Did you try asking in the CPanel support forums? When dealing with a product, that product's support structure is usually the best place to ask.
-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
| |
| | | Joseph |  |
| Posted: Tue Sep 02, 2008 7:09 pm Post subject: Re: New to PHP and Apache |  |
| |  | |
On Sep 2, 5:15 am, "C. (http://symcbean.blogspot.com/)" <colin.mckin...@gmail.com> wrote:
| Quote: | On 2 Sep, 03:16, Michael Vilain <vil...@NOspamcop.net> wrote:
In article 018c3b34-5ff0-4726-b2ea-1ad01f523...@i24g2000prf.googlegroups.com>,
Joseph <northwest...@gmail.com> wrote: I am migrating from Windows (C,C++ Windows servers) to PHP and Apache.. I started out testing out a small program to read RSS feeds, process and display results. I tried running it on the Apache server (Red Hat Linux), and this is the message I received:
Warning: file_get_contents() [function.file-get-contents]: URL file- access is disabled in the server configuration in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 4
Warning: file_get_contents(http://rss.news.yahoo.com/rss/software) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/.xxx/xxxx/xxxx.com/TestRSSFeed.php on line 4
Warning: Invalid argument supplied for foreach() in /home/.xxx/xxxx/ xxxx.com/TestRSSFeed.php on line 7
Is this some security setting I need to change on the Apache server? The program is very simple, and here's the source code (I made sure the PHP script properties are set to 0755 Octal)
?php
$request = "http://rss.news.yahoo.com/rss/software"; $response = file_get_contents($request); $xml = simplexml_load_string($response); echo "<h1>{$xml->channel->title}</h1>"; foreach($xml->channel->item AS $story) { echo "<a href=\"$story->link\" title=\"\">$story->title</a><br>"; echo "<p>$story->description</p><br><br>"; } ?
I think your ISP has disabled the ability of the file_get_contents() function from reading URLs. Contact your sysadmin to fix it or start looking for another ISP.
-- DeeDee, don't press that button! DeeDee! NO! Dee... [I filter all Goggle Groups posts, so any reply may be automatically by ignored]
From the content of the post - he seems to own the box.
The most likely place something will need fixed is in the php.ini file - I'd look for allow_url_fopen and open_basedir
Some PHP directives from the ini file can be overridden by the Apache config file, and some can be overridden in .htaccess files - LINK the 2 above cannot be overridden here.
HTH
C.- Hide quoted text -
- Show quoted text -
|
The Apache server has a WHM management panel. Anyone familiar with it, and where I can go to make modifications to php.ini? If I do the mods manually, then WHM will overwrite it. |
| |
|
|