News:

Join the Facebook Fan Page.

Main Menu

SMF + Gallery2

Started by Oldiesmann, August 19, 2005, 06:33:43 PM

Previous topic - Next topic

Oldiesmann

I'm not sure if there is a patched 2.2 version.

The problem with Safe Mode is that it prevents scripts from touching files and folders they don't own. Apache runs under its own user account. When PHP is running as an Apache module, any files or folders created by PHP are owned by the Apache user. Any files and folders you upload via FTP will be owned by you. This means that Gallery won't be able to touch any files it creates (even though the script is owned by you, the files were created by PHP).

There are a couple of things you can try:

1. Ask your host to use open_basedir instead. This lets your host specify a "base" directory (the top-most directory that you can access), and PHP won't let you touch anything that's outside your base directory (although exceptions can be added - /tmp, /usr/lib/php, etc.). This accomplishes the same thing that safe mode is supposed to accomplish (prevent users from accessing stuff that isn't theirs) without the issues caused by restricting file ownership.

2. If they still won't listen, ask them to re-compile PHP in CGI mode with Apache's "SuExec" module installed. This will cause PHP to run as a separate process, and any files or folders created by PHP will be owned by the user executing the process. This causes a few annoying issues (PHP scripts must be chmodded to 755 if you want to execute them; 666 and 777 generally aren't allowed), but may be your only hope if you don't want to switch hosts.

If they still refuse, I would suggest switching to a better host. Safe Mode causes more problems than it solves, and has actually been removed for PHP 6. While SMF will run with Safe Mode enabled, the package manager doesn't work properly, and you may run into problems if you try to install themes through the admin center.

rasmuskarlsen

Quote from: Oldiesmann on May 17, 2007, 08:03:43 PM
I'm not sure if there is a patched 2.2 version.

The problem with Safe Mode is that it prevents scripts from touching files and folders they don't own. Apache runs under its own user account. When PHP is running as an Apache module, any files or folders created by PHP are owned by the Apache user. Any files and folders you upload via FTP will be owned by you. This means that Gallery won't be able to touch any files it creates (even though the script is owned by you, the files were created by PHP).

There are a couple of things you can try:

1. Ask your host to use hxxp:www.php.net/features.safe-mode#ini.open-basedir [nonactive] instead. This lets your host specify a "base" directory (the top-most directory that you can access), and PHP won't let you touch anything that's outside your base directory (although exceptions can be added - /tmp, /usr/lib/php, etc.). This accomplishes the same thing that safe mode is supposed to accomplish (prevent users from accessing stuff that isn't theirs) without the issues caused by restricting file ownership.

2. If they still won't listen, ask them to re-compile PHP in CGI mode with Apache's "SuExec" module installed. This will cause PHP to run as a separate process, and any files or folders created by PHP will be owned by the user executing the process. This causes a few annoying issues (PHP scripts must be chmodded to 755 if you want to execute them; 666 and 777 generally aren't allowed), but may be your only hope if you don't want to switch hosts.

If they still refuse, I would suggest switching to a better host. Safe Mode causes more problems than it solves, and has actually been removed for PHP 6. While SMF will run with Safe Mode enabled, the package manager doesn't work properly, and you may run into problems if you try to install themes through the admin center.


Okay i will try one of the solutions you have posted, but i doubt the would change anything, beacuse its a free web hotel... But when do i notice the problem with php can't create new folders? ANd touch existent folders? If i want to change a theme ex. then i can just upload it through FTP.

Alder

Is it possible to move photos and comments from an SMF Gallery to Gallery2?
Does anybody have a converter?

P.S. Sorry for my bad English. I`m from Ukraine :)

Oldiesmann

Quote from: rasmuskarlsen on May 18, 2007, 05:33:35 AM
Quote from: Oldiesmann on May 17, 2007, 08:03:43 PM
I'm not sure if there is a patched 2.2 version.

The problem with Safe Mode is that it prevents scripts from touching files and folders they don't own. Apache runs under its own user account. When PHP is running as an Apache module, any files or folders created by PHP are owned by the Apache user. Any files and folders you upload via FTP will be owned by you. This means that Gallery won't be able to touch any files it creates (even though the script is owned by you, the files were created by PHP).

There are a couple of things you can try:

1. Ask your host to use open_basedir instead. This lets your host specify a "base" directory (the top-most directory that you can access), and PHP won't let you touch anything that's outside your base directory (although exceptions can be added - /tmp, /usr/lib/php, etc.). This accomplishes the same thing that safe mode is supposed to accomplish (prevent users from accessing stuff that isn't theirs) without the issues caused by restricting file ownership.

2. If they still won't listen, ask them to re-compile PHP in CGI mode with Apache's "SuExec" module installed. This will cause PHP to run as a separate process, and any files or folders created by PHP will be owned by the user executing the process. This causes a few annoying issues (PHP scripts must be chmodded to 755 if you want to execute them; 666 and 777 generally aren't allowed), but may be your only hope if you don't want to switch hosts.

If they still refuse, I would suggest switching to a better host. Safe Mode causes more problems than it solves, and has actually been removed for PHP 6. While SMF will run with Safe Mode enabled, the package manager doesn't work properly, and you may run into problems if you try to install themes through the admin center.


Okay i will try one of the solutions you have posted, but i doubt the would change anything, beacuse its a free web hotel... But when do i notice the problem with php can't create new folders? ANd touch existent folders? If i want to change a theme ex. then i can just upload it through FTP.


As long as the folders and files are still owned by you, then yes, you can re-upload them. But you won't be able to do so if the files and/or folders are owned by Apache.

Quote from: Alder on May 19, 2007, 08:21:27 AM
Is it possible to move photos and comments from an SMF Gallery to Gallery2?
Does anybody have a converter?

P.S. Sorry for my bad English. I`m from Ukraine :)

There is no converter. However, it is possible to import items from SMF Gallery to Gallery2. See http://galleryproject.oldiesmann.us/index.php?topic=353.msg3532#msg3532 for more information.

Alder

Quote from: Oldiesmann on May 19, 2007, 02:16:01 PMThere is no converter. However, it is possible to import items from SMF Gallery to Gallery2. See http://galleryproject.oldiesmann.us/index.php?topic=353.msg3532#msg3532 [nofollow] for more information.
Ok. Thanx. I read this message. As far as I understood, comments moving is impossible? Or after import items it is possible manually moving comments through SQL queries from old gallery to Gallery2?

Oldiesmann

I'm not sure exactly how G2 stores comments to be honest with you, but it might be possible to import them. I'll look into that in a little while.

rasmuskarlsen

Is it possible to use this SMF > Gallery2 bridge.

And then again use an SMF > Joomla bridge!?

So all 3 applications run the same system (Login, logout ... ++++)

?

Oldiesmann

Quote from: rasmuskarlsen on May 23, 2007, 08:20:10 AM
Is it possible to use this SMF > Gallery2 bridge.

And then again use an SMF > Joomla bridge!?

So all 3 applications run the same system (Login, logout ... ++++)

?

Yep.

Just download and install the "NoBridge" package. That one doesn't use SMF's integration hooks, so it won't interfere with the Joomla bridge.

Pratt

Im having issues with the SSI's Functions  :(

Can please someone explain this a little bit more?

I have tried everyway possible (To me, i suck at php), but i still cant understand the comments on SSI.php

Ive been playing around, but nothing is been displayed

<?php ssi_g2RandomImage('type' = array(image), $outputMethod = 'echo') ?>
<?php ssi_g2ImageBlock($blocks = array(randomImage), $block_params = array('show' = 'none'), $output_method = 'echo'); ?>

Can someone give an example of how do this ssi functions should work?

BAlGaInTl

I would like to convert my SMF Lite gallery to use this new integration.

Does anyone know of a conversion utility or script out there for SMF Lite Gallery --> Gallery 2?

Oldiesmann

Quote from: Oldiesmann on May 19, 2007, 02:16:01 PM

Quote from: Alder on May 19, 2007, 08:21:27 AM
Is it possible to move photos and comments from an SMF Gallery to Gallery2?
Does anybody have a converter?

P.S. Sorry for my bad English. I`m from Ukraine :)

There is no converter. However, it is possible to import items from SMF Gallery to Gallery2. See http://galleryproject.oldiesmann.us/index.php?topic=353.msg3532#msg3532 for more information.

BAlGaInTl

Quote from: Oldiesmann on June 11, 2007, 03:28:01 PM
Quote from: Oldiesmann on May 19, 2007, 02:16:01 PM

Quote from: Alder on May 19, 2007, 08:21:27 AM
Is it possible to move photos and comments from an SMF Gallery to Gallery2?
Does anybody have a converter?

P.S. Sorry for my bad English. I`m from Ukraine :)

There is no converter. However, it is possible to import items from SMF Gallery to Gallery2. See http://galleryproject.oldiesmann.us/index.php?topic=353.msg3532#msg3532 for more information.

Hmmmm... looks like I have my work cut out for me then.

BAlGaInTl

#192
Well... I started working the new gallery... got it installed, and now I get the following error:

Error (ERROR_MISSING_OBJECT) : 1 GalleryUser in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 124 (gallerycoreapi::error)
in modules/core/classes/GalleryCoreApi.class at line 2290 (galleryentityhelper_simple::loadentitybyexternalid)
in modules/core/classes/GalleryEmbed.class at line 215 (gallerycoreapi::loadentitybyexternalid)
in modules/core/classes/GalleryEmbed.class at line 120 (galleryembed::checkactiveuser)
in /home/xxxx/domains/xxxx.com/public_html/ftest/Sources/Gallery.php at line 166 (galleryembed::init)
in ??? at line 0
in /home/xxxx/domains/xxxx.com/public_html/ftest/index.php at line 133


I've had it working before on a test forum, so I have no idea what is going on here.

I noticed someone earlier in this thread having a similar issue, but I don't think it was ever fully addressed.

Edit: I managed to get the admin account working, but all other groups give a different error now.  I decided to post over at the project forum in hope of getting some help there.  I don't want to clog up this thread for support.

Scrambled Egg

Please test the 1-DAY OLD installation on my site at

www.fotobuffs.com

BUT NO GARBAGE PLEASE (like test, test, etc.), since this is actually a 1-DAY OLD live site.&nbsp; Kindly post real stuff and actual images that you would normally post in any other photography site.&nbsp; Besides, you may very well want to use my site permanently in the future.&nbsp;

Please let me know if you encounter any problems.&nbsp; And remember, I am VERY new to PHP, VERY new to SMF, and VERY new to Gallery, so I cannot answer any questions on how to do this or do that, etc.&nbsp; But please do let me know if you encounter any problems such as error messages, etc.

Thanks.

wrongwood

I am sure this is such a basic question that you will all laugh however, I still need the answer.  After instally Gallery2.2 it works outside of my forum but not inside:  I keep getting this error.

Fatal error: showgallery() [function.require]: Failed opening required '/public_html/unigrip/forum/gallery/embed.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wrong4/public_html/unigrip/forum/Sources/Gallery.php on line 122

I saw where someone answered this question before by simply saying: "CHANGE YOUR PATH"
that doesn't help me I need to know how to create that path.  Please don't say look into the config.php file either.  That hasn't helped me as it still won't work when I use what I think is an exact path:  Quite frankly I don't know what an exact path is:  Could someone please give me an example of what to put in the SMF as an exact path:

Thank you...  I am using this now: /home/wrong4/public_html/unigrip/forum/gallery/g2data/

Kindred

#195
hmmm....

just tried installing the "no bridge" version of this.


Error (ERROR_MISSING_OBJECT) : 1 GalleryUser in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 124 (gallerycoreapi::error)
in modules/core/classes/GalleryCoreApi.class at line 2298 (galleryentityhelper_simple::loadentitybyexternalid)
in modules/core/classes/GalleryEmbed.class at line 215 (gallerycoreapi::loadentitybyexternalid)
in modules/core/classes/GalleryEmbed.class at line 120 (galleryembed::checkactiveuser)
in /..site../SMF/Sources/Gallery.php at line 147 (galleryembed::init)
in ??? at line 0
in /..site../SMF/index.php at line 131


edit note:   I scanned your board and found that this was apparently a common error, and some fixes...   however, all the other users work corretcly. only the admin user gives this error, despite me manually changing the smf_members table to tell it that I am a g2 user and the 6 guid
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

qubbah

exactly what must i put in

Path to gallery :

URL to Gallery :

my forum in : http://www.myurl.net/v10/index.php
and my gallery2 in : http://www.myurl.net/gallery2/main.php

how abour embed or bridging?

tq.

Oldiesmann

Path to gallery - the full path to your gallery directory
URL to gallery - http://www.myurl.net/gallery2

Embedded/Bridged - "Embedded" mode will display the gallery inside SMF. "Bridged" mode will redirect users to G2 instead of displaying it inside SMF.

Farix

I just installed the bridge on a test server, but I am unable to link the accounts between Gallery2 and SMF. I even wiped both and started from a fresh install to no avail.

The problem occurs when I lick on the gallery link and then type in the gallery password, which is also my SMF password. It then send me to a completely blank page. The server error log reads:

[Sat Aug 18 11:50:22 2007] [error] [client 192.168.1.100] PHP Fatal error:  verifyGalAccount() [<a href='function.verifyGalAccount'>function.verifyGalAccount</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;GalleryUser&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in C:\\Apache2\\htdocs\\forums\\Sources\\Gallery.php on line 571, referer: http://tohru/forums/index.php?action=creategalaccount

Gallery 2.2.2
SMF 1.1.3
Bridge Beta 3.1

Oldiesmann

That means that the G2 user object got corrupted somehow. Fortunately it's easy to fix :)

Sources/Gallery.php

Find
// We already loaded the user a while back...
$g2user = $_SESSION['g2user'];


Replace
// Reload the user object...
list($ret, $g2user) = GalleryCoreApi::fetchUserByUsername($context['user']['username']);

if($ret)
{
fatal_error($ret->getAsText());
}

Advertisement: