Pixelpost Forum

Pixelpost Forum (http://www.pixelpost.org/forum/index.php)
-   Bug Report 1.4.x (http://www.pixelpost.org/forum/forumdisplay.php?f=19)
-   -   Incorrect detection of $images_path in includes/create_tables.php during installation (http://www.pixelpost.org/forum/showthread.php?t=2768)

lemuelf 11-30-2005 11:26 AM

Incorrect detection of $images_path in includes/create_tables.php during installation
 
Not a serious problem, since it seems that I'm the only one having this kind of setup, but I think it's better if we could also eliminate this...

I am setting up pixelpost for a friend and I downloaded version 1.4.3 and installed it on our test server here at work, for my friend to try it first before installing in his own webspace.

We are using apache2's mod_userdir, which means that each user on our server has their own 'document_root' in their own homes. On our current setup it's the 'public_html' subdirectory and it is accessible thru a URI like http://example.org/~lemuelf. I followed the installation instructions and after logging in as the admin user and tried posting a photo, it went through _without any errors_ but no photo got uploaded and no entry in the database. I checked the configs and found that the images path was set to '/srv/www/htdocs/~lemuelf/pixelpost_1.4.3/images/', which I have to change then to '/home/lemuelf/public_html/pixelpost_1.4.3/images/' to make posting photos work.

Although, this kind of setup is rare and the problem can be easily fixed by changing the configuration settings, I'd like to suggest a little modification in the $images_path detection code in the 'includes/create_tables.php' script so it will also work in a server setup just like ours (and those that don't have the scripts and 'images' directory under the 'document_root', like 'alias' setups) immediately after running the install script.

In the function 'Set_Configuration()' in 'includes/create_tables.php'
replace lines 147-150:
PHP Code:

$images_path $_SERVER['DOCUMENT_ROOT'];
$images_path .= $_SERVER['SCRIPT_NAME'];
$images_path pathinfo($images_path);
$images_path $images_path['dirname']; 

with
PHP Code:

$images_path realpath('./'); 

(not sure if function 'realpath' works in windows, though. We only have GNU/Linux boxes :))

or, if realpath doesn't work, in lines 147-148 instead of
PHP Code:

$images_path $_SERVER['DOCUMENT_ROOT'];
$images_path .= $_SERVER['SCRIPT_NAME']; 

change it to
PHP Code:

$images_path $_SERVER['SCRIPT_FILENAME'

which is the real filesystem path of the script file. (Check the output of phpinfo() to see if the 'SCRIPT_FILENAME' variable is available with other web servers, we only have apache2 :))

tinyblob 11-30-2005 12:10 PM

Lemuelf, excellent bug report.. Pixelpost would be running really smooth if everyone was as helpful as you.

I still don't have my "lab" up and running fully, so it'll be a while before i can run cross platform tests, but with the information you've provided one of us will fix the issue. It'll be in v1.5, or a subsequent patch.

Unless this issue has already been resolved - guys?

raminia 11-30-2005 12:10 PM

thanks!

Joe[y] 11-30-2005 03:12 PM

SCRIPT_FILENAME is a-ok on PHP Version 4.3.11 running on Apache/1.3.33 (Unix)

blinking8s 12-01-2005 01:47 AM

man...i wish we god bug reports this detailed all the time

lemuelf 12-01-2005 10:48 AM

No problem. It's a personal itch that really needs some scratching.

I'll contribute more when I come across some other bugs.

Anyway, thank you for the great software, guys! It's really nice to find an _opensource_ blog made specifically for photos ;)


All times are GMT. The time now is 12:00 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.