Jump to content



Latest News: (loading..)

- - - - -

HELP! - NOTHING WORKS! safe mode restriction / tmp issue


This topic has been archived. This means that you cannot reply to this topic.
17 replies to this topic

#-19   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 12:58 AM

I really hope someone can help.

I'll start at the beginning. (site names changed for privacy)

Currently have "site1.com.au" with catalog at "site1.com.au/catalog" - this one works fine, catalog is perfect.

Due to host company being too expensive and limiting on site storage space, set up a new site "site2.com" with new hosting company.

Trying to move "site1.com.au" to "site2.com"

copied "catalog" folder and mysql tables over to "site2.com"

had a few issues, and working with suggestions in these forums have ironed most of them out.

The last issue I have I haven't been able to resolve with the suggestions from here.

Came up with these errors (private info ***'d out):

Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 2934 is not allowed to access /tmp owned by uid 0 in /home/********/public_html/catalog/includes/functions/sessions.php on line 148

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/********/public_html/catalog/includes/functions/sessions.php:148) in /home/********/public_html/catalog/includes/functions/sessions.php on line 97

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/catalog/includes/functions/sessions.php:148) in /home/********/public_html/catalog/includes/functions/sessions.php on line 97

So far as these three warnings, I've searched on here and tried ALL the suggestions - change line 136 of mysql configuration table to "tmp" to "../tmp" to "../../tmp" to "" and they all do the same thing - gets rid of the warnings BUT changes the site so all my configuration is gone... none of the item images show up and none of my page or text colours show up, although my customisation of the page layout seems to still be there.

WHAT IS GOING ON???? I don't get it... My thoughts are that it has to be something in the configuration.php file which I've modified. Here is my version with private info ***'d or site2'd out:

