FWD: Require error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 19, 2008 at 1:11 PM, Kyle Terry <kyle@xxxxxxxxxxxxx> wrote:

>
>
> On Fri, Dec 19, 2008 at 10:07 AM, sean greenslade <zootboysean@xxxxxxxxx>wrote:
>
>> On Fri, Dec 19, 2008 at 1:04 PM, Philip Graham <philip@xxxxxxxxxxxx>
>> wrote:
>>
>> >
>> > > So, I have this code in a php file called testing.php:
>> > > $incl = '/webs/www.zootboy.com/sl/sql.inc';
>> > >  if(!is_readable($incl)) die('ERROR: MySQL Include file does not
>> > > exist??!?');
>> > >  require $incl or die('MySQL page not found. Unable to continue.');
>> > >
>> > >
>> > > When I run the code in command line, it outputs this:
>> > >
>> > > [root@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
>> > > PHP Warning:  require(1): failed to open stream: No such file or
>> > directory
>> > > in /webs/www.zootboy.com/sl/testing.php on line 13
>> >
>> > Line 13?
>> >
>> > > PHP Fatal error:  require(): Failed opening required '1'
>> > > (include_path='/var/php/inc/') in /webs/
>> www.zootboy.com/sl/testing.phpon
>> > > line 13
>> > >
>> > > I have no idea what's going on. All the files have 777 perms.
>> >
>> > What happens if you remove the die() statement?
>> >
>> >  require $incl;
>> >
>> > --
>> > Philip Graham
>> >
>>
>> Hey! That fixed it. That's strange.
>>
>> --
>> --Zootboy
>>
>
> I totally forgot you have to wrap requires and includes in () if you are
> putting the die statement after it.
>
> (require $incl) or die('message'); //should work just fine for you.
>
>
> --
> Kyle Terry | www.kyleterry.com
>

That worked. Thanks! < Forwarded to php list. Sorry, I forgot to cc it.>

-- 
--Zootboy

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux