[PHP] Re: include() problems
Gustave Bernier [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi everyone, I'm new to PHP and I'm trying to use the include function but with no success... My server's ini file is set as (allow_url_fopen, 0) so I'm having some trouble to pass different values for the php file I'm calling. The address is: http://mydomain.com/forums/ssi.php?a=active The code I'm trying now is: $_GET['a'] = 'active'; include('forums/ssi.php'); When I use this code I have no error, ssi.php is loaded but nothing is done (I believe the a value isn't passed to ssi.php) and the page where the include is stops loading just after the include(). You don't pass the value to that file, you simply tell the preprocessor of PHP to copy the contents of forums/ssi.php file into the source code before executing the script. You do NOT call the ssi.php by that! As you are stating you want to call http://mydomain.com/forums/ssi.php?a=active why are you including the file in there? The statement about allow_url_fopen, 0 setting controls access to remote-resources, so if you are allowed to do something like fopen(http://...;) or include(http://..;). Thus it doesn't have anything to do with your include. -- Dennis Sterzenbach www.darknoise.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: include() problems
Thanks for answering. I'm trying to include that file because in my index page because it has many functions I need to use in other pages... I'm on ADDR.com servers and I can't set allow_url_fopen to 1 (it sucks!). In ssi.php functions are called by accessing this address: http://mydomain.com/forums/ssi.php?a=active So how can I possibly include that page (ssi.php?a=active) on any of my pages??? From: Dennis Sterzenbach [EMAIL PROTECTED] Reply-To: Dennis Sterzenbach [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Re: include() problems Date: Thu, 2 Oct 2003 15:34:26 +0200 Gustave Bernier [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi everyone, I'm new to PHP and I'm trying to use the include function but with no success... My server's ini file is set as (allow_url_fopen, 0) so I'm having some trouble to pass different values for the php file I'm calling. The address is: http://mydomain.com/forums/ssi.php?a=active The code I'm trying now is: $_GET['a'] = 'active'; include('forums/ssi.php'); When I use this code I have no error, ssi.php is loaded but nothing is done (I believe the a value isn't passed to ssi.php) and the page where the include is stops loading just after the include(). You don't pass the value to that file, you simply tell the preprocessor of PHP to copy the contents of forums/ssi.php file into the source code before executing the script. You do NOT call the ssi.php by that! As you are stating you want to call http://mydomain.com/forums/ssi.php?a=active why are you including the file in there? The statement about allow_url_fopen, 0 setting controls access to remote-resources, so if you are allowed to do something like fopen(http://...;) or include(http://..;). Thus it doesn't have anything to do with your include. -- Dennis Sterzenbach www.darknoise.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN Messenger: instale grĂ¡tis e converse com seus amigos. http://messenger.msn.com.br -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: include() problems
I'm trying to include that file because in my index page because it has many functions I need to use in other pages... I'm on ADDR.com servers and I can't set allow_url_fopen to 1 (it sucks!). In ssi.php functions are called by accessing this address: http://mydomain.com/forums/ssi.php?a=active So how can I possibly include that page (ssi.php?a=active) on any of my pages??? In my oppinion, if these files you need the include for aren't on the same server as mydomain.com or even cannot access the root where mydomain.com got placed (like they cannot do an include by include '/home/web/com/mydomain/forums/ssi.php'), you will never have any chance of doing so. Due to allow_url_fopen being disabled, you cannot include files from remote. But just to be sure we're talking about the same problem: You try to get the SOURCE CODE of the script http://mydomain.com/forums/ssi.php?a=active to use it as part of another, say http://mydomain.co.uk/forum.php ? If you are talking about including it in http://mydomain.com/forum.php , simply adjust the forum.php code to have : ?php ... $a = $_GET['a']; include 'forums/ssi.php'; ... ? Regards Dennis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include problems
try using the absolute path to the file e.g. include(C:/windows/webserver/httproot/inc/test.inc); Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have PHP4 on both a windows IIS server and a windows apache server. The include function only works in the same directory of the file I wish to access. ex. www.include.com/default.php all files in same directory (i guess the root)? ?php include 'test.inc' ? everything works fine. Here's where I have the problem. Now I want to store all my includes in one directory www.include.com/inc ?php include 'inc/test.inc' ? that doesn't work Warning: Failed opening 'test.inc' for inclusion (include_path='') Can anyone help me with this??? Thanks scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php