Xaraya and G2

RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 02:25

Hello all,

I have a Xaraya 1.0 RC3 site up and running with a fresh install, and a G2 multisite standalone install that is working as intended. I added the Gallery2 module, and set the 'mode.embed.only' to true.

Then I go to the Gallery 2 module admin page in Xaraya and add the relative path to the g2 site. I don't know what to set the include path to (I could use some help here).

When I click the 'Update Configuration' button, I get an error as follows:

Quote:
At: /home/virtual/site460/fst/var/www/html/g2/modules/core/classes/GalleryPlatform.class (Line: 622) mkdir(../../../cgi-bin): Permission denied

Explanation:
There is an error in the PHP code that is being processed

.

Is the Xaraya module trying to create a directory in my cgi-bin directory? Any ideas are appreciated.

~Desi

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 09:25

please post a phpinfo link
FAQ: What information is required when I ask for help in the forums?

i suspect that you're using suexec or so and that the user running the xaraya directory is another user than the one running the gallery2 directory.
or it may have something to do with open_basedir.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 19:50

PHPInfo Link:

http://69.94.117.92/g2/phpinfo.php

I'm showing the same user for both the xaraya and gallery (g2) directories, but when gallery is running and creating directories (Under the g2data directory, for instance) the directory owner is 'apache'. This is different from the owner of gallery and xaraya files and directories.

The directory structure is a follows:

/home
..|---vascouting
........|--mainwebsite_cgi
........|....|--g2data
........|..........|--brmc1412 (Site 1 of gallery multisite install)
........|
........|--mainwebsite_html
.............|--g2sites
.............|....|--brmc1412
.............|
.............|--g2
..................| (g2 core install)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 19:57

ah, cgi directory. so you're using php-cgi (directories are owned by you) for your g2 multisite and mod_php for xaraya (directories are owned by apache).

either both need to be in the cgi dir or both in the mainwebsite_html.

this is just a theory, but it's based on a few facts, e.g. you're using mod_suexec.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:18

Only the photos (g2data) are in the cgi directory. Otherwise, both the g2 and xaraya directories are under the mainwebsite_html directory. The g2sites directory contains the actual gallery multisites (The ones with main.php) - only the data is under the cgi directory.

Are you saying that my albums cannot be under the cgi directory? I guess I could move them, but I think that they still end up with the same owner. That is determined by the user context of the process that creates them, right?

I have done nothing to either xaraya or g2 to make them run under any context other than the default, and likewise I haven't set up either of them to run via either cgi or mod_php explicitly -- I guess that I'm assuming htat they would both run the same, but maybe not?

valiant, I can set you up with full access if you want - This is a brand new site and the DNS isn't even set up yet. :P You can feel free to poke around and see what you can...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 20:24

i see. so then my theory is wrong. since processes run in the context of the user where the script is started and that's in mainwebsite_html.
i still see no reason why to put g2data dirs in a cgi directory. g2data should be above the webroot, not accessible from the web. else the whole permission system of g2 (image firewall) can be circumvented.

to your problem:
please put a phpinfo in your g2/install/ folder and a phpinfo in your g2sites/brmc1412/ folder and a last one in your xaraya root dir.
then we can compare the user/group of the three.

instead of the phpinfo, maybe better use this in all three folders:
<?php system('whoami'); ?>

maybe chown -R the g2data folder to this user and it's hopefully fixed.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:35

g2sites/brmc1412/ folder:
http://69.94.117.92/g2sites/brmc1412/whoami.php

g2/install folder:
http://69.94.117.92/g2/install/whoami.php

xaraya folder:
http://69.94.117.92/whoami.php

Regarding the chown -R, I get "operation not permitted" when I try it.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:42

Here's a couple of comments that I received back from the support group at my hosting company. I asked them why, during my xaraya multisites installation, some of the directories received owners of '48' (apache) and others received an owner of 'vascouting' (my user account).

Quote:
One way to prevent it from happening in the future is switch php version to cgi version php instead of apache mod php. cgi version of php runs under domain basis. so the files created by script will be owned by domain main user. But please ensure it is applied to your script requirement.

To make this switch, try to create a file called .htaccess ( if file exists, just appends the file) in www with following directives:
php_flag engine off
Action php-script /interpreters/php-script AddHandler php-script .php .php4 .php3 .inc

Quote:
When comes to difference between cgi-php and mod_php, Somebody put it this way and it makes sense to me:

mod_php is a nickname for PHP compiled as an Apache module, whereas PHP (cli or cgi) refers to the standalone interpreter.

The functional difference is that mod_php is available within every httpd process. When Apache encounters a PHP script, it hands it off to its internal module for processing, then puts the output on the wire.

Standalone (cgi) PHP is run as a separate process: when Apache encounters a PHP script, it executes PHP as a command, passing the script and the $_SERVER environment. When suexec is involved, Apache runs the php command with the same uid as the owner of the script. The separation of processes allows the separation of powers. My understanding is that this is slightly less efficient, but it's certainly safer.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 20:51

