I'm attempting to implement APC into my framework, but running into some issues. I'm using PostgreSQL 8.2 with PDO, on PHP 5.2.2 running on Gentoo Linux.
When ever I attempt to save my result set obtained from the database into the APC cache, it throws an exception with the following message: 'You cannot serialize or unserialize PDOStatement instances'.
Stack trace shows the __sleep() method on the PDOStatement throws the exception when it is called inside apc_store().
I've attempted to use ObjectArray from SPL, however you seem to loose the methods on the object, which is clearly no good for me either.
Has anyone got APC working with PDOStatement result sets?
> I'm attempting to implement APC into my framework, but running into > some issues. I'm using PostgreSQL 8.2 with PDO, on PHP 5.2.2 running > on Gentoo Linux.
> When ever I attempt to save my result set obtained from the database > into the APC cache, it throws an exception with the following message: > 'You cannot serialize or unserialize PDOStatement instances'.
> Stack trace shows the __sleep() method on the PDOStatement throws the > exception when it is called inside apc_store().
> I've attempted to use ObjectArray from SPL, however you seem to loose > the methods on the object, which is clearly no good for me either.
> Has anyone got APC working with PDOStatement result sets?
I am stumped and so is my hosting help desk (shared server) on this one. My site is on a php4 server, with database. Recently I have had pages not fully load, and it seems to be a symptom that is spreading to other pages in the site. I have considered the following causes and dismissed them:
- .htaccess page - there is very little in it - php.ini file - is old and the problem is new - mail function causes delay which times out the php rendering ... still wondering about that one, but the help desk reports that it works quickly. I wonder because in some though not all the instances of the problem, the page renders to the line just before the mail() function - a recent change to the script caused the problem - no, because I have loaded older versions and they also have the problem, these pages were working for a few years, though I have updated regularly I am pretty sure this is a recent issue. - it is my computer or connection - no, the help desk and others have noticed the problem - it is the server - well the help desk don't think so.
I notice the pages can: - partly load, often to the same point but sometimes to different points in the script - not load at all and be not found, - load but incorrectly with the php arguments missing (to explain: an enquiry page has a form that submits to the same page and it should come back and say thanks etc, but it comes back with the form but without some of the pre-set element like the product the form was enquiring on). - re-load correctly on refresh, or partly load more, then fully load. - problem occurs both with IE and Firefox.
I have tried putting print ("test line x") throughout the script, which just showed me it was failing sometimes before the mail function, but not always, sometimes in the middle of a loop to create a select box it just stopped rendering.
Has anyone had this strange and frustrating experience?
> Has anyone had this strange and frustrating experience?
Hopefuly no. But, what session storage are you using? Maybe there is a problem there (quota reached, etc), and the session fail is causing the page fail.
Anyway, try to the help desk to review the Apache Logs, and see if there is no inusual activity, like segmentations faults, etc.
Good luck.
-- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay
This new hotmail has really screwed up the formatting, sorry.
I have seen where errors were not displayed on a PHP production server, so I would get a blank screen. Check the web server error logs as was suggested. Also try to display all errors just for testing: http://php.net/error_reporting // Report all PHP errors (bitwise 63 may be used in PHP 3) error_reporting(E_ALL);
// Same as error_reporting(E_ALL); ini_set('error_reporting', E_ALL);
If you are using functions that buffer the output, maybe you need to properly flush it? I haven't run into this in PHP, but I have in C/C++, and PHP _does_ have output buffering. _________________________________________________________________ Kick back and relax with hot games and cool activities at the Messenger Café. http://www.cafemessenger.com?ocid=TXT_TAGLM_SeptWLtagline
2. browser set to display all errors ( friendly error messages unchecked)
bastien
> Date: Fri, 21 Sep 2007 23:42:40 +0100> From: ioan...@btinternet.com> To: php...@lists.php.net> Subject: [PHP-DB] Pages not fully loading> > I am stumped and so is my hosting help desk (shared server) on this > one. My site is on a php4 server, with database. Recently I have had > pages not fully load, and it seems to be a symptom that is spreading to > other pages in the site. I have considered the following causes and > dismissed them:> > - .htaccess page - there is very little in it> - php.ini file - is old and the problem is new> - mail function causes delay which times out the php rendering ... > still wondering about that one, but the help desk reports that it works > quickly. I wonder because in some though not all the instances of the > problem, the page renders to the line just before the mail() function> - a recent change to the script caused the problem - no, because I have > loaded older versions and they also have the problem, these pages were > working for a few years, though I have updated regularly I am pretty > sure this is a recent issue.> - it is my computer or connection - no, the help desk and others have > noticed the problem> - it is the server - well the help desk don't think so.> > I notice the pages can:> - partly load, often to the same point but sometimes to different points > in the script> - not load at all and be not found,> - load but incorrectly with the php arguments missing (to explain: an > enquiry page has a form that submits to the same page and it should come > back and say thanks etc, but it comes back with the form but without > some of the pre-set element like the product the form was enquiring on).> - re-load correctly on refresh, or partly load more, then fully load.> - problem occurs both with IE and Firefox.> > I have tried putting print ("test line x") throughout the script, which > just showed me it was failing sometimes before the mail function, but > not always, sometimes in the middle of a loop to create a select box it > just stopped rendering.> > Has anyone had this strange and frustrating experience?> > john> > -- > PHP Database Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php>
ioannes wrote: > Thanks to all who replied. There is a lot of undefined index and > undefined variables when I turn on error reporting.
> The error logs show 'file not found' errors in the last 24 hours for > files that I am sure were never called from any script on my site. I > do not understand 'mod_rewrite: maximum number of internal redirects > reached. Assuming configuration error. Use 'RewriteOptions > MaxRedirects' to increase the limit if neccessary. '
> *MAIN error_log:* > ------------------------------------------------------------------------ > [Sat Sep 22 03:21:35 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/images/header.gif > [Sat Sep 22 03:21:38 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/images/cat_bullet.gif > [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] > mod_rewrite: maximum number of internal redirects reached. Assuming > configuration error. Use 'RewriteOptions MaxRedirects' to increase the > limit if neccessary. > [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] > mod_rewrite: maximum number of internal redirects reached. Assuming > configuration error. Use 'RewriteOptions MaxRedirects' to increase the > limit if neccessary. > [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/images/back_pdf.jpg > [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/panorama-pdf.jpg > [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/panorama-sport.jpg > [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/panorama-plus.jpg > [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/unegruaja.jpg > [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/reklama/panoramasport.jpg > [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not > exist: /usr/local/apache/htdocs/reklama/economist.jpg > [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] > mod_rewrite: maximum number of internal redirects reached. Assuming > configuration error. Use 'RewriteOptions MaxRedirects' to increase the > limit if neccessary. > [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] > mod_rewrite: maximum number of internal redirects reached. Assuming > configuration error. Use 'RewriteOptions MaxRedirects' to increase the > limit if neccessary.
> Does the above mean a segmentation fault as mentioned by Andres?
Thanks to all who replied. There is a lot of undefined index and undefined variables when I turn on error reporting.
The error logs show 'file not found' errors in the last 24 hours for files that I am sure were never called from any script on my site. I do not understand 'mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. '
*MAIN error_log:* ------------------------------------------------------------------------ [Sat Sep 22 03:21:35 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/header.gif [Sat Sep 22 03:21:38 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/cat_bullet.gif [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/back_pdf.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-pdf.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-sport.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-plus.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/unegruaja.jpg [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/reklama/panoramasport.jpg [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/reklama/economist.jpg [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
Does the above mean a segmentation fault as mentioned by Andres?
-----Original Message----- From: ioannes [mailto:ioan...@btinternet.com] Sent: Saturday, September 22, 2007 3:43 PM To: php...@lists.php.net Subject: Re: [PHP-DB] Pages not fully loading
Thanks to all who replied. There is a lot of undefined index and undefined variables when I turn on error reporting.
The error logs show 'file not found' errors in the last 24 hours for files that I am sure were never called from any script on my site. I do not understand 'mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. '
*MAIN error_log:* ------------------------------------------------------------------------ [Sat Sep 22 03:21:35 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/header.gif [Sat Sep 22 03:21:38 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/cat_bullet.gif [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:38 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/images/back_pdf.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-pdf.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-sport.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/panorama-plus.jpg [Sat Sep 22 03:21:42 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/unegruaja.jpg [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/reklama/panoramasport.jpg [Sat Sep 22 03:21:43 2007] [error] [client 80.78.74.168] File does not exist: /usr/local/apache/htdocs/reklama/economist.jpg [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary. [Sat Sep 22 03:21:44 2007] [error] [client 203.220.217.63] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
Does the above mean a segmentation fault as mentioned by Andres?
I also get this in my error log, I am not sure what to do with this (what side effect?):
PHP Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively.
At the moment, I am observing that if I submit the enquiry form (method post), I can get an incomplete page or page not found. If I refresh, I get a blank page like this, which does not derive from the script (eg body tag in actual script is <body text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#ffffff">):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD> <BODY></BODY></HTML>
refresh again gives page source to the previous stop point,
refresh again gives full page correctly.
However, my host support thinks my script was conflicting with fastCGI on my account and have "
changed it back to the normal parser by adding a line to your .htaccess file, and your site is running again. The line I added is AddHandler application/x-httpd-php .php
."
Unfortunately this is not quite working, I am still getting more pages across the site loading progressively on each refresh, or showing page not found and then loading fully or taking a long time to struggle through the progress bar at the end of the browser screen.
Further testing shows that the script fails just before the mail() line, though after a variable number of refreshes it goes through and downloads all OK. Can anyone think why there should be this occasional interaction between the mail() command line and the php script.
ioannes wrote: > I also get this in my error log, I am not sure what to do with this > (what side effect?):
> PHP Warning: Unknown(): Your script possibly relies on a session > side-effect which existed until PHP 4.2.3. Please be advised that the > session extension does not consider global variables as a source of > data, unless register_globals is enabled. You can disable this > functionality and this warning by setting session.bug_compat_42 or > session.bug_compat_warn to off, respectively.
> At the moment, I am observing that if I submit the enquiry form > (method post), I can get an incomplete page or page not found. If I > refresh, I get a blank page like this, which does not derive from the > script (eg body tag in actual script is <body text="#000000" > leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" > bgcolor="#ffffff">):
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> > <HTML><HEAD> > <META http-equiv=Content-Type content="text/html; > charset=iso-8859-1"></HEAD> > <BODY></BODY></HTML>
> refresh again gives page source to the previous stop point,
> refresh again gives full page correctly.
> However, my host support thinks my script was conflicting with fastCGI > on my account and have "
> changed it back to the normal parser by adding a line to your > .htaccess file, and your site is running again. > The line I added is AddHandler application/x-httpd-php .php
> ."
> Unfortunately this is not quite working, I am still getting more > pages across the site loading progressively on each refresh, or > showing page not found and then loading fully or taking a long time to > struggle through the progress bar at the end of the browser screen.
> Further testing shows that the script fails just before the mail() line, > though after a variable number of refreshes it goes through and > downloads all OK. Can anyone think why there should be this occasional > interaction between the mail() command line and the php script.
> Date: Fri, 21 Sep 2007 23:42:40 +0100 > From: ioan...@btinternet.com > I have tried putting print ("test line x") throughout the script, which > just showed me it was failing sometimes before the mail function, but > not always, sometimes in the middle of a loop to create a select box it > just stopped rendering.
> john
How did it fail before the mail function?
Can you verify that the loop to create the select box always creates valid html?
I am having a problem since I upgraded my sql php and phpmyadmin. I was running ver 3.23 sql and 4.+ of php and a really old version of phpmyadmin.
I am now running the following: phpmyadmin ver. 2.7.0-pl2 Mysql Ver: MySQL 5.2.3-falcon-alpha PHP Version 5.2.1 Apache/2.0.51 (Fedora Core 2)
Problems: 1. When I log on to my phpmyadmin screen i get an error message as follows: The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results
2. When I try and browse a database table it will not allow me to do it. The same with inserting a record.
When I choose a database and then click operations I get this error: Error The additional features for working with linked tables have been deactivated. To find out why click here.
When i click it is another error that says: PMA Database ... not OK[ Documentation ] General relation features Disabled
Then it takes me to a doc page thats way over my head.
What is strange is that the actual php and sql seem to be fine. All my programs are running and talking to the database, I just can't browse, add or edit records through phpmyadmin which is a real pain.
Any help would be greatly appreciated. If someone can just fix it for me please let me know a cost.
I am now pretty sure that it fails after the mail() function sends email (since I receive the email) but before it reaches the next line of the script. I might try something like 'mail(...) or die(...)' and see if it prints out the die('') bit. But I am looking to find out why it dies, something like the mysql_error($connection) - is there an equivalent? Though it is behaving as if it said 'or die()' already since it just stops.
Yes, the select box was valid html, though I cannot see how this might be related to failing at or just after the mail line. The fact that on several refreshes the page does appear properly suggests that it is not a html problem.
And I am sure it is not my code as it fails similarly on three separate pages in sort of different sections of the site which have worked for yonks, I have also tried older versions of same. And it is a recent phenomenon
Here is an extract, which I think points to nothing:
if($acceptable=="true") { if($posreplies[0]<>"y"||is_null($posreplies[0])) { $emsg=stripslashes($emsg); //this prints *********************************************** print("<br>line 1068 before reply email sent: to: $to, subj: $subj, emsg: $emsg, from: $from"); $maccept= mail($to, $subj, $emsg, $from); //this does not, until a variable number of refreshes, by then the same number of emails are sent *********** print("<br>after reply email sent"); $maccept= mail("ioan...@btinternet.com", $subj." - sent to $to pos or neg replies", $emsg, $from); print("<br>after my cc email sent"); if(ISSET($confirm_email)&&$confirm_email<>"") { $emsg_conf=stripslashes($emsg_conf); mail($co_email, $subj_conf, $emsg_conf, $from); print("<br>after your cc email sent"); } //copy provider } else {
ioannes wrote: > Further testing shows that the script fails just before the mail() line, > though after a variable number of refreshes it goes through and > downloads all OK. Can anyone think why there should be this occasional > interaction between the mail() command line and the php script.
Check your error logs. Ask your host if they restrict the number of emails you can send.
I am trying to solve this. My server support made this test script:
<?php if (mail("blueh...@shortstay-london.com","test php mail()","test php mail()","From: Bluehost Test <blueh...@shortstay-london.com>")) { print "Working.";
}
else { print "Failed.";
}
?>
I tried this many time and had the following experience (it will be the same for Firefox):
various delays occurred not specifically noted page not found refreshed - page not found refreshed - page not found - noted pause in page returning re-submit - 'working' re-submit - 18 times - on 18th time blank page then page not found automatically refresh- 'working' on try 19 refresh, try 20, blank page, refreshes to page not found on IE refresh 3 times - page not found each time refresh another time - 'working' refresh - blank page refreshes to page not found in IE refresh - 'working' refresh- blank page refreshes to page not found in IE refresh twice - same - works first time then blank and refreshes to page not found with message bar fleeting message about dnserror page not found 'working' x 6 refreshes then error, page not found, message bar about ieframe..dnserror.htm pattern continues on refreshes...
It appears the dns message (including page not found and blank page) was a symptom of trying the email test page too often resulting in more than the allowed number of simultaneous processes (20 are allowed on the shared server).
However, then I got a further solution:
The apache timeout on the server was set to 3 seconds, rather than the default 300. This was likely to combat a ddos attack from earlier, but never changed back to its default. Basically, what was happening was when the mail() function was called, sometimes it was taking longer than 3 seconds to process, and since no data is sent to apache during that, it reaches it's timeout and stops. We've changed this back to the default of 300 seconds (5 minutes) and now it isn't stopping output when it needs to send an email.