Re: Help, PHP/Mysql connections are so slow.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



The query log on the database server tells me that there are around 20-30 seconds between each data request from the webserver to the database server. Accessing the same database from another server, Apache/CGI/Mysql or even through the mysql command line is fast, and there are no 20-30 sec delays.

Apache & PHP are the default x86-64 rpm packages that comes with CentOS 5.1:

httpd-devel-2.2.3-11.el5_1.centos.3
httpd-2.2.3-11.el5_1.centos.3
httpd-manual-2.2.3-11.el5_1.centos.3
httpd-devel-2.2.3-11.el5_1.centos.3

php-mbstring-5.1.6-15.el5
php-ldap-5.1.6-15.el5
php-cli-5.1.6-15.el5
php-gd-5.1.6-15.el5
php-common-5.1.6-15.el5
php-5.1.6-15.el5
php-pdo-5.1.6-15.el5
php-mysql-5.1.6-15.el5
php-pear-1.4.9-4

The php.ini file is located in the /etc/ folder.

I also have the same identical site accessing the same database on the same mysql server, running on a CentOS4 server without any problem. Reason for switching server is that I need PHP5 support, and as the CentOS4 based server is a production server, I cannot compile PHP5 from source and use that on the server. I have It is a mystery ;)

I'm starting to wonder if this is a broken hardware issue...


Regards,
/mysteron

--- On Mon, 6/9/08, Peter Farrell <peter.d.farrell@xxxxxxxxx> wrote:

