Page 2 of 2

Posted: Wed Jan 18, 2006 5:10 pm
by elf2000
Why guest?
This guest is elf2000.

Posted: Wed Jan 18, 2006 5:33 pm
by garvinhicking
This is very strange, I don't know why it works for me then. I'll investigate it thoroughly this weekend!

Regards,
Garvin

Posted: Wed Jan 18, 2006 5:50 pm
by elf2000
I am guesses with this information.
My config was:

/usr/local/lib/php/s9y -- s9y repository
/var/www/ -- document root
/var/www/serendipity/s9y-01/
"/var/www/serendipity/s9y-01/" is included in "/var/www/".
Garvin is writing that "/var/www/" is docroot.
That is, /var/www/serendipity/s9y-01/is also docroot.
In that case, this processing is performed.

Code: Select all

function serendipity_query_default($optname, $default, $usertemplate = false, $type = 'string') {
(snip)
    switch ($optname) {
(snip)
        case 'serendipityPath':
            $test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';
(snip)
            if (file_exists($test_path1 . 'serendipity_admin.php')) {
                return $test_path1;
(snip)
}
That is, it can interpret like this.

Code: Select all

function serendipity_query_default($optname, $default, $usertemplate = false, $type = 'string') {
(snip)
    switch ($optname) {
(snip)
        case 'serendipityPath':
            $test_path1 = "/var/www/" . rtrim(dirname("/serendipity/s9y-01/serendipity_admin.inc.php"), '/') . '/';
(snip)
            if (file_exists($test_path1 . 'serendipity_admin.php')) {
                return $test_path1;
(snip)
I was not able to find the information which you have installed in public_html.
I am sorry if a mistake exists. :oops:
I expect the survey in a weekend. :wink:

Posted: Fri Jan 20, 2006 1:41 pm
by garvinhicking
I think I've found the problem. Your server doesn'T seem to set $_SERVER['PHP_SELF'].

The first $test_path1 check should in your case return the directory! The $test_path2 is used for NON-Shared installs.

Please try this patch:

http://nopaste.php-q.net/185833

Regards,
Garvin

Posted: Fri Jan 20, 2006 3:35 pm
by elf2000
ahhh... I am disappointed...

I performed svn update.

Code: Select all

            if (empty($_SERVER['PHP_SELF'])) {
                $test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['SCRIPT_FILENAME']), '/') . '/';
            } else {
                $test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';
            }
Please see:
http://elf.no-ip.org/~user01/

Why do you adhere to DOCUMENT_ROOT?
Please install s9y outside DOCUMENT_ROOT.
Otherwise, you are not find this problem.

Posted: Fri Jan 20, 2006 3:50 pm
by elf2000
...

I review the code of Garvin, Let's go!

I access this URL by a browser.

http://elf.no-ip.org/~user01/serendipity_admin.php

The following setup to $_SERVER.

Code: Select all

$_SERVER['DOCUMENT_ROOT'] = '/var/www/html';
$_SERVER['PHP_SELF'] = "/~user01/serendipity_admin.php";
$_SERVER['SCRIPT_FILENAME'] = '/home/user01/public_html/serendipity_admin.inc.php';
$_SERVER['PHP_SELF'] is set up in my environment.
However, let's assume that it was not set up.

Code: Select all

unset( $_SERVER['PHP_SELF']);
#This has not happened in my server.

This is the new code of Garvin.

Code: Select all

if (empty($_SERVER['PHP_SELF'])) {
This is true. Therefore, this code is executed.

Code: Select all

$test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['SCRIPT_FILENAME']), '/') . '/';
A variable is extract.

Code: Select all

$test_path1 = '/var/www/html' . rtrim(dirname('/home/user01/public_html/serendipity_admin.inc.php'), '/') . '/';
A variable is more extract.

Code: Select all

$test_path1 = '/var/www/html' . rtrim('/home/user01/public_html', '/')
A variable is more extract.

Code: Select all

$test_path1 = '/var/www/html' . '/home/user01/public_html' .  '/'
A variable is more extract, and finish.

Code: Select all

$test_path1 = '/var/www/html/home/user01/public_html/';
Where is this file? :roll: :roll: :roll:

Posted: Fri Jan 20, 2006 4:57 pm
by garvinhicking
Hi elf!

Installing serendipty from a directory that is not within the subdirectory of DOCUMENT_ROOT is not supported.

How does that happen on your server? How can it happen that you access a directory via HTTP that is outside of DOCUMENT_ROOT? I do not understand that.

Regards,
Garvin

Posted: Fri Jan 20, 2006 5:18 pm
by elf2000
hahaha Garvin,

( = =)...

Do you know/use UserDir directive?
http://httpd.apache.org/docs/2.0/en/mod ... erdir.html

The company prepared the directory for webs for office staff.
Usually, a directory becomes the following.

/home/<staff-name>/

The following was prepared for webs.

/home/<staff-name>/public_html/

URL becomes the following.

http://www.example.com/~<staff-name>/

The server guardian looked for the web log system.
The system needs a shared feature.
Then, he chose s9y.

He installed the core.

Code: Select all

# mkdir -p /usr/local/lib/php
# cd /usr/local/lib/php
# tar zxf serendipity-0.9.1.tar.gz
# mv serendipity s9y
(snip)
He planned to be an office staff and to share this core.

There is a one office staff.
His name is called taro.

He did installation work.

$ mkdir public_html
$ cd public_html
$ cp -a /usr/local/lib/php/s9y/deployment/* .
(snip)

...

It is the often seen scenery.
A company may be replaced to ISP.
A company may be replaced to a school.

Don't you really know?

Posted: Fri Jan 20, 2006 8:28 pm
by judebert
Interesting. I never thought about the user dirs before.

Serendipity really isn't designed for that configuration (shared with libs outside of the local document tree). It uses relative paths for lots of stuff, and the server will prevent access outside the user's home directory, even for the PHP calls.

You could give each user his own copy. Or create symlinks to the PHP libraries for him.

Posted: Fri Jan 20, 2006 8:58 pm
by elf2000
judebert,

The work is mitigable if my patch is used.
Although a new constant increases, there are not the original installation method and a change.

My patch does not use a relative path at least now (URL and file system).

However, My patch may still need to make some modification.
I think that there are also conditions which I cannot assume.
I think that there are also cases which I cannot assume.
Modification will be considered if there is a problem.
Modification of a patch will be considered if there is a problem.
Please give a concrete issue and an advice.