Re: Require error

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

 



sean greenslade schreef:
> 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.');
> 

your require line is doing this:

require ($incl or die("foo");

the expression results in 1 which translates to the string "1"
which require then tries to include.

do something like:

if (!require $incl)
	die("foo");

although you might consider just doing

require $incl;

and removing the is_readable() check, die()s, etc ... the script
will die anyway if the require failed.

> 
> 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
> PHP Fatal error:  require(): Failed opening required '1'
> (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
> line 13
> 
> I have no idea what's going on. All the files have 777 perms.
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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