Re: MDB2: include_once problem
| From: | Justin Patrin | Date: | Thu, 14 Jul 2005 20:51:49 +0000 |
| Subject: | Re: MDB2: include_once problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20014@lists.php.net to get a copy of this message | ||
On 7/14/05, Murray @ PlanetThoughtful <lists@planetthoughtful.org> wrote:
> Hello All,
>
> My remote host doesn't have PEAR installed, and so I have manually uploaded
> the MDB2 package and the PEAR.php file into my /include/ subdirectory. On
> line 55 of MDB2.php on my local machine, I have:
>
> require_once 'PEAR.php';
>
> This works fine on my local machine (Windows, if that matters) but causes
> the following errors on the remote machine (Linux, virtual host):
>
>
> Warning: main(): SAFE MODE Restriction in effect. The script whose uid is
> 32040 is not allowed to access /usr/lib/php/PEAR.php owned by uid 0 in
> /home/edifice/public_html/include/MDB2.php on line 55
>
> Warning: main(PEAR.php): failed to open stream: Permission denied in
> /home/edifice/public_html/include/MDB2.php on line 55
>
> Fatal error: main(): Failed opening required 'PEAR.php'
> (include_path='.:/usr/lib/php:/usr/local/lib/php') in
> /home/edifice/public_html/include/MDB2.php on line 55
>
> If I change the line to:
>
> require_once '../include/PEAR.php';
>
> It now works fine on my remote host, but causes the following errors on my
> local machine:
>
> Warning: main(../include/PEAR.php) [function.main]: failed to open stream:
> No such file or directory in C:\ptnew\project\include\MDB2.php on line 55
>
> Fatal error: main() [function.require]: Failed opening required
> '../include/PEAR.php' (include_path='.;C:\Program Files\PHP\pear;C:\Program
> Files\PHP\pear;') in C:\ptnew\project\include\MDB2.php on line 55
>
> Just to confirm, both MDB2.php and PEAR.php are in the same subdirectory,
> /include/.
>
> I feel like I'm overlooking something obvious, but wondering if anyone else
> can offer any suggestions on how I get this file to correctly be 'required'
> on both my local and remote hosts?
>
You should alter your include_path to go to your includes directory
before the system include directory.
--
Justin Patrin