Forum Moderators: coopster

Message Too Old, No Replies

ini_set not working

         

brendan3eb

6:37 am on Mar 31, 2005 (gmt 0)

10+ Year Member



I just tried using ini_set for the first time and messed around with the syntax a bit and still haven't gotten it to work and there weren't working examples on php.net, is there something wrong with my syntax below:

if(ini_set('allow_url_fopen', 'On'))
{
echo "fopen now works";
}
else
{
echo "hmm..function is not working";
}

ive messed around with the syntax a bit and I continue to get the output from the else statement.

anshul

6:41 am on Mar 31, 2005 (gmt 0)

10+ Year Member



ini_set(allow_url_fopen, 'On') OR ini_set(allow_url_fopen, '1') should work ;)

coopster

11:22 am on Mar 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Correct syntax, but that particular directive is a "you cannot do that one from here" directive.

The php.ini directives [php.net] page includes a column to the far right with a value. In this instance the directive is allow_url_fopen and the Changeable value is PHP_INI_SYSTEM which, if you scroll down to the bottom of the page, means that the entry can be set in php.ini or httpd.conf only.

Sorry, can't use ini_set() on that particular directive. You may want to turn on error_reporting() [php.net] during development to help you identify these errors.

brendan3eb

5:20 pm on Mar 31, 2005 (gmt 0)

10+ Year Member



Ok, I actually didn't even need the error reporting cause I use fopen() for an rss feed later on on that page and continue to get this error:
Warning: fopen(): URL file-access is disabled in the server configuration in /home/-----/public_html/------/--------.php on line 53

I tried out using 1 and the other suggested syntax that was posted above, but neither worked.

coopster

12:09 am on Apr 1, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Read my response again carefully, brendan3eb. You cannot set that particular directive using the ini_set function. There are certain directives in PHP that you cannot override in the manner you are attempting.

Also, by the looks of it, your server is configured as such that you aren't going to be able to open remote files via HTTP anyway. You'll need to allow that to happen in your configuration first.