Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 62
  1. #11
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default Re: php 5.4 fatal error, query factory

    I've seen something similar to this during plugin development (i.e. self-induced) and was able to ultimately work-around the issue by clearing the session cookies for the site. Please note that I said "work-around", not solution!

    You can see, without any special debuggers, what's going on in the store by installing the Zen Cart Notifier Trace (http://www.zen-cart.com/downloads.php?do=file&id=1114) and then try logging in. Be sure to go back to your admin once you've captured the set of notifiers and turn the Notifier Trace off (Configuration->Logging) because the file can grow very large very quickly ... especially with the condition you're describing.

    The plugin creates a file in your /cache folder named notifier_trace.log and contains a list of all the page-level processing that's transpired.

  2. #12
    Join Date
    May 2006
    Location
    Montana
    Posts
    291
    Plugin Contributions
    20

    Default Re: php 5.4 fatal error, query factory

    I had the same problem with one of the errors mentioned at the top of this thread:
    [18-Aug-2013 06:25:53 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 3715690265 bytes) in /home/xxxxxxx/public_html/includes/functions/html_output.php on line 62
    BRAND NEW install of Zen Cart 1.5.1 - no mods - clean database.
    What worked for me to get rid of the problem with getting a blank page when trying to log in was to go to Configuration>Sessions>Force Cookie Use and change it to True
    Once I did that, no more problems with logging in

    Hope this helps someone!

  3. #13
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Found and Fixed!

    The problem is that when php shuts down global variables might already have been deleted when the default session write and close happens. There doesn't seem to be any synchronization between the two processes. Here are the php bug tickets regarding this:

    This has all the pertinant info:
    https://bugs.php.net/bug.php?id=54157

    http://www.mediawiki.org/wiki/Specia...i/83140#c14601

    On request shutdown, PHP does things in the following order:

    register_shutdown_function() functions
    zend_call_destructors()
    zend_deactivate_modules()

    zend_call_destructors() goes through the $GLOBALS symbol table and identifies every global variable that holds an object which has a reference count of 1. It removes these globals. It doesn't decrement any reference counts. Any globals which are not objects, or have a reference count greater than 1, are left in the symbol table.
    I believe the "fixes" that have worked for people have simply moved the symbol table around enough that the global $db is still active when session_write is called in zencart.

    The fix is to set a shutdown function that does a session write close itself:

    Code:
    register_shutdown_function('zc_shutdown');
    
    function zc_shutdown() {
      // other shutdown code as needed
      // write session now
      session_write_close();
    }
    Then in includes/functions/sessions.php, in _sess_write, change to:

    Code:
    if (!is_object($db)) {
          //error_log('session write with no global db variable! sessions.php .60');
          // https://bugs.php.net/bug.php?id=54157
    
          // session could be closed with no global variables
          // if so, just exit, nothing we can do
          // workaround is to register shutdown function that saves session
          // and this last call is no-op
          return;
    
          //PHP 5.2.0 bug workaround ...
    //      if (!class_exists('queryFactory')) require('includes/classes/db/' .DB_TYPE . '/query_factory.php');
    //      $db = new queryFactory();
    //      $db->connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE, USE_PCONNECT, false);
        }
    If we come upon a session write where we don't have global variables, it's probably because they've been destroyed. This is OK because we have already done a session write in our shutdown function, so we can ignore this session write. Of course, do not set any session variables after the shutdown function is called.

    This has worked in two cases where I had this strange "session write with no global $db" value in php 5.3 and 5.4.

  4. #14
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: php 5.4 fatal error, query factory

    .

    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.

  5. #15
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default Re: php 5.4 fatal error, query factory

    I downloaded the github code and saved that version of /includes/functions/sessions.php to my otherwise unmodified ZC v1.5.1 test site running PHP 5.4.21. I've got the replication of this down to a time-consuming couple of steps:
    1. Make sure that you are logged out of the store
    2. Click Login, then the "Password Forgotten" link. Enter your email address and request a new password.
    3. Wait for the 24-minute (I usually waited an hour to be sure) session timeout to expire.
    4. From the login page (where you were redirected after confirming the forgotten password), enter your email address and the password you received in the email.
    5. You're redirected to the time_out page because the session expired. Enter your email address and new password and press Enter.
    6. Experience the whitescreen experience. The log that's created is "memory exhausted" by html_output.php.

  6. #16
    Join Date
    Jul 2012
    Posts
    16,735
    Plugin Contributions
    17

    Default Re: php 5.4 fatal error, query factory

    Quote Originally Posted by lat9 View Post
    I downloaded the github code and saved that version of /includes/functions/sessions.php to my otherwise unmodified ZC v1.5.1 test site running PHP 5.4.21. I've got the replication of this down to a time-consuming couple of steps:
    1. Make sure that you are logged out of the store
    2. Click Login, then the "Password Forgotten" link. Enter your email address and request a new password.
    3. Wait for the 24-minute (I usually waited an hour to be sure) session timeout to expire.
    4. From the login page (where you were redirected after confirming the forgotten password), enter your email address and the password you received in the email.
    5. You're redirected to the time_out page because the session expired. Enter your email address and new password and press Enter.
    6. Experience the whitescreen experience. The log that's created is "memory exhausted" by html_output.php.
    So, in another thread, one of the ZC knowledgeable suggested the following thread for a memory issue. My apologies if it happens to lead back here or to the same suggested fixes as in here. Trying to provide some input where I've seen a similarity.

    http://www.zen-cart.com/showthread.p...ytes-exhausted
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #17
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default Re: php 5.4 fatal error, query factory

    Quote Originally Posted by mc12345678 View Post
    So, in another thread, one of the ZC knowledgeable suggested the following thread for a memory issue. My apologies if it happens to lead back here or to the same suggested fixes as in here. Trying to provide some input where I've seen a similarity.

    http://www.zen-cart.com/showthread.p...ytes-exhausted
    Right, the reason for my post is that the code update to /includes/functions/sessions.php referenced by both this and the post you indicated might correct "part" of the problem, but the 'memory exhausted' issue is still there even with the code update.

    The log I received was
    Code:
    [22-Nov-2013 13:14:55 America/New_York] PHP Fatal error:  Allowed memory size of 94371840 bytes exhausted (tried to allocate 746619897 bytes) in xxx/includes/functions/html_output.php on line 62
    ... the referenced line being the relatively innocuous
    Code:
          if (defined('SID') && zen_not_null(SID)) {

  8. #18
    Join Date
    Nov 2007
    Posts
    25
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    Can you install Xdebug (http://www.xdebug.org/) on your server? It prints a call stack whenever there is a fatal error so you can see the function path to the crash. If the crash is not in session_write then you might have a different crash issue. I'll see if I can test this too soon.

  9. #19
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default Re: php 5.4 fatal error, query factory

    Quote Originally Posted by avibodha View Post
    Can you install Xdebug (http://www.xdebug.org/) on your server? It prints a call stack whenever there is a fatal error so you can see the function path to the crash. If the crash is not in session_write then you might have a different crash issue. I'll see if I can test this too soon.
    It's going to be "difficult" to get this installed on my host. I did install it on my localhost (xampp) environment (PHP 5.4.8) on my Windows 7 machine. Going through the same sequence in that environment (my test installation for the failing Linux-hosted store) results in no error, so it's either a PHP version or Linux vs. Windows session-handling issue. In both cases, I used the most recent version of FireFox as the browser.

    If it will help, I can PM you a copy of the phpinfo() from the failing hosted environment ...

  10. #20
    Join Date
    Feb 2009
    Posts
    69
    Plugin Contributions
    0

    Default Re: php 5.4 fatal error, query factory

    I also started experiencing same problem after I migrated to Godaddy unlimited shared hosting from another Godaddy hosting. I copied fixed version of "session.php" from github. But problem persist. FYI: My zen cart version is 1.51
    Here is error message from Godaddy when I try to login. It stuck on below blank page.
    /index.php?main_page=login&action=process

    "Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this 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.
    "
    Here is Zen cart log.

    [26-Nov-2013 01:24:40 UTC] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 693694233 bytes) in /home/xxxxx/public_html/includes/functions/html_output.php on line 62
    "
    Is there any other fix?

    Quote Originally Posted by DrByte View Post

 

 
Page 2 of 7 FirstFirst 1234 ... LastLast

Similar Threads

  1. Replies: 12
    Last Post: 17 Mar 2014, 11:10 PM
  2. Replies: 11
    Last Post: 12 Feb 2013, 10:04 PM
  3. Replies: 4
    Last Post: 22 Jan 2009, 01:14 PM
  4. Allowed memory size of 8388608 bytes exhausted
    By Cornholio in forum General Questions
    Replies: 2
    Last Post: 14 Jun 2007, 03:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR