If this is your first visit, check our documentation. To post, register or login.
Forums / Installing Zen Cart / Installing on a Linux/Unix Server / Open Base Directory Restriction

Open Base Directory Restriction

Locked

Started by james_o on 22 Mar 2013, 10:02 AM · Views: 1,948

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
22 Mar 2013, 10:02 AM
#1
james_o avatar

james_o

New Zenner

Join Date:
Oct 2007
Posts:
43
Plugin Contributions:
0

Post #1 by james_o

Hi

I have quite a serious problem that has occurred. The problem I am experiencing is producing an error report in the sites cache. Normally I can work out what is going wrong and fix it however 4 days later I am still struggling. I have serached the web and found some helpfull articles however I seem unable to see what is wrong with the file that the error relates to. Any help or pointing in the correct direction would help no end > I am unsure why popup has the smiley face

Many thanks
James

The error report that I am receiving is below. I have removed the site url and replaced it with mysitename

[22-Mar-2013 08:17:36] PHP Warning: is_dir() [<a href='function.is-dir'>function.is-dir</a>]: open_basedir restriction in effect. File(images/..) is not within the allowed path(s): (/var/www/vhosts/mysitename.co.uk/httpdocs/:/tmp/) in /var/www/vhosts/mysitename.co.uk/httpdocs/includes/modules/theme360/additional_images.php on line 45

The additional images.php file is below

