Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP doesn't finish


indre1

Recommended Posts

Posted

Server moved to PHP5 and Mysql 5, everything on the shop side seems to work perfectly, but there's some strange problem on the admin side:

 

The whos_online.php displays nicely who is online, but keeps loading until displaying the error:

 

Fatal error: Maximum execution time of 15 seconds exceeded in ***/whos_online.php on line 136

or the same error line 130.

 

Line 130: if ($session_data[$i] == '{') {

Line 136: } elseif ($session_data[$i] == '}') {

 

Any suggestions why PHP5 doesn't like these lines?

Posted
Server moved to PHP5 and Mysql 5, everything on the shop side seems to work perfectly, but there's some strange problem on the admin side:

 

The whos_online.php displays nicely who is online, but keeps loading until displaying the error:

 

Fatal error: Maximum execution time of 15 seconds exceeded in ***/whos_online.php on line 136

or the same error line 130.

 

Line 130: if ($session_data[$i] == '{') {

Line 136: } elseif ($session_data[$i] == '}') {

 

Any suggestions why PHP5 doesn't like these lines?

 

 

hey

 

dont blame php please.. he doesnt know any more than you tell him to kno about.. you have set the max execution time for th php to execute to 15 seconds. if the php preprocessor fails to accomplish the current task it is dealing ( waiting for database query to return etc.. ), then it will thro out this error.. check there is sql query nearby.. normally the max execution time it set to 60 seconds.. you can try overriding the default brwoser/server setting by using the set_time_limit function

 

Hari

Posted
hey

 

dont blame php please.. he doesnt know any more than you tell him to kno about.. you have set the max execution time for th php to execute to 15 seconds. if the php preprocessor fails to accomplish the current task it is dealing ( waiting for database query to return etc.. ), then it will thro out this error.. check there is sql query nearby.. normally the max execution time it set to 60 seconds.. you can try overriding the default brwoser/server setting by using the set_time_limit function

 

Hari

Well it's the change in PHP4->PHP5 or in MySql5 that causes this bug, as it did not load for that long before...

 

Anyone got any suggestions on what might be wrong with this script in PHP5/MySql5:

 

  $heading = array();
 $contents = array();

 if (isset($info)) {
   $heading[] = array('text' => '<b>' . TABLE_HEADING_SHOPPING_CART . '</b>');

   if (STORE_SESSIONS == 'mysql') {
     $session_data = tep_db_query("select value from " . TABLE_SESSIONS . " WHERE sesskey = '" . $info . "'");
     $session_data = tep_db_fetch_array($session_data);
     $session_data = trim($session_data['value']);
   } else {
     if ( (file_exists(tep_session_save_path() . '/sess_' . $info)) && (filesize(tep_session_save_path() . '/sess_' . $info) > 0) ) {
       $session_data = file(tep_session_save_path() . '/sess_' . $info);
       $session_data = trim(implode('', $session_data));
     }
   }

   if ($length = strlen($session_data)) {
     if (PHP_VERSION < 4) {

//irrelevant

     }

     for ($i=$start_cart; $i<$length; $i++) {
       if ($session_data[$i] == '{') {	//ERROR IS GIVE HERE
         if (isset($tag)) {
           $tag++;
         } else {
           $tag = 1;
         }
       } elseif ($session_data[$i] == '}') {	//OR HERE
         $tag--;
       } elseif ( (isset($tag)) && ($tag < 1) ) {
         break;
       }
     }

Posted

May also be caused by a edit done during installing a contribution was not exactly right so the code hangs or loops.

 

Recheck and recent corrections you have made.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted
May also be caused by a edit done during installing a contribution was not exactly right so the code hangs or loops.

 

Recheck and recent corrections you have made.

Thank you for the replies so far, but the thing is, that this error was not present yesterday, but today our server moved to PHP5 and MySql5, which caused the error.

Haven't edited any files/contributions for atleast a month.

Posted
Thank you for the replies so far, but the thing is, that this error was not present yesterday, but today our server moved to PHP5 and MySql5, which caused the error.

Haven't edited any files/contributions for atleast a month.

Have you done the edits required for php5 and mysql 5?

 

What version of osc are you uing?

Posted

Then you will need to update your code to be 5 compliant.

 

Patches to correct this are included with each release of Oscommerce and are generally in the extras directory. The files have names like update-yyyymmdd.html and update-yyyymmdd.txt.

 

These files contain a shed load of patches that should be applied to a stock install, but as this is not shown as a step in the documentation / installation instruction that I have read, most people won't until they run into a problem. Then they will find a solution to one problem via the forums.

 

Here is the index of my updates fle.

 

osCommerce 2.2 Milestone 2 Update 051113

Update Package 13th November 2005

 

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

Table of Contents

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

 

## Update 051113

 

customer_country_id in addressbook

 

## Update 051112

 

Cannot re-assign $this

limit -20, 20

Database Input Enhancement

Adding Non-Existing Products To Cart

Session ID XSS Issue

Validate Session ID

File Manager Problem

HTTP Header Injection

E-Mail Header Injection

Contact Us Form XSS Issue

Open Redirector

Extra Slashes In New Products

Order Status Filtering

MySQL 5.0 Compatibility

 

This is a link to a later one

 

http://www.oscommerce.com/ext/update-20060817.txt

 

These threads might also be of use

 

http://www.oscommerce.com/community/contributions,4654

http://www.oscommerce.com/community/contributions,3727/

http://www.oscommerce.com/forums/index.php?showtopic=179130

http://www.oscommerce.com/ext/update-20060817.txt

 

And here are the MySQL 5.0 Compatibility entries from my updates file

 

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

MySQL 5.0 Compatibility

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

 

Problem:

 

MySQL 5.0 introduces Server SQL modes as part of its SQL 2003 standards support, and uses a more stricter approach to executing SQL queries. This is performed by default with setting STRICT_TRANS_TABLES as a Server SQL mode.

 

Due to this new setting, MySQL fails on certain SQL queries and produces error messages on the screen.

 

Solution:

 

Lines 213-223 in catalog/advanced_search_result.php must be changed from:

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {

if (!tep_session_is_registered('customer_country_id')) {

$customer_country_id = STORE_COUNTRY;

$customer_zone_id = STORE_ZONE;

}

$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";

}

 

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

to:

 

$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

 

if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {

if (!tep_session_is_registered('customer_country_id')) {

$customer_country_id = STORE_COUNTRY;

$customer_zone_id = STORE_ZONE;

}

$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";

}

 

$from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 

$where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

The following lines must be replaced in catalog/index.php:

 

Line 175, from:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

 

to:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

 

Line 178, from:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

 

to:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

 

Line 184, from:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

to:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

Line 187, from:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

to:

 

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 

Line 292 in catalog/admin/categories.php must be changed from:

 

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

to:

 

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "', now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

 

The following SQL queries need to be performed:

 

ALTER TABLE whos_online MODIFY COLUMN last_page_url VARCHAR(255) NOT NULL;

 

ALTER TABLE customers MODIFY COLUMN customers_default_address_id INTEGER;

 

ALTER TABLE customers_basket MODIFY COLUMN final_price DECIMAL(15,4);

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted
Well it's the change in PHP4->PHP5 or in MySql5 that causes this bug, as it did not load for that long before...

Check also how large the table sessions is. There are reports of stale sessions (older than a number of hours) not being deleted by some people (no clue as what they have in common). Then the table sessions keeps growing and growing and growing until you notice you get errors or the site gets real slow.

Posted

EDIT: Well, though it seemed fine for a sec, now the problem is there again (for some reason)... Applied almost all the updates... strange.

Oh yes, and the same problem here: http://www.oscommerce.com/forums/index.php?sho...whos_online.php

 

 

 

 

 

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

Many thanks to you all, got it fixed (applied almost all the updates)...

Although I must say, that checking the "extras" catalog in the new version is quite a strange place (at least for me) to find new updates, it's still good that something like that exists.

 

The actual solution to my problem was (at the end of the ## Update 051112 (12th November 2005):

 

The following SQL queries need to be performed:

ALTER TABLE whos_online MODIFY COLUMN last_page_url VARCHAR(255) NOT NULL;

ALTER TABLE customers MODIFY COLUMN customers_default_address_id INTEGER;

ALTER TABLE customers_basket MODIFY COLUMN final_price DECIMAL(15,4);

For some reason the query didn't seem to go through the first time so I kept messing with quite a lot of things:

 

Strange though that this update was not applied to Oscommerce MS2.2RC1, but the newer ones were (for example ## Update 060817 (17th August 2006).

  • 3 weeks later...
Posted

I have this problem too.

I recently move my site to a new server running PHP5 and Mysql 5.

I had the problem with the Who_online.php page for a few days and then it seemed to work okay.

Now about 2 weeks later, I have the same problem again. I haven't changed a thing in the last few weeks.

PLEASE do we know why this is happening???

 

Thanks

 

Neil

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...