[CentOS] Help, PHP/Mysql connections are so slow.

Mon Jun 9 10:30:57 UTC 2008
Lorenzo Martínez Rodríguez <Lawwait at yahoo.es>

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


-- 



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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20080609/9bdef4ba/attachment-0005.html>