Page 1 of 2

Shared installation

Posted: Tue Nov 29, 2005 4:32 pm
by markw
I did a little work on shared install, I have a script and a little mod.

You have to move the function "serendipity_query_default" from "include/functions_installer.inc.php" to "serendipity_config.inc.php"


#!/bin/sh
WEBUSER=[webuser name]
WEBGROUP=[web server group]
SRCROOT=/usr/local/lib/php
SRCDIR=$SRCROOT/s9y
DESTDIR=/opt/www/htdocs/$1


#
# Remove any existing directory
#
rm -rf $DESTDIR


#
# Start fresh
#
mkdir $DESTDIR
chmod ug+wrx $DESTDIR

#
# Make user writeable directories
#
mkdir $DESTDIR/uploads
mkdir $DESTDIR/archives
mkdir $DESTDIR/templates_c

#
# Link all relevent files and directories
#
ln -s $SRCDIR/bundled-libs $DESTDIR
ln -s $SRCDIR/htmlarea $DESTDIR
ln -s $SRCDIR/lang $DESTDIR
ln -s $SRCDIR/plugins $DESTDIR
ln -s $SRCDIR/sql $DESTDIR
ln -s $SRCDIR/templates $DESTDIR
ln -s $SRCDIR/include $DESTDIR
ln -s $SRCDIR/*.php $DESTDIR
ln -s $SRCDIR/*.js $DESTDIR

#
# Clean up all the *non* linkable PHP
#
rm -f $DESTDIR/serendipity_config.inc.php
cp $SRCDIR/serendipity_config.inc.php $DESTDIR

# Make sure all correctly owned
#
chown -R $WEBUSER:$WEBGROUP $DESTDIR


# Set permissions
#
chmod ug+wrx $DESTDIR/uploads
chmod ug+wrx $DESTDIR/templates_c
chmod ug+wrx $DESTDIR/archives

??

Posted: Mon Dec 26, 2005 5:44 pm
by Tribal-Dolphin
For me, it don't works.
I see a wrong path in the installer and after installation, i see again the installation page.
An idea ?

Re: ??

Posted: Mon Dec 26, 2005 9:02 pm
by garvinhicking
I replied in your other question thread.

Regards,
Garvin

Do not install for shared s9y.

Posted: Mon Jan 16, 2006 4:38 pm
by elf2000
I have also challenged share installation.
I failed in the work by original s9y.

http://elf.no-ip.org/~elf/contribute/se ... -steps.txt

It is because original s9y must be installed in docroot.
I do not installed in docroot.

* case in docroot:
In docroot, it checks on the basis of URL.

Code: Select all

$test_path1 = $_SERVER['DOCUMENT_ROOT'] . rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';
if (file_exists($test_path1 . 'serendipity_admin.php')) {
    //  In docroot, this is processed.
    return $test_path1;
}
* case in not docroot(i.e. public_html)

In not docroot, It is based on the path of include/function_install.php.

Code: Select all

$test_path2 = serendipity_getRealDir( __FILE__);  // shared s9y.
if (file_exists($test_path1 . 'serendipity_admin.php')) {
    //  Do not processed.
    return $test_path1;
} else {
    //  In not docroot, this is processed.
    return $test_path2;
}
therefore, when it installs to no docroot, directory of base, templates_c and uploads is set shared side.

I changed include/function_install.inc.php and solved this problem.

Next problem,

Installation is completed, and when using it, there is a problem also on serendipit_config.inc.php.

Since it is using __FILE__, it is that directory of base, templates_c and uploads is set to a shared side.

I changed serendipit_config.inc.php and solved this problem.

see:
http://elf.no-ip.org/~elf/contribute/se ... l-01.patch

The following is my environment:
Server OS: Fedora Core 1(+rawhide(kernel 2.6.15/glibc2.3.90,etc...)
PHP: PHP 4.4.2(original rpm)
MySQL: MySQL 4.0.22(from MySQL AB)
Client OS: Windows 2000 SP 4, XP SP2
Browser: Internet Explorer 6SP1, Firefox 1.5

I create another patch

Posted: Tue Jan 17, 2006 6:33 pm
by elf2000
I create another patch.
The point of this patch is defining the constant for data(i.e. S9Y_DATA_PATH).

http://elf.no-ip.org/~elf/contribute/se ... l-02.patch

Usage:
* Install and patch serendipity core
$ cd /usr/share/php
$ sudo tar zxf serendipity-0.9.1.tar.gz
$ sudo mv serendipity s9y
$ patch < s9y-shared-install-01.patch

* Work on local area(i.e. /home/user01/public_html)
$ cd /home/user01/public_html
$ cp -pr /usr/share/php/s9y/deployment/* .
$ ln -s /usr/share/php/s9y/templates .
$ chmod o+w archives templates_c uploads
echo 'php_value $ include_path "./:/usr/share/php/:/usr/share/php/s9y/:/usr/share/php/s9y/bundled-libs/"' > .htaccess

# I want to rearrange handling of a 'templates' directory.

* Database setup
same basic installation;)

* Browser access
Access to http://www.example.com/~user01/
Next step, Same as the basic installation work.

Re: I create another patch

Posted: Wed Jan 18, 2006 8:38 am
by garvinhicking
Tadashi, did you read my IRC message from a day before? I tested it on my server with subdirectories, and there it worked all fine.

This leads me to believe that your server is not properly returning the path for a "__FILE__" constant, maybe because your webserver is Aliasing the directory, or using other means to not resolve symlinks.

Best regards,
Garvin

Posted: Wed Jan 18, 2006 11:36 am
by elf2000
garvin, Can you write work sequence?

I tried on the method near this URL again.
http://www.s9y.org/41.html

http://elf.no-ip.org/~elf/contribute/se ... teps-2.txt

I access http://example.com/~user01/ using a browser.
It result failed.
> Permissions
> /usr/local/lib/php/s9y/ Not writable
> /usr/local/lib/php/s9y/templates_c Not writable
> /usr/local/lib/php/s9y/uploads/ Not writable

http://elf.no-ip.org/~elf/contribute/se ... failed.png

This is a result as I imagined.
I have done no tricky things.

Regards!!

Posted: Wed Jan 18, 2006 11:42 am
by garvinhicking
I tried the same steps like yours, but I did not change the permissions on the s9y folder.

Can you please try the same with your /usr/local/lib/php/s9y being 777? If it works then, we have a culprit, and just the permission checks need to be adjusted. jtate changed that a few weeks ago -- in my case the dir was 777 so it wouldn't report an error there.

Because the actually used directory later was a different one.

Regards,
Garvin

Posted: Wed Jan 18, 2006 12:04 pm
by elf2000
The method shares serendipity_local_config.inc.php and database between all the members.
This is not very good for an ASP use.

Posted: Wed Jan 18, 2006 12:14 pm
by garvinhicking
In my example those files were created in the "public_html" directory, just like intended.

My config was:

/usr/local/lib/php/s9y -- s9y repository
/var/www/ -- document root
/var/www/serendipity/s9y-01/

The config_local file was correctly saved in /var/www/serendipity/s9y-01/.

I am using Apache 1.3.33, PHP 4.4.1 and no mod_alias or mod_userdir or other things.

Regards,
Garvin

Posted: Wed Jan 18, 2006 12:28 pm
by elf2000
/var/www/ -- document root
/var/www/serendipity/s9y-01/
This is not the outside of docroot.

Case my procedure, The file was created by "/usr/local/lib/php/s9y/".
I have already explained this difference.
It is because original s9y must be installed in docroot.
I do not installed in docroot.
[/quote]

Posted: Wed Jan 18, 2006 12:44 pm
by garvinhicking
Hi!
elf2000 wrote:
/var/www/ -- document root
/var/www/serendipity/s9y-01/
This is not the outside of docroot.
I meant, it is not WITHIN the same directory as the document root pointed to. I thought that was the whole issue of your problem - that the directory was not the same as the document root of a vhost container.

Of course the "personal" blog must be within a document root of a vhost.
Case my procedure, The file was created by "/usr/local/lib/php/s9y/".
I have already explained this difference.
But this is not how it is on my host. With straight Serendipity 1.0-alpha2, no files get installed into /usr/local/lib/php/s9y/.

Regards,
Garvin

Posted: Wed Jan 18, 2006 4:01 pm
by elf2000
I tried s9y version 1.0-alpha2(svn trunk now)

http://elf.no-ip.org/~elf/contribute/se ... teps-3.txt

It is processed as implemented.

elf.no-ip.org is not a virtual host.
It is the global domain of apache.

I tried in other environments.

OS:FreeBSD 5.4-STABLE #1
apache: 2.0.55
PHP: 5.1.2

The virtual host is not used.
A setup is a global setup.
I installed s9y in /home/elf/public_html/s9y.

Is there any method of otherwise checking?
Should I just test also on Windows?

cu :shock:

Posted: Wed Jan 18, 2006 4:24 pm
by garvinhicking
I think the problem is FreeBSD. I only test with Linux. The steps you described work for me in Linux; the serendipity_config_local.inc.php is created in public_html, not in /usr/... on my Linux.

It seems that FreeBSD is not translating __FILE__ or getrealpath() the way like Linux.

Regards,
Garvin

Posted: Wed Jan 18, 2006 5:00 pm
by Guest
Garvin,

I test Linux and FreeBSD.
Linux was checked by Fedora Core 1, 4 and CentOS 4.2.
It is the same result altogether.

in function_installer.inc.php
$test_path2 = serendipity_getRealDir( __FILE__);
As for this, Linux and FreeBSD return /usr/local/lib/php/s9y/.

This file exists in "/usr/local/lib/php/s9y/include/".
That is, it can interpret like this.
function serendipity_query_default($optname, $default, $usertemplate = false, $type = 'string') {
(snip)
switch ($optname) {
(snip)
case 'serendipityPath':
(snip)
$test_path2 = serendipity_getRealDir( "/usr/local/lib/php/s9y/include/function_installer.inc.php");
(snip)
function serendipity_getRealDir($file) {
$dir = str_replace( "\\", "/", dirname($file));
$base = preg_replace('@/include$@', '', $dir) . '/';
return $base;
}
serendipity_getRealDir() returns "/usr/local/lib/php/s9y/."
serendipity_query_default() also returns it.
And serendipity_config_local.inc.php, archives, templates_c, and uploads is created, checked using it.

Is this explanation wrong?