franco_oz Posted June 17, 2010 Posted June 17, 2010 Hey guys, i just started using oscommerce and using it locally with easyphp to setup my store. I can use the admin area with no problem but i can't see the catalog. This is what happen when i try localhost/catalog Warning: require(includes/languages/.php) [function.require]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\application_top.php on line 288 Fatal error: require() [function.require]: Failed opening required 'includes/languages/.php' (include_path='.;C:\php5\pear') in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\application_top.php on line 288 I spent 2 days looking in the forum but i can't find what is wrong. I have all the files at right place, english is set as the language and i did not modify or added anything. I am new to php and try to understand the code before changing things. It may be a simple fix but it puzzles me, have i screwed it up badly? If this problem is fixed elsewhere in the forum, please let me know as i can't find it anywhere. Thank you
chadcloman Posted June 17, 2010 Posted June 17, 2010 Try browsing to: http://localhost/catalog?language=en If that doesn't fix it, then in application_top.php, a few lines above where the problem is occurring, temporarily change this: include(DIR_WS_CLASSES . 'language.php'); to this: require(DIR_WS_CLASSES . 'language.php'); After making this change, does the error message and/or location change? Also, what are the cookie paths and domains in your include/configure.php file? Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 Hi Chad, when i browse http://localhost/catalog?language=en i get this: Parse error: syntax error, unexpected '^' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php on line 87
chadcloman Posted June 17, 2010 Posted June 17, 2010 How interesting. That function shouldn't be getting called. Would you please post the portion of your application_top.php file, from where it says // set the language to where it says require(DIR_WS_LANGUAGES . $language . '.php'); Also, what values are in the 'languages' table of your MySQL database? Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 and after the mod on application_top i get: Parse error: syntax error, unexpected '^' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php on line 87 as well.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 i put a mark at the line i changed, Also, what values are in the 'languages' table of your MySQL database? <=== how do i do that? ----------------------------------------------------------------------------------------- // set the language if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) { if (!tep_session_is_registered('language')) { tep_session_register('language'); tep_session_register('languages_id'); } require(DIR_WS_CLASSES . 'language.php'); <==== THIS IS THE LINE I MODIFIED AS PER YOUR POST $lng = new language(); if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) { $lng->set_language($HTTP_GET_VARS['language']); } else { $lng->get_browser_language(); } $language = $lng->language['directory']; $languages_id = $lng->language['id']; } // include the language translations require(DIR_WS_LANGUAGES . $language . '.php'); ---------------------------------------------------------------------
chadcloman Posted June 17, 2010 Posted June 17, 2010 You can change that line back to what it used to be. Are you familiar with MySQL and how to view your database? Okay, next thing to try. Create a new file in your website's root directory. Call it p.php and copy this line into it: <?php phpinfo(); ?> Then go to http://localhost/p.php You should see a page with a bunch of PHP info. Do a search for this string: HTTP_ACCEPT_LANGUAGE and post its value here. Check out Chad's News.
chadcloman Posted June 17, 2010 Posted June 17, 2010 One more thing. In these two files /catalog/include/languages/english.php /catalog/admin/include/languages/english.php there is a line near the top that looks something like this: @setlocale(LC_TIME, '...'); Please post both lines here. Check out Chad's News.
skylarg Posted June 17, 2010 Posted June 17, 2010 Try browsing to: http://localhost/catalog?language=en If that doesn't fix it, then in application_top.php, a few lines above where the problem is occurring, temporarily change this: include(DIR_WS_CLASSES . 'language.php'); to this: require(DIR_WS_CLASSES . 'language.php'); After making this change, does the error message and/or location change? Also, what are the cookie paths and domains in your include/configure.php file? I was getting the same errors after installing the multiple stores add on. Chad's fix worked for me after quite a bit of frustration. Thanks man! No outside links in signature allowed. See forum rules
chadcloman Posted June 17, 2010 Posted June 17, 2010 when i browse http://localhost/catalog?language=en i get this: Parse error: syntax error, unexpected '^' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php on line 87 Franco, would you also post your language.php file: C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 Value for HTTP_ACCEPT_LANGUAGE HTTP_ACCEPT_LANGUAGE en-US,en;q=0.8 from /catalog/include/languages/english.php (line19) @setlocale(LC_TIME, 'en_US.ISO_8859-1'); from /catalog/admin/include/languages/english.php (line17) setlocale(LC_TIME, 'en_US.ISO_8859-1');
chadcloman Posted June 17, 2010 Posted June 17, 2010 Value for HTTP_ACCEPT_LANGUAGE HTTP_ACCEPT_LANGUAGE en-US,en;q=0.8 from /catalog/include/languages/english.php (line19) @setlocale(LC_TIME, 'en_US.ISO_8859-1'); from /catalog/admin/include/languages/english.php (line17) setlocale(LC_TIME, 'en_US.ISO_8859-1'); I don't think these are causing the problem, but they needed to be checked. You should delete the p.php file that you created. Check out Chad's News.
chadcloman Posted June 17, 2010 Posted June 17, 2010 Another thing to try. In application_top.php, after this line: // set the language insert the following code: echo '<p>Default language: '; if defined('DEFAULT_LANGUAGE') echo htmlspecialchars(DEFAULT_LANGUAGE); else echo "Default language not defined"; echo '</p>'; echo '<p>language: ' . htmlspecialchars($HTTP_GET_VARS['language']) . '</p>'; exit(); Then direct your browser to http://localhost/catalog?language=en and tell me what you get on the screen. Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 this is what i get: Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\application_top.php on line 269 damn i am lost now...
chadcloman Posted June 17, 2010 Posted June 17, 2010 This: if defined('DEFAULT_LANGUAGE') should be this: if (defined('DEFAULT_LANGUAGE')) My bad. We'll get this figured out, don't lose hope. Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 sorry Chad, shall i remove the last change i made? and from your last post This: if defined('DEFAULT_LANGUAGE') should be this: if (defined('DEFAULT_LANGUAGE')) refer to catalog/includes/application_top.php?
chadcloman Posted June 17, 2010 Posted June 17, 2010 Let me clarify. In application_top.php, where I asked you to insert this: echo '<p>Default language: '; if defined('DEFAULT_LANGUAGE') echo htmlspecialchars(DEFAULT_LANGUAGE); else echo "Default language not defined"; echo '</p>'; echo '<p>language: ' . htmlspecialchars($HTTP_GET_VARS['language']) . '</p>'; exit(); I made an error. It should be this: echo '<p>Default language: '; if (defined('DEFAULT_LANGUAGE')) echo htmlspecialchars(DEFAULT_LANGUAGE); else echo "Default language not defined"; echo '</p>'; echo '<p>language: ' . htmlspecialchars($HTTP_GET_VARS['language']) . '</p>'; exit(); Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 ok done it, here is what i get: Default language: en language: en still lost :)
chadcloman Posted June 17, 2010 Posted June 17, 2010 This is a process. Right now, we're eliminating possibilities. Go ahead and undo the changes to application_top.php -- restore it to its original state. Then browse to this url and tell me what happens: http://localhost/catalog Check out Chad's News.
chadcloman Posted June 17, 2010 Posted June 17, 2010 Here's another thing that may be causing it. Go to your osCommerce admin pages. Log in. Select "Localization" on the left side. Under that, select "Languages". Click the "Edit" button for English. You should see the following values in the edit area: Name: English Code: en Image: icon.gif Directory: english Sort Order: 1 Are these the values you see? Also, check the other languages (if any). Do any of them also have a "Code" of "en"? Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 ok restored the code and i get again this: Parse error: syntax error, unexpected '^' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php on line 87 and yes it is all set as it should: Name: English Code: en Image: icon.gif Directory: english Sort Order: 1 there are no other languages set
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 just to clarify, when i installed oscommerce i set it up adding AUD for Australia, created the zones and the tax. After that i removed the original settings defaulting to US and tried it. All worked fine. I also replaced line 16-17 in catalog/includes/application_top.php and admin/includes/application_top.php // set the level of error reporting error_reporting(E_ALL & ~E_NOTICE); With: // set the level of error reporting error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); All this was done well before i had the problem.
chadcloman Posted June 17, 2010 Posted June 17, 2010 I think there's something wrong with your language.php file. Two more things to do: First, just in case, try this link again: http://localhost/catalog?language=en Second, please post the code from \catalog\includes\classes\language.php Check out Chad's News.
franco_oz Posted June 17, 2010 Author Posted June 17, 2010 Result of: http://localhost/catalog?language=en Parse error: syntax error, unexpected '^' in C:\Program Files\EasyPHP-5.3.2i\www\catalog\includes\classes\language.php on line 87 ======== language.php ======================== <?php /* $Id: language.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License browser language detection logic Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002) Copyright Stephane Garin <[email protected]> (detect_language.php v0.1 04/02/2002) */ class language { var $languages, $catalog_languages, $browser_languages, $language; function language($lng = '') { $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic', 'bg' => 'bg|bulgarian', 'br' => 'pt[-_]br|brazilian portuguese', 'ca' => 'ca|catalan', 'cs' => 'cs|czech', 'da' => 'da|danish', 'de' => 'de([-_][[:alpha:]]{2})?|german', 'el' => 'el|greek', 'en' => 'en([-_][[:alpha:]]{2})?|english', 'es' => 'es([-_][[:alpha:]]{2})?|spanish', 'et' => 'et|estonian', 'fi' => 'fi|finnish', 'fr' => 'fr([-_][[:alpha:]]{2})?|french', 'gl' => 'gl|galician', 'he' => 'he|hebrew', 'hu' => 'hu|hungarian', 'id' => 'id|indonesian', 'it' => 'it|italian', 'ja' => 'ja|japanese', 'ko' => 'ko|korean', 'ka' => 'ka|georgian', 'lt' => 'lt|lithuanian', 'lv' => 'lv|latvian', 'nl' => 'nl([-_][[:alpha:]]{2})?|dutch', 'no' => 'no|norwegian', 'pl' => 'pl|polish', 'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese', 'ro' => 'ro|romanian', 'ru' => 'ru|russian', 'sk' => 'sk|slovak', 'sr' => 'sr|serbian', 'sv' => 'sv|swedish', 'th' => 'th|thai', 'tr' => 'tr|turkish', 'uk' => 'uk|ukrainian', 'tw' => 'zh[-_]tw|chinese traditional', 'zh' => 'zh|chinese simplified'); $this->catalog_languages = array(); $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order"); while ($languages = tep_db_fetch_array($languages_query)) { $this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'], 'name' => $languages['name'], 'image' => $languages['image'], 'directory' => $languages['directory']); } $this->browser_languages = ''; $this->language = ''; $this->set_language($lng); } function set_language($language) { if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) { $this->language = $this->catalog_languages[$language]; } else { $this->language = $this->catalog_languages[DEFAULT_LANGUAGE]; } } function get_browser_language() { $this->browser_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE')); for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) { reset($this->languages); while (list($key, $value) = each($this->languages)) { if (preg_match(‘/^(‘ . $value . ‘)(;q=[0-9]\\.[0-9])?$/i’, $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) { $this->language = $this->catalog_languages[$key]; break 2; } } } } } ?>
chadcloman Posted June 17, 2010 Posted June 17, 2010 I think I've found the problem. Due to the forum fonts, it's not visible from the post you made, but when I copied and pasted the language.php code, I found a problem on line 87. The single quotes have been replaced with "fancy" quotes. Here is line 87 in your existing code: if (preg_match(‘/^(‘ . $value . ‘)(;q=[0-9]\\.[0-9])?$/i’, $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {[ As you can see, there are 4 single quotes. Three of them are "fancy" left quotes and one is a "fancy" right quote. The correct code should be this: if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {[ Please let me know if this solves your problem. Check out Chad's News.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.