<?php
/*
  $Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
  define('HTTP_SERVER', 'http://www.site2.com'); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', 'https://secure.site2.com'); // eg, https://localhost - should not be empty for productive servers
  define('ENABLE_SSL', false); // secure webserver for checkout procedure?
  define('HTTP_COOKIE_DOMAIN', 'site2.com');
  define('HTTPS_COOKIE_DOMAIN', 'site2.com');
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/catalog/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
  define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/');
  
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
  define('DB_SERVER_USERNAME', '********');
  define('DB_SERVER_PASSWORD', '********');
  define('DB_DATABASE', '*******_osc2');
  define('DB_TABLE_PREFIX', 'osc2_');
  define('USE_PCONNECT', 'false'); // use persistent connections?
  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
?>


My catalog/admin side of things is coming up with an "500 Internal Server Error" which is also a problem, but I figure I'll try to get the catalog part running first then attack the admin part.

Any suggestions please? Much appreciated...

Edited by wuiske, 05 February 2011 - 01:11 AM.


#-18   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 01:15 AM

I should add that when the errors were there the catalog was showing with all the right colours and pictures.


Another thought, is there anywhere else that points to "/tmp" which should be changed????

ETA: Nope, scratch that last thought... the only other spot in mysql that comes up with tmp is line 124 Cache Directory DIR_FS_CACHE /tmp/
tried changing that to tmp/ and tmp and made no difference. Other than that in countries table comes up with %tmp% but I can't see how that would be related.

Edited by wuiske, 05 February 2011 - 01:24 AM.


#-17   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 05:37 AM

Still stuck banging my head against a brick wall with this one...

Anyone have any idea how to get this sorted?

Please?

Pretty please?

With sugar and cherries on top?

#-16   pdcelec

pdcelec
  • Members
  • 606 posts

Posted 05 February 2011 - 12:35 PM

View Postwuiske, on 05 February 2011 - 05:37 AM, said:

Still stuck banging my head against a brick wall with this one...

Anyone have any idea how to get this sorted?

Please?

Pretty please?

With sugar and cherries on top?

Try this below. Assumes catalog to be the root and ssl enabled
<?php
/*
  $Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2003 osCommerce
  Released under the GNU General Public License
*/
// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
  define('HTTP_SERVER', 'http://www.site2.com'); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', 'https://secure.site2.com'); // eg, https://localhost - should not be empty for productive servers
  define('ENABLE_SSL', true); // secure webserver for checkout procedure?
  define('HTTP_COOKIE_DOMAIN', 'www.site2.com');
  define('HTTPS_COOKIE_DOMAIN', 'www.site2.com');
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/catalog/');
  define('DIR_WS_HTTPS_CATALOG', '/catalog/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
  define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/');
  
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
// define our database connection
  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
  define('DB_SERVER_USERNAME', '********');
  define('DB_SERVER_PASSWORD', '********');
  define('DB_DATABASE', '*******_osc2');
  define('DB_TABLE_PREFIX', 'osc2_');
  define('USE_PCONNECT', 'false'); // use persistent connections?
  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'


#-15   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 12:51 PM

pdcelec, thank you for your suggestion, however no luck.

I've changed as you suggested to "www" for the WS_COOKIES lines and set ssl to true (I don't have SSL set up in any way, unless it's automatically included? Something I need to look into once I get the main part of the catalog working...) however it's made no change. So currently my configure.php file reads exactly as you have laid out.

I just don't get why it works if the MySQL table line 136 "Session Directory" SESSION_WRITE_DIRECTORY value is "/tmp" - all my colours and text appear fine then, but the warnings are evident - but as soon as I change that value to "tmp" without the forward slash the warnings disappear but so does my formatting... I just don't understand it?

ETA: the "root" directory of my catalog is at www.site2.com/catalog/ because the catalog forms part of the site only. The rest of the site is html coded and runs from the root directory of the site, ie www.site2.com (www.site2.com/index.htm)

Edited by wuiske, 05 February 2011 - 12:57 PM.


#-14   Xpajun

Xpajun
  • Members
  • 1,295 posts

Posted 05 February 2011 - 01:41 PM

Just 2 things...


Have you checked with your hosting company about what "SAFE MODE Restriction in effect" is in effect?

second

  define('DB_DATABASE', '*******_osc2');
  define('DB_TABLE_PREFIX', 'osc2_');

In the first you have your database name followed by the suffix _osc2
In the second you have a prefix of osc2_

In the first your database name might be given a prefix or a suffix by your host eg your database name is oscommerce and your hosting user name is buystuff then your database name will be appended to buystuff_oscommerce - the same will happen on your username and password: buystuff_username, buystuff_password

The second is something I haven't seen for years...

That table define is not in either configure file as standard but would have been used a lot with hosts that only allowed you one database - One database can have many tables, in order to have 2 or 3 stores (as an example) using only one database you could add a prefix  to each table name so you could get osc1_orders and osc2_orders etc. so you could run 2 stores from the same database with identical names but differentiated by a prefix.

If you have a decent host you shouldn't need this any more - most hosts will allow you more than one database now

The question is: do your tables in your database all begin with osc2_ ?

#-13   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 03:10 PM

Hi Xpajun, thank you for your time...

View PostXpajun, on 05 February 2011 - 01:41 PM, said:

Have you checked with your hosting company about what "SAFE MODE Restriction in effect" is in effect?

No, I am going by everything said on the forums here that point to it being a Safe Mode restriction. When I first copied the files over it was coming up with various errors, one by one which I have fixed based on advice in these forums. Everyone who had the same issues noted it was due to Safe Mode Restriction. Although I haven't asked my new host about it, I am pretty confident in the belief that it would be a safe mode thing due to the fact that it's a massive company (Crazy Domains) who likely have multiple users on their servers. I didn't know there were different types of Safe Modes?


View PostXpajun, on 05 February 2011 - 01:41 PM, said:

  define('DB_DATABASE', '*******_osc2');
  define('DB_TABLE_PREFIX', 'osc2_');

In the first you have your database name followed by the suffix _osc2
In the second you have a prefix of osc2_

In the first your database name might be given a prefix or a suffix by your host eg your database name is oscommerce and your hosting user name is buystuff then your database name will be appended to buystuff_oscommerce - the same will happen on your username and password: buystuff_username, buystuff_password

The second is something I haven't seen for years...

That table define is not in either configure file as standard but would have been used a lot with hosts that only allowed you one database - One database can have many tables, in order to have 2 or 3 stores (as an example) using only one database you could add a prefix  to each table name so you could get osc1_orders and osc2_orders etc. so you could run 2 stores from the same database with identical names but differentiated by a prefix.

If you have a decent host you shouldn't need this any more - most hosts will allow you more than one database now

The question is: do your tables in your database all begin with osc2_ ?

It is your first assumption.
  define('DB_DATABASE', '*******_osc2');   <-- *** is my user name with my host company, osc2 is the database name
  define('DB_TABLE_PREFIX', 'osc2_');	  <-- osc2_ is the correct prefix for the table

Effectively what happened is that when I originally set up the catalog on our original website, I think I stuffed something up, and then reinstalled it with a new table (this is going back about 6 or 7 years), hence I do have two tables, osc1 and osc2. I've created tables with these names on the new host and then imported the data from osc1 (old) to osc1 (new) and from osc2 (old) to osc2 (new). I thought I'd transfer both over either though I'm pretty sure that osc1 is superfluous, as a "just in case" - if nothing points to it it won't be used or interfering, as I had both tables on the old site and it worked fine.

I'm not coming up with any errors about accessing the data in the tables, the database name, user name and password are correct in my configure.php because it is bringing up the item names, prices, etc. (I know this because during the transfer to the new site I had my password incorrect by accident in the file and it came up with the password error and I fixed that)

The only issue I have is that when the /tmp is changed to tmp I lose my text and colour formatting and images.
I've been going by these fixes: http://forums.oscommerce.com/topic/184161-safe-mode-restrictions/ and http://forums.oscommerce.com/topic/184484-fix-warning-session-save-path/page__st__20
If I don't change the /tmp in the database, the catalog shows up perfectly with all text and colour formatting and catalog images showing, except it has the three errors at the top of the page:


Warning: session_save_path() [function.session-save-path]: SAFE MODE Restriction in effect. The script whose uid is 2934 is not allowed to access /tmp owned by uid 0 in /home/********/public_html/catalog/includes/functions/sessions.php on line 148

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/********/public_html/catalog/includes/functions/sessions.php:148) in /home/********/public_html/catalog/includes/functions/sessions.php on line 97

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/catalog/includes/functions/sessions.php:148) in /home/********/public_html/catalog/includes/functions/sessions.php on line 97