> From: Peter Farrell <peter.d.farrell@xxxxxxxxx>
> Subject: Re:  Help, PHP/Mysql connections are so slow.
> To: "CentOS mailing list" <centos@xxxxxxxxxx>
> Date: Monday, June 9, 2008, 1:03 PM
> If it's a table listing check your MySQL settings. How
> have you set up
> my.cnf? What does your slow query log tell you?
> Have you logged into your MySQL server from another machine
> and ran
> queries from there? Have you enabled verbose logging for
> PHP and
> Apache? Are you tailing all 3 while you run the query from
> phpadmin?
> One of them will say something interesting.
> 
> I think your issue smells like something in how you
> compiled PHP  or a
> setting in php.ini itself.
> 
> Put a  test.php in the doc-root and see what it tells you
> it's using.
> (re; mysql & the php version & the location of the
> php.ini)
> I've done installs where I had conflicting libs from
> both PHP and
> MySQL. Also I get stupid locations for php.ini all the time
> and have
> to manaully move that file to the correct location.
> 
> [root@altair htdocs]# cat test.php
> <?php
> phpinfo();
> ?>
> <?
> var_dump($GLOBALS['_PHPA']);
> ?>
> 
> I generally compile everything when I do a similar install
> - and give
> explicit declarations to where the apxs is for PHP as well
> as the root
> mysql libraries. Check that everything is where you think
> it is.
> 
> *from recent installation of vtiger: (for example)
> 
> APACHE 2
> ====================
> --prefix=/data/CRM/apache2 --with-mpm=prefork --enable-ssl
> --enable-setenvif --enable-proxy --enable-proxy-http
> --enable-so
> --disable-charset-lite --disable-include --disable-env
> --disable-status --disable-autoindex --disable-asis
> --disable-negotiation --disable-actions --disable-userdir
> --disable-alias
> make
> make install
> 
> PHP 5.2.5
> ====================
> --prefix=/data/CRM/php-5.2.5
> --with-zlib-dir=/data/CRM/src/rrdbuild/lb
> --with-gd --with-png-dir=/data/CRM/src/rrdbuild/lb
> --with-freetype-dir=/data/CRM/src/rrdbuild/lb
> --with-jpeg-dir=/data/CRM/src/rrdbuild/lb
> --with-imap=/data/CRM/src/rrdbuild/lb
> --with-mysql=/usr/local/include/mysql
> --with-apxs2=/data/CRM/apache2/bin/apxs
> make
> make test
> make install
> 
> =====================================================================
> 
> XCACHE (this is the PHP accelerator we're using)
> 
> *you'll have to force it to see the non-standard
> install locations we're using.
> ===============
> Make a build directory:
> mkdir xcache-build
> cd src/xcache-build/
> phpize --clean && phpize
> env CPPFLAGS="-I/data/CRM/php-5.2.5/include
> -I/data/CRM/apache2/include"
> LDFLAGS="-L/data/CRM/php-5.2.5/lib
> -I/data/CRM/apache2/lib" CFLAGS="-O3 -fPIC"
> ../xcache-1.2.2/configure
> --prefix=/data/CRM/ --enable-xcache
> make
> make install
> 
> *You must re-install each time you upgrade or re-compile
> PHP
> make distclean && phpize --clean && phpize
> (now continue w/ original instructions)
> 
> 
> Locate a php.ini and copy it to
> /data/CRM/php-5.2.5/lib/php.ini
> Append the xcache options to this file:
> cd ../xcache-1.2.2
> cat xcache.ini >> /etc/php.ini
> 
> Edit the php.ini to comply with the vtiger installation
> notes:
> 
> ;Your php.ini must configured with the following
> parameters:
> 
> ;    * safe_mode = Off
> ;    * display_errors = On            *this is stupid. Turn
> it off
> after you tweak vtiger to how you like it.
> ;    * file_uploads = On
> ;    * register_globals = Off
> ;    * max_execution_time = 600
> ;    * output_buffering= On
> ;    * memory_limit = 32M             *is 128 by default -
> ignore
> ;    * error_reporting = E_WARNING & ~E_NOTICE
> ;    * allow_call_time_reference = On
> ;    * log_errors = Off                *again, stupid -
> ignore
> ;    * short_open_tag= On            *again, why the code
> is a bit
> crap in vtiger that we'd need to enable this.
> ;    * extension=php_gd2.dll            *ignore - it's
> for windows
> ;    * extension=php_imap.dll            *ignore - it's
> for windows
> ;    * extension=php_mysql.dll            *ignore -
> it's for windows
> ;    * extension=php_mysqli.dll            *ignore -
> it's for windows
> 
> ===========================================================
> 
> 
> -Peter
> 
> 
> 
> 
> 
> 
> 
> 2008/6/9 Pro Green European
> <pro_green_european@xxxxxxxxx>:
> > Hi.
> >
> >> Have you tried other protocols? Is it really only
> http
> >> transfers that are slow?
> >
> > Yes. Ftp works perfectly, and regular http with
> cgi/perl connections to the same database server works
> perfectly. Also rendering of standard HTML works as it
> should. It is only when a scripted site uses PHP/Mysql the
> connection to the server takes forever.
> >
> >> Have you tried pinging 100 times and see if you
> get dropped
> >> packets?
> >
> > 0% packet loss
> >
> >> Are there any errors from the netcards showing up
> in log
> >> files?
> >
> > None.
> >
> > I am really baffeled with this problem. I have no idea
> what to do next. Have enabled server-status in Apache and
> when the scripted site is being access the cpu load is
> around 2.5%.
> >
> >
> > Regards,
> > /mysteron
> >
> >
> > --- On Mon, 6/9/08, Bent Terp <bent@xxxxxxxxxxx>
> wrote:
> >
> >> From: Bent Terp <bent@xxxxxxxxxxx>
> >> Subject: Re:  Help, PHP/Mysql connections
> are so slow.
> >> To: "CentOS mailing list"
> <centos@xxxxxxxxxx>
> >> Date: Monday, June 9, 2008, 10:42 AM
> >> > communicate with MySQL5. On this server,
> PHP/Mysql
> >> connections are dead
> >> > slow and unresponsive. It takes sometimes up
> to a
> >> minute to list tables
> >> > in phpmyadmin for example.
> >>
> >> Have you tried other protocols? Is it really only
> http
> >> transfers that are slow?
> >>
> >> Have you tried pinging 100 times and see if you
> get dropped
> >> packets?
> >>
> >> Are there any errors from the netcards showing up
> in log
> >> files?
> >>
> >> BR Bent
> >> _______________________________________________
> >> CentOS mailing list
> >> CentOS@xxxxxxxxxx
> >> http://lists.centos.org/mailman/listinfo/centos
> >
> >
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS@xxxxxxxxxx
> > http://lists.centos.org/mailman/listinfo/centos
> >
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> http://lists.centos.org/mailman/listinfo/centos


      
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux