Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   Help, PHP/Mysql connections are so slow. (http://www.linux-archive.org/centos/103161-help-php-mysql-connections-so-slow.html)

"Bent Terp" 06-09-2008 07:42 AM

Help, PHP/Mysql connections are so slow.
 
> 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@centos.org
http://lists.centos.org/mailman/listinfo/centos

Pro Green European 06-09-2008 09:08 AM

Help, PHP/Mysql connections are so slow.
 
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@nagstrup.dk> wrote:

> From: Bent Terp <bent@nagstrup.dk>
> Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
> To: "CentOS mailing list" <centos@centos.org>
> 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@centos.org
> http://lists.centos.org/mailman/listinfo/centos



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

"Peter Farrell" 06-09-2008 10:03 AM

Help, PHP/Mysql connections are so slow.
 
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@yahoo.com>:
> 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@nagstrup.dk> wrote:
>
>> From: Bent Terp <bent@nagstrup.dk>
>> Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
>> To: "CentOS mailing list" <centos@centos.org>
>> 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@centos.org
>> http://lists.centos.org/mailman/listinfo/centos
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Lorenzo Martínez Rodríguez 06-09-2008 10:30 AM

Help, PHP/Mysql connections are so slow.
 
Maybe if you trust DNS resolution names to make the connection to the
Database servers could be a problem. Did you try to use IP addresses
directly in the code?



Regards,





Peter Farrell escribió:

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@yahoo.com>:


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@nagstrup.dk> wrote:



From: Bent Terp <bent@nagstrup.dk>
Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
To: "CentOS mailing list" <centos@centos.org>
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@centos.org
http://lists.centos.org/mailman/listinfo/centos




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



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







--



Lorenzo Martínez Rodríguez
Consultor de seguridad informática




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

Pro Green European 06-09-2008 10:37 AM

Help, PHP/Mysql connections are so slow.
 
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@gmail.com> wrote:

> From: Peter Farrell <peter.d.farrell@gmail.com>
> Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
> To: "CentOS mailing list" <centos@centos.org>
> 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@yahoo.com>:
> > 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@nagstrup.dk>
> wrote:
> >
> >> From: Bent Terp <bent@nagstrup.dk>
> >> Subject: Re: [CentOS] Help, PHP/Mysql connections
> are so slow.
> >> To: "CentOS mailing list"
> <centos@centos.org>
> >> 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@centos.org
> >> http://lists.centos.org/mailman/listinfo/centos
> >
> >
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS@centos.org
> > http://lists.centos.org/mailman/listinfo/centos
> >
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos



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

"Peter Farrell" 06-09-2008 11:05 AM

Help, PHP/Mysql connections are so slow.
 
If the database is on a different server.
and the CLI access to mysql is normal.
and other php / apache instances can access the database;

then it has to be either
a problem with apache <--> php communication
or a problem with php <--> mysql communication.

Write a test query in php and execute at the command line on this
server and see what output you get.

I think the previous poster that recommended the DNS investigation
might have been on to something as well.
That 20-30 seconds could be name failure resolution, etc. Worth
looking at. In your phpadmin are you giving the FQDN or the IP
address?
I've many times forgotten to add a new default route w/ multi-homed machines.
The DNS explanation would make sense as well if nothing (as you say)
is being logged as errors in any of your log files.
The delay could be purely DNS related.

Check your httpd:
ldd /path/to/httpd
for the libs compiled with httpd.

# httpd -l
for the moduled compiled into httpd.

cat your httpd.conf and double check your php5 module is included as well.

Really take a minute as well to check your php options.

# php -i

And double check your PATHS and MYSQL_HOME and MYSQL_BIN.

With linux it's always something bitty like this that can screw you up.

-Peter




2008/6/9 Pro Green European <pro_green_european@yahoo.com>:
> 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@gmail.com> wrote:
>
>> From: Peter Farrell <peter.d.farrell@gmail.com>
>> Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
>> To: "CentOS mailing list" <centos@centos.org>
>> 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@yahoo.com>:
>> > 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@nagstrup.dk>
>> wrote:
>> >
>> >> From: Bent Terp <bent@nagstrup.dk>
>> >> Subject: Re: [CentOS] Help, PHP/Mysql connections
>> are so slow.
>> >> To: "CentOS mailing list"
>> <centos@centos.org>
>> >> 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@centos.org
>> >> http://lists.centos.org/mailman/listinfo/centos
>> >
>> >
>> >
>> > _______________________________________________
>> > CentOS mailing list
>> > CentOS@centos.org
>> > http://lists.centos.org/mailman/listinfo/centos
>> >
>> _______________________________________________
>> CentOS mailing list
>> CentOS@centos.org
>> http://lists.centos.org/mailman/listinfo/centos
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Bent Terp" 06-09-2008 11:05 AM

Help, PHP/Mysql connections are so 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.

What happens if you include a largish file in php? Is that also slow?

Have you tried MySQL without php? Ie a mysql dump'n'reload on the command line?

What's your memory status? (free -m) Swapping is painful....
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Bent Terp" 06-09-2008 11:06 AM

Help, PHP/Mysql connections are so slow.
 
On Mon, Jun 9, 2008 at 1:05 PM, Bent Terp <bent@nagstrup.dk> wrote:
>> 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.
>
> What happens if you include a largish file in php? Is that also slow?
>
> Have you tried MySQL without php? Ie a mysql dump'n'reload on the command line?


Ah well you already tried these.... sorry
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Pro Green European 06-09-2008 11:28 AM

Help, PHP/Mysql connections are so slow.
 
Hi.

Yes, I have tried that too, no difference. I've even tried running MySQL with a database populated with identical data on localhost (even tried 127.0.0.1), but there is no difference in performance. Delays in the connection to the db server is still around 20-30 seconds.

So, the problem has to be with either the php-mysql module, PHP itself, MySQL or then it may be hardware related.


Thx,
/mysteron



--- On Mon, 6/9/08, Lorenzo Martínez Rodríguez <Lawwait@yahoo.es> wrote:

> From: Lorenzo Martínez Rodríguez <Lawwait@yahoo.es>
> Subject: Re: [CentOS] Help, PHP/Mysql connections are so slow.
> To: "CentOS mailing list" <centos@centos.org>
> Date: Monday, June 9, 2008, 1:30 PM
> Maybe if you trust DNS resolution names to make the
> connection to the
> Database servers could be a problem. Did you try to use IP
> addresses
> directly in the code?
>
> Regards,
>
>
> Peter Farrell escribió:
> > 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']);
> > ?>
> >




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

Kai Schaetzl 06-09-2008 11:51 AM

Help, PHP/Mysql connections are so slow.
 
Pro Green European wrote on Mon, 9 Jun 2008 03:37:33 -0700 (PDT):

> I also have the same identical site accessing the same database on
> the same mysql server, running on a CentOS4 server without any problem.

How did you move the database? You moved from PHP4 to 5 and from MySQL4 to
5. You *have* to expect problems.

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

I think what you have not done yet, is test a simple PHP page with a
simple SQL query to a *different* simple, new database with just a few
data.

BTW: the mysqladmin list of connections can show the current connection
status of queries, the statement etc. and thus help in debugging. The same
list can be obtained from within PHPMyadmin.

Kai

--
Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com



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


All times are GMT. The time now is 10:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.