If I DO change the /tmp in the database as per the suggestions from those forum discussions, it loses that formatting. I'll take a couple of screenshots, the first one is when my database is set to "/php" the second is set to "php" on line 136 of Configuration table:

MySQL Configuration table line 136  Session Directory  SESSION_WRITE_DIRECTORY  is set to /tmp :
[img]http://i55.tinypic.com/vhswet.jpg[/img]

MySQL Configuration table line 136  Session Directory  SESSION_WRITE_DIRECTORY  is set to tmp :
[img]http://i54.tinypic.com/an0zeu.jpg[/img]

Any other thoughts?

ETA Don't worry about the error saying how it is "able to write to (my) configuration.php file" - I had the permission set to 644 when I took the screenshot as I hadn't changed it back to 444 at the time - when I change the permission for it to 444 that one disappears.
Also, because I'm playing around with things like the permissions on the configure.php file etc, that is the reason why I am very careful about covering up all the personal details in this thread. I'm trying to give as much info as I can so that hopefully my problem can be resolved, but trying also to protect my site :)

Edited by wuiske, 05 February 2011 - 03:17 PM.


#-12   Xpajun

Xpajun
  • Members
  • 1,295 posts

Posted 05 February 2011 - 07:46 PM

As safe_mode has been deprecated I should think you could turn it off in php.ini...

It is the reason that safe_mode has been deprecated that I asked about asking your host

#-11   BryceJr

BryceJr
  • Members
  • 1,464 posts

Posted 05 February 2011 - 08:48 PM

Quote

Any other thoughts?

Create a folder in your catalog folder, call it session_tmp or whatever name you want.
Give it a 755 permission.

Log in to PhpMyAdmin.

MySQL Configuration table

Session Directory SESSION_WRITE_DIRECTORY

instead of /tmp  change it to

/home/sitename/public_html/catalog/session_tmp

Save it.

#-10   wuiske

wuiske
  • Members
  • 30 posts

Posted 05 February 2011 - 11:43 PM

View PostBryceJr, on 05 February 2011 - 08:48 PM, said:

Create a folder in your catalog folder, call it session_tmp or whatever name you want.
Give it a 755 permission.

Log in to PhpMyAdmin.

MySQL Configuration table

Session Directory SESSION_WRITE_DIRECTORY

instead of /tmp  change it to

/home/sitename/public_html/catalog/session_tmp

Save it.
Hi Bryce, thank you for your time... I have done as you suggested and had the same result (the second screenshot above)... It seems that it doesn't matter what that field in sql is changed to, as soon as it's NOT /tmp it stuffs up - the only thing I can think of is that there is something else pointing to that table line in another file within the configuration type files of the catalog, but I have no idea what? Like as if there's a conflict somewhere?


View PostXpajun, on 05 February 2011 - 07:46 PM, said:

As safe_mode has been deprecated I should think you could turn it off in php.ini...

It is the reason that safe_mode has been deprecated that I asked about asking your host

Thanks again Xpajun, I had already created a php.ini in the root of my website (www.site2.com/php.ini) with this in it:
[PHP]
register_globals = On
as I'd found this suggested previously, but it didn't make any effect. I had also copied this same file to the root of the catalog (www.site2.com/catalog/php.ini) and again, no difference. The other suggestion along the same lines was to have a .htaccess file with the coding as per this suggestion:
http://forums.oscommerce.com/topic/257556-register-globals-for-dummies/page__view__findpost__p__1054686 and if I edited the 0kb .htaccess in my site root (www.site2.com/.htaccess) it came up with a 500 error for the entire site (www.site2.com), and if I created it in my catalog root (www.site2.com/catalog/.htaccess) it also came up with a 500 internal server error. So far as I'd read though, turning register_globals on makes the site less secure too, so maybe it's not a bad thing that this part is not working?

