Random Block and PHP Safe Mode

medic119

Joined: 2003-03-05
Posts: 14
Posted: Tue, 2003-09-09 22:00

My host turned on SAfe Mode for PHP so I have to use absolute pahts with php includes.

Problems is as soon as they did I received the following error from random block.

Quote:
Warning: main(errors/configure_instructions.php): failed to open stream: No such file or directory in /home/user/public/gallery/errors/unconfigured.php on line 10

Fatal error: main(): Failed opening required 'errors/configure_instructions.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public/gallery/errors/unconfigured.php on line 10

Any Ideas?? Its like it can't find the GAllery config without using a URL instead of an absolute path in the include.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-09-12 10:35

Make sure to set $GALLERY_BASEDIR properly at the top of the page that has the random block. It should be the full Unix path to your Gallery directory. Something like:

$GALLERY_BASEDIR = '/var/www/site.com/html/gallery/';

(be sure to include the trailing slash)

-Beckett (

)

 
medic119

Joined: 2003-03-05
Posts: 14
Posted: Fri, 2003-09-12 17:34

Thanks. Now the photos display, but the code kicks out the following error immediately before the photo:

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/user/public_html/snip.php:3) in /home/user/public_html/gallery/session.php on line 51

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/user/public_html/snip.php:3) in /home/user/public_html/gallery/session.php on line 51
 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sat, 2003-09-13 03:16

Okay. Move the include() line from the top of block-random.php to the very very top of the page you're displaying the random block on. As long as the call to load init.php is the first thing on the page, you won't get this warning.

-Beckett (

)

 
medic119

Joined: 2003-03-05
Posts: 14
Posted: Sat, 2003-09-13 12:29

OK, I don't have any include lines at the top of my random-block. I do have
require($GALLERY_BASEDIR . "init.php");
but moving that to the page top kills the entire page.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sun, 2003-09-14 08:31

Yep... that's the line i'm talking about.

Kills the page? How? Make sure the top of your page is:

<?php
$GALLERY_BASEDIR = '/path/to/gallery/';
require($GALLERY_BASEDIR . "init.php");
?>
...

I can't see how this will "kill" the page. Can you be more specific? A blank page entirely usually means a PHP syntax error somewhere.

-Beckett (

)

 
medic119

Joined: 2003-03-05
Posts: 14
Posted: Sun, 2003-09-14 14:53

Error generated:

Fatal error: Cannot redeclare fs_copy() (previously declared in /home/user/public_html/gallery/platform/fs_unix.php:22) in /home/user/public_html/gallery/platform/fs_unix.php on line 22
 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-09-15 22:35

Hrm... perhaps things are being included more than once.
Try changing "require" to "require_once" in all instances.

-Beckett (

)

 
medic119

Joined: 2003-03-05
Posts: 14
Posted: Tue, 2003-09-16 01:21

That got it. I had forgotten to comment out the require line in block-random, duh.

Thank you so much for taking the time tosolve my problems.

 
GravityArc
GravityArc's picture

Joined: 2003-02-27
Posts: 54
Posted: Fri, 2003-09-19 00:54

I'm running PHPNuke and some of my users who use Safari on their Macs are reporting this error. Which file would I move the require to? Mainfile.php?

Thanks.
-Ben