By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,404 Members | 1,705 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,404 IT Pros & Developers. It's quick & easy.

Fatal error during include :(

P: n/a
Hello, I am using php5 and I've got this piece of code:

include ('http://something.somewhere/file.php?a=act')

PHP instead of including file five me:

[13-May-2005 12:17:38] PHP Fatal error: Unknown: Security alert:
Include filename is an URL in Unknown on line 0
My php.ini contains:

safe_mode = Off
allow_url_fopen = On

<? phpinfo() ?> shows that this values are correct.
Why it is happens? What can I do?

Cheers,

--
Rafal Bluszcz Zawadzki
JabberPL.org SysAdmin
----------------------
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Rafal Zawadzki wrote:
Hello, I am using php5 and I've got this piece of code:

include ('http://something.somewhere/file.php?a=act')
This really can't be done. Only local files can be included.
PHP instead of including file five me:

[13-May-2005 12:17:38] PHP Fatal error: Unknown: Security alert:
Include filename is an URL in Unknown on line 0
This message says what I said before.

My php.ini contains:

safe_mode = Off
allow_url_fopen = On
fopen says it all. This means php allows you to open a file from a URL.

So if you want to read a remote file use fopen.
<? phpinfo() ?> shows that this values are correct.
Why it is happens? What can I do?

Cheers,


Jul 17 '05 #2

P: n/a
Azeus <IF*************************@mp.com> wrote:
include ('http://something.somewhere/file.php?a=act')


This really can't be done. Only local files can be included.


Really? Then the manual should be fixed:
http://nl3.php.net/include/
'If "URL fopen wrappers" are enabled in PHP (which they are in the
default configuration), you can specify the file to be included using a
URL (via HTTP or other supported wrapper - see Appendix L for a list of
protocols) instead of a local pathname.'
PHP instead of including file five me:

[13-May-2005 12:17:38] PHP Fatal error: Unknown: Security alert:
Include filename is an URL in Unknown on line 0


This message says what I said before.


Maybe not:
http://nl3.php.net/include/
"Warning

Windows versions of PHP prior to PHP 4.3.0 do not support accessing
remote files via this function, even if allow_url_fopen is enabled."
My php.ini contains:

safe_mode = Off
allow_url_fopen = On


fopen says it all. This means php allows you to open a file from a URL.

So if you want to read a remote file use fopen.


So example 16-7 on http://nl3.php.net/include/ is wrong?

Jul 17 '05 #3

P: n/a
According to your description of settings and code, it should work.
Include can in fact include remote files. Have you tried other URL's
that will work, such as google.com?

Jul 17 '05 #4

P: n/a
Your copy of PHP has the Hardened-PHP patch. Including of URLs is
disabled, period.

There is no legitimate reason to include a URL. Doing so is almost
always a mistake. If you want to show the contents of a web page, use
readfile().

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.