<?php /** * additional_images module * * Prepares list of additional product images to be displayed in template * * @package templateSystem * @copyright Copyright 2003-2010 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: additional_images.php 16913 2010-07-16 03:38:06Z ajeh $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } if (!defined('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE')) define('IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE','Yes'); $images_array = array(); // do not check for additional images when turned off if ($products_image != '' && $flag_show_product_info_additional_images != 0) { // prepare image name $products_image_extension = substr($products_image, strrpos($products_image, '.')); $products_image_base = str_replace($products_image_extension, '', $products_image); // if in a subdirectory if (strrpos($products_image, '/')) { $products_image_match = substr($products_image, strrpos($products_image, '/')+1); //echo 'TEST 1: I match ' . $products_image_match . ' - ' . $file . ' - base ' . $products_image_base . '<br>'; $products_image_match = str_replace($products_image_extension, '', $products_image_match) . '_'; $products_image_base = $products_image_match; } $products_image_directory = str_replace($products_image, '', substr($products_image, strrpos($products_image, '/'))); if ($products_image_directory != '') { $products_image_directory = DIR_WS_IMAGES . str_replace($products_image_directory, '', $products_image) . "/"; } else { $products_image_directory = DIR_WS_IMAGES; } // Check for additional matching images $file_extension = $products_image_extension; $products_image_match_array = array(); if ($dir = @dir($products_image_directory)) { while ($file = $dir->read()) { if (!is_dir($products_image_directory . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { // if(preg_match("/" . $products_image_match . "/i", $file) == '1') { if(preg_match("/" . $products_image_base . "/i", $file) == 1) { if ($file != $products_image) { if ($products_image_base . str_replace($products_image_base, '', $file) == $file) { //echo 'I AM A MATCH ' . $file . '<br />'; $images_array[] = $file; } else { // echo 'I AM NOT A MATCH ' . $file . '<br />'; } } } } } } if (sizeof($images_array)) { sort($images_array); } $dir->close(); } } // Build output based on images found $num_images = sizeof($images_array); $list_box_contents = ''; $title = ''; if ($num_images) { $row = 0; $col = 0; if ($num_images < IMAGES_AUTO_ADDED || IMAGES_AUTO_ADDED == 0 ) { $col_width = floor(100/$num_images); } else { $col_width = floor(100/IMAGES_AUTO_ADDED); } for ($i=0, $n=$num_images; $i<$n; $i++) { $file = $images_array[$i]; $products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . 'large/', $products_image_directory) . str_replace($products_image_extension, '', $file) . IMAGE_SUFFIX_LARGE . $products_image_extension; // Begin Image Handler changes 1 of 2 //next line is commented out for Image Handler 3 // $flag_has_large = file_exists($products_image_large); $flag_has_large = true; // End Image Handler changes 1 of 2 $products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file); $flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == 'Yes' || $flag_has_large); $base_image = $products_image_directory . $file; $thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); // Begin Image Handler changes 2 of 2 // remove additional single quotes from image attributes (important!) $thumb_slashes = preg_replace("/([^\\\\])'/", '$1\\\'', $thumb_slashes); // End Image Handler changes 2 of 2 $thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); $large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large); // Link Preparation: $script_link = '<script language="javascript" type="text/javascript"><!--' . "\n" . 'document.write(\'' . ($flag_display_large ? '<a href="javascript:popupWindow(\\\'' . $large_link . '\\\')">' . $thumb_slashes . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>' : $thumb_slashes) . '\');' . "\n" . '//--></script>'; $noscript_link = '<noscript>' . ($flag_display_large ? '<a href="' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'pID=' . $_GET['products_id'] . '&pic=' . $i . '&products_image_large_additional=' . $products_image_large) . '" target="_blank">' . $thumb_regular . '<br /><span class="imgLinkAdditional">' . TEXT_CLICK_TO_ENLARGE . '</span></a>' : $thumb_regular ) . '</noscript>'; // $alternate_link = '<a href="' . $products_image_large . '" onclick="javascript:popupWindow(\''. $large_link . '\') return false;" title="' . $products_name . '" target="_blank">' . $thumb_regular . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>'; $link = $script_link . "\n " . $noscript_link; // $link = $alternate_link; // List Box array generation: $list_box_contents[$row][$col] = array('params' => 'class="additionalImages centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => "\n " . $link); $col ++; if ($col > (IMAGES_AUTO_ADDED -1)) { $col = 0; $row ++; } } // end for loop } // endif

Jimmy6Bellies

22 Mar 2013, 10:20 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #2 by schoolboy

theme360

... suggests you are using a TemplateMonster template - and these are riddled with bad code. It can take centuries to figure out problems with these extremely awful templates.

Perhaps you should talk to templatemonster... afterall, you DID pay THEM for the template, so support from THEM should be your first line of action.

PS... NEVER use TM templates... they are fundamentally BAD for business.

20 years a Zencart User

22 Mar 2013, 12:35 PM
#3
james_o avatar

james_o

New Zenner

Join Date:
Oct 2007
Posts:
43
Plugin Contributions:
0

Post #3 by james_o

Thanks Schoolboy and many thanks for the comments. I can see that the problem is in the MT and yes that is a good idea to post on their site which I have done

Who knows they may reply although I doubt it will be at all constructive.

I can relax the server which will prevent the error ( turns off restriction) however I am concerned that this just stops the error and has not addressed the problem

If you can't sleep tonight and manage to get time to think about this in more detail then perhaps you could write down some code changes and let me know in the morning. :blush:

Thanks again

James

Jimmy6Bellies

22 Mar 2013, 12:51 PM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #4 by schoolboy

I charge $10,000 / hour to work on TM templates. :D

20 years a Zencart User

22 Mar 2013, 7:41 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #5 by drbyte

Guessing that maybe your PHP configuration setting (server's php.ini) for include_path doesn't contain "." as one of the paths it searches.
Ref: http://www.php.net/manual/en/ini.core.php#ini.include-path

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Mar 2013, 10:38 AM
#6
james_o avatar

james_o

New Zenner

Join Date:
Oct 2007
Posts:
43
Plugin Contributions:
0

Post #6 by james_o

Dear Dr Byte

That does appear to have fixed the problem as the cache is now remaining clear

Although many thanks schoolboy for your advice. Having looked at the templates from the site via our private email I can see that it is probably a good idea to move to a new template that has less ( or maybe no) coding errors.

Many thanks for this

James

Jimmy6Bellies

24 Mar 2013, 1:32 PM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Post #7 by schoolboy

James O:

many thanks schoolboy for your advice. Having looked at the templates from the site via our private email I can see that it is probably a good idea to move to a new template that has less ( or maybe no) coding errors.

It's actually very sad that so many people get "hoodwinked" into buying TM templates. I suppose they (TM) are just very good at marketing - and they manage to use some really attractive graphics. The reality however, is that they are generally very badly coded - or coded in ways that require substantial php knowledge to customise.

In general, all the free templates in the plugin area are very reliable and safe.

20 years a Zencart User

2 Apr 2013, 1:52 PM
#8
james_o avatar

james_o

New Zenner

Join Date:
Oct 2007
Posts:
43
Plugin Contributions:
0

Post #8 by james_o

Just a quick update concerning open base directory restriction on a Plesk control panel

The fix listed above by Dr Byte will work providing it is completed for each domain however to fix the problem for all domains upgrade to version 11 of the Plesk control panel as the problem appears to be in version 10

Never use Plesk 8 and 9 as these have a vulnerability.

Jimmy6Bellies