RE: [PHP] IMAP extension causing delays
-Original Message- From: Edward Kay [mailto:[EMAIL PROTECTED] Sent: 19 October 2006 14:53 To: php-general@lists.php.net Subject: [PHP] IMAP extension causing delays Hello, I need PHP's IMAP extension for my web app but it is really slowing my server up. My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a call to phpinfo(). Without the IMAP extension, the response time is almost immediate. With the IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 secs. Watching with 'top', I can see php-cgi is called immediately when the request is received. With the IMAP extension installed, after php-cgi starts, it then drops to the end of the 'top' list, consuming 0% CPU and 2.0% memory. It remains there for the 2-3 second delay before coming into play again an running the script quickly. Without the IMAP extension, it just ends quickly having finished the request. From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? Thanks, Edward Thanks to all the suggestions I received on this issue. I have tried running PHP as an Apache module. As Jochem mentioned, this restricts the startup delay to just when Apache starts, not with each request - which is a great improvement. I have also set the various configuration options in the VirtualHost directives so my requirement for separate php.ini files has been removed. There is one remaining issue though - how to get my PHP scripts to run under different usernames for each virtual host. I need my PHP scripts to run as specfic users as they need to interact with the filesystem. I am using suExec and have set the SuexecUserGroup directive for each virtual host, but this isn't used as PHP is not called by CGI. Any suggestions? Thanks, Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
You may also want to read PHP IMAP source and see what it does in its initializiation function. That may reduce the category of DNS Error to something a lot more specific... http://lxr.php.net/ On Thu, October 19, 2006 8:52 am, Edward Kay wrote: Hello, I need PHP's IMAP extension for my web app but it is really slowing my server up. My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a call to phpinfo(). Without the IMAP extension, the response time is almost immediate. With the IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 secs. Watching with 'top', I can see php-cgi is called immediately when the request is received. With the IMAP extension installed, after php-cgi starts, it then drops to the end of the 'top' list, consuming 0% CPU and 2.0% memory. It remains there for the 2-3 second delay before coming into play again an running the script quickly. Without the IMAP extension, it just ends quickly having finished the request. From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? Thanks, Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
Edward Kay wrote: Hello, I need PHP's IMAP extension for my web app but it is really slowing my server up. My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a call to phpinfo(). Without the IMAP extension, the response time is almost immediate. With the IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 secs. Watching with 'top', I can see php-cgi is called immediately when the request is received. With the IMAP extension installed, after php-cgi starts, it then drops to the end of the 'top' list, consuming 0% CPU and 2.0% memory. It remains there for the 2-3 second delay before coming into play again an running the script quickly. Without the IMAP extension, it just ends quickly having finished the request. From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? use php as an apache module - thereby the startup delay is only noticed when the webserver starts - this assumes that the problem is a startup problem ... what you describe could be down to a dns configuration error - i.e. the imap extension is trying to resolve some domainname and having a hard time of it I can't remember the specifics of such issues but I know that the archives of this list will turn up more info regarding dns config problems (that cause slow downs) Thanks, Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
Edward Kay wrote: Hello, I need PHP's IMAP extension for my web app but it is really slowing my server up. My setup: Fedora Core 5, Apache 2.2.2, PHP 5.1.4 (run as CGI with suPHP), PHP IMAP extension - all standard FC5 RPMs. The test page is simple - just a call to phpinfo(). Without the IMAP extension, the response time is almost immediate. With the IMAP extension it takes 2-3 seconds to respond - sometimes as much as 4 secs. Watching with 'top', I can see php-cgi is called immediately when the request is received. With the IMAP extension installed, after php-cgi starts, it then drops to the end of the 'top' list, consuming 0% CPU and 2.0% memory. It remains there for the 2-3 second delay before coming into play again an running the script quickly. Without the IMAP extension, it just ends quickly having finished the request. From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? If you don't have to, don't run it as a cgi. A /possible/ solution, and I don't even know if it's possible, is to compile two versions of the cgi; one with and one without. While I know that part is at least possible, I don't know if you can make your webserver *choose* which version of the cgi to run depending on the need. Can the cgi in PHP5 dynamically load modules? dl() is available in PHP4, but I think they got rid of it in PHP5 -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IMAP extension causing delays
From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? use php as an apache module - thereby the startup delay is only noticed when the webserver starts - this assumes that the problem is a startup problem ... No can do. I need to run my PHP scripts as different users and to interact with the file system. what you describe could be down to a dns configuration error - i.e. the imap extension is trying to resolve some domainname and having a hard time of it I can't remember the specifics of such issues but I know that the archives of this list will turn up more info regarding dns config problems (that cause slow downs) This sounds very plausible. It certainly seems as if the delay is due to a timeout or similar. I'll see what I can find on this in the archives. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IMAP extension causing delays
Edward Kay wrote: From this, it is clear to me there is some major delay being introduced by the loading of the IMAP extension. Any ideas on how to resolve this? use php as an apache module - thereby the startup delay is only noticed when the webserver starts - this assumes that the problem is a startup problem ... No can do. I need to run my PHP scripts as different users and to interact with the file system. You can still do this running php as a module. Just enable suexec in Apache (and configure it safely of course). -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IMAP extension causing delays
Thanks for your suggestions John. At the moment, I do need to run it as a CGI as I need different php.ini files for each virtual host. I think there may well be some issues with DNS, as suggested by Jochem. My configuration of DNS stuff locally is a bit patchy :) I'll investigate this avenue first... If you don't have to, don't run it as a cgi. A /possible/ solution, and I don't even know if it's possible, is to compile two versions of the cgi; one with and one without. While I know that part is at least possible, I don't know if you can make your webserver *choose* which version of the cgi to run depending on the need. Can the cgi in PHP5 dynamically load modules? dl() is available in PHP4, but I think they got rid of it in PHP5 -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php