the whoami files don't work, internal server error. but your webhost confirms my suspicion.
maybe, for some reason, not all of your index.php / main.php files are owned by the same user (either apache or vascouting). and that's the problem.

i guess your changing things right now, since nothing works on your box ATM.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:53

FYI, I tried including the two directives suggested above in my xaraya .htaccess file, and I got nothing but "http 500 - server errors".

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:54

I was trying the .htaccess directives. The whoami scripts all showed 'apache' when I ran them...

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 20:58

Perhaps I'm not setting the include path in xaraya and I should be? The mainwebsite_html and mainwebsite_cgi directories are really /var/www/html and /var/www/cgi-bin if I go down to the root in my ftp client and back up. 'vascouting' is the owner of both directories.

The error message indicates that it is trying to make a directory in "../../../cgi-bin", which would equate to the /var/www/cgi-bin directory according to this structure.

What directory gets created when it's in embedded mode but not in standalone mode? Could I create the directory manually, which would make 'vascouting' the owner?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 21:09

nothing special gets created when it's in embedded mode. it just does the normal g2 stuff, cache some stuff in g2data/cache/, that's it.

where's your xaraya root directory?
assuming it's in
........|--mainwebsite_html

then the relativeG2Path that you should enter is g2sites/brmc1412

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 21:14

That's the relative path, but there's also an 'include path', and I don't know what to set it to.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 21:16

as the text says, leave it just empty. it will figure out the include path on its own.

where xaraya installed, what path?

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 21:24

Xaraya is right where you said, in 'mainwebsite_html'.

I'm thinking that I'll get the cgi php working via .htaccess, and then move the g2data directory up one level, so that it is a sibling to the 'mainwebsite_cgi' directory, instead of a child under it.

Does that sound like it might work, or am I wasting my time?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-29 21:27

what's the value it figured out for your include path?

i'd try a few things, this should work. don't know how you managed to screw it up :)

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Thu, 2005-09-29 21:53

heheh, it never did figure out a value for an include path, unless it didn't tell me about it. I enter the relative path, leave the include path blank, and press the button. The next thing I see is the error in the first post.

As usual, the problem is more than likely behind the keyboard, rather than in the computer. :)

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Sun, 2005-10-02 16:47

After much gnashing of teeth, I have reconfigured gallery so that the g2data is stored under the html directory (Forget the image firewall for now), as follows:

/home
..|--vascouting
......|
......|--mainwebsite_html
..........|--g2sites
..........|....|--brmc1412 (Site 1 of gallery multisite install)
..........|........|--g2data (Data for Site 1)
..........|
..........|--g2
..............| (g2 core install)

and I ran Bharat's Cleanup.php script against the directories from /g2sites/brmc1412 and lower. This should change the permissions to 755 on directories and 666 on files.

I then changed the permissions on the /mainwebsite_html/g2sites and /mainwebsite_html/g2sites/brmc1412 directories to 777 so that the integration plugin can write and create a directory if it needs to.

When I enter Xaraya and enter the "Modify Config" page, I enter ./g2sites/brmc1412 in the relative path and click the button, and I get:

PHP: Warning
At: /home/virtual/site460/fst/var/www/html/g2/modules/core/classes/GalleryPlatform.class 
   (Line: 622) mkdir(../../g2sites): Permission denied

Notice that the mkdir path has changed, but I still get the permission denied error.

Why is it trying to do a mkdir at all? It looks like it's trying to do it from the GalleryPlatform.class file, but why would the integration module kick off a directory creation?

Any ideas?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-10-02 17:49

ah, that remembers me of another issue. but i'm not sure what the reason was.
what's the storage path in your brmc1412/config.php ?`

let's try it this time with specifying the include path explicitely:

relative path:
g2sites/brmc1412
include path:
/home/vascouting/mainwebsite_html/g2sites/brmc1412/
hit ok.

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Mon, 2005-10-03 01:34

I get the same result (../../g2sites permission denied). For the include path, I have to use

/home/virtual/site460/fst/var/www/html/g2sites/brmc1412/

since the mainwebsite_html directory is really

/home/virtual/site460/fst/var/www/html/

Could it be something with multisites interacting with the integration module? It seems like it's trying to do something in the /g2sites directory, and neither of the paths that I gave it pointed there...

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-10-03 19:05

with what urls do you access your xaraya and your g2 standalone (multisite) sites ?

 
RDR

Joined: 2005-09-29
Posts: 16
Posted: Mon, 2005-10-03 21:39

Xaraya: http://brmc1412.vascouting.org (Using multisites module)

Gallery: http://brmc1412.vascouting.org/g2sites/brmc1412 (Multisite install. Core files are at http://brmc1412.vascouting.org/g2)

NOTE: These might not be in DNS yet, so I'll send you the IP in a private message and you can add it to your HOSTS file.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-10-04 08:18

maybe this has to do with your virtual thing. i don't really understand it and i don't have time to debug it right now. sorry.