Re: Require error
| From: | Wolf | Date: | Fri, 19 Dec 2008 17:43:41 +0000 |
| Subject: | Re: Require error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284844@lists.php.net to get a copy of this message | ||
Bottom Post
---- sean greenslade <zootboysean@gmail.com> wrote:
> No. The file is called testing.php and it is trying to include sql.inc
>
> On Fri, Dec 19, 2008 at 12:36 PM, Kyle Terry <kyle@kyleterry.com> wrote:
>
> >
> >
> > On Fri, Dec 19, 2008 at 9:28 AM, sean greenslade <zootboysean@gmail.com>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
> >> 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.
> >>
> >> --
> >> --Zootboy
> >>
> >
> > Are you trying to require itself?
Change your line to:
require('$incl') or die('File not found');
Require can be dork about things like this, I normally wind up handling to fiddle with the coding
for them.
Wolf