I have also tried editing the sessions.php as per this suggestion:
http://forums.oscommerce.com/topic/184484-fix-warning-session-save-path/page__view__findpost__p__756395 but it only comes back with errors without even loading the site, so worse than before.

I have also tried this suggestion:
http://forums.oscommerce.com/topic/193738-a-guide-to-the-configurephp-files/page__view__findpost__p__1063026 but it completely removes the placekeepers (the empty box the size of the image with a red x top left)

Edited by wuiske, 05 February 2011 - 11:45 PM.


#-9   wuiske

wuiske
  • Members
  • 30 posts

Posted 06 February 2011 - 12:56 AM

I've just been onto my new host as well, and confirmed that they are running php5. The advice from them was in the php.ini file:

safe_mode = Off

However, this brought up an error only (no catalog, not even in the failed version as in my second screenshot above) about register_globals needing to be turned on in the php.ini or .htaccess of my catalog directory.

so changed php.ini to read:
safe_mode = Off
register_globals = On
and came back to the same problem as in screenshot 2.

New host also suggested adding to the php.ini:
safe_mode = Off
register_globals = On
session.save_pass = /home/********/tmp


but no change... still showing up with screenshot 2. I also tried (on the offchance that it would work) setting line 13 of Configure table in PHPmyadmin to /home/********/tmp and still nothing.

That's about as much as the host company can do or offer as suggestions....

I JUST DON'T GET IT!!!!!!!!!!!!!!!!!!!! What on earth is going on???? What am I missing???/

#-8   wuiske

wuiske
  • Members
  • 30 posts

Posted 07 February 2011 - 09:52 AM

bump...

Still haven't had any luck with this one, any other thoughts???

#-7   wuiske

wuiske
  • Members
  • 30 posts

Posted 08 February 2011 - 02:50 AM

Ok guys, been on to the host and finally have the catalog working, still getting the 500 Internal Server error on catalog/admin though.

The "fix" was actually the php.ini with code register_globals = on

My issue was that the new site was not live whilst I was trying to get everything going. Soon as the site was live, I didn't have to change the /tmp to tmp, I didn't have to turn safe mode off, I didn't have to do anything other than the php.ini register_globals = on, and the obvious changes in the configure.php file.

Thank you to all those who gave their time to look at the first issue for me - much appreciated!



But now, to the second issue (which has been there the whole time, I've just been ignoring it until I got the first part of the catalog going...

500 internal server error for admin - any thoughts?



Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@site2.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 mod_perl/2.0.4 Perl/v5.8.8 Server at www.site2.com Port 80

Edited by wuiske, 08 February 2011 - 02:52 AM.


#-6   spoofy

spoofy
  • Members
  • 181 posts

Posted 08 February 2011 - 03:25 AM

Your 500 error can be traced via error logs. For example in cpanel you can see the error logs.

My guess is that there is an issue with .htaccess in your /admin/ folder

#-5   wuiske

wuiske
  • Members
  • 30 posts

Posted 08 February 2011 - 05:59 AM

G'day Spoofy,
Thanks for that, you pointed me in the perfectly correct direction!

The issue was my .htaccess.

I had one in catalog/includes/ but I didn't have one in catalog/admin/includes - instead i had that in catalog/admin and it wasn't working obviously.
Got the right .htaccess in the right directory and seems to be working now YEEEEEEEEEEEEEEEEY

Hang on, before I get my hopes up let me just double and triple check....




Ok all looks good except my catalog has lost the customised images for "Buy Now" "Add to Cart" etc... if anyone knows and can tell me off the top of their head which file to go to to fix that I would appreciate it, otherwise i'll do more searches through these forums tonight and no doubt someone else has posted about it.

Spoofy, thank you for pointing me in the right direction to get my admin side of things working, much appreciated!

#-4   wuiske

wuiske
  • Members
  • 30 posts

Posted 08 February 2011 - 10:32 AM

Ok,
Found this post from germ http://forums.oscommerce.com/topic/338446-the-shoping-buttons-are-not-showing/page__view__findpost__p__1410671, and the .htaccess file that I had to put into the catalog/includes directory I renamed to text.htaccess as per his suggestion and voila it's all finally up and running!

Once again, many thanks to everyone who has taken their time to respond to my problems in this thread! I think I'd be bald right now if not for all of you!

Cheers!

#-3   siyerindu

siyerindu
  • Members
  • 5 posts

Posted 03 September 2011 - 11:09 AM

Hi,

I am using crazy domain for oscommerce , i m not able to get the value of environmaent variable 'PATH_INFO' in the server.how can i enable it?This is needed in oscommerce

#-2   germ

germ
  • Members
  • 13,921 posts

Posted 03 September 2011 - 11:32 AM

Run the script below.

It will output the path on the server to the root of the site (not necessaarily the root of the store!)

<?php
  echo $_SERVER['DOCUMENT_ROOT'];
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."
- Me -

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >