php-general Digest 11 Feb 2013 21:40:59 -0000 Issue 8119
Topics (messages 320188 through 320192):
Re: Apache to serve RESTful requests using PHP
320188 by: Stuart Dallas
PHP 5.4.11 warnings - how to make them go away ?
320189 by: Paul Lanken
320190 by: marco.behnke.biz
Re: fopen and load balancing
320191 by: Adam Tong
Question about PHP-CGI, mysqld and sudden spiking average load readings on
Linux Virtual Dedicated Server running CentOS 6.3
320192 by: Gary Lebowitz
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 10 Feb 2013, at 06:57, AmirBehzad Eslami <behzad.esl...@gmail.com> wrote:
> Stuart, thanks for your detailed response.
>
> >> I find it unlikely that Apache is your bottleneck,
> >> especially with a service involving MySQL.
> >> How have you come to this conclusion?
>
> Apache is the entry-point to our service, and I did a
> benchmark with AB to see how it can handle concurrent
> requests in a timely fashion. After a number of 50 concurrent
> requests, the average "time per request" reached from less than
> a second to 5 seconds.
I *strongly* recommend you try the same test with nginx. Unless this is due to
the way your code works I'm confident you'll see this effect disappear!
> >> As far as keep-alive goes, how frequently will individual
> >> clients be accessing the service?
>
> There are only "a few" clients that call the service. These clients
> are PHP-driven web pages. Each page has its own unique ClickID
> and a set of other unique parameters per user visit. These pages send these
> parameters to the service using php-curl, and expect a generated
> response to be returned. That's why I'm saying each request and
> response is unique.
>
> Whenever a user visits a web-page, there would be a call to the
> web-service. At the moment, we don't know number of concurrent
> visits. We're looking for a way to figure that out in Apache.
>
> Is there a way to see if the requests are using the previously keep-alived
> http channel? Because same client will send requests to the service,
> and I'm curious to know if the Apache will allocate the already-opened
> channel, or will create a new one?
If it's making one request to your service per page request, keep-alive is
pointless as it won't be able to reuse the connection. In this instance I would
turn keep-alive off.
> >> If you are using joins to pull in extra data (i.e. IDs to a name
> >> or similar) look at using Memcache for those, but make sure
> >> that when they're updated in the DB they're also updated in Memcache.
>
> Memcache or Redis, I'm going to add a caching layer between
> MySQL and PHP, to store the de-normilized data.
For simple caching I'd recommend Memcache over Redis, purely because Redis is
more complex due to its support for sets, queues and other very useful stuff.
The only reason I'd use Redis for simple caching is because it can periodically
flush the cache to disk so if it has to restart it can start with a primed
cache. However, in most cases that is not a huge advantage.
If each request and response is unique you need to be careful about what you
choose to cache such that you don't incur caching costs without reaping
benefits that make it worthwhile.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
I ran a quick mysql_connect test using the php 5.4.11 cli and was met
with many annoying warnings :
$ php -r "mysql_connect( \"localhost\", \"username\", \"password\" )
or die(\"Unable to connect to MySQL\"); echo \"Connected to
MySQL\\n\";" 2>&1 | cat -n -
1 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/gd.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/gd.so: open failed: No such file or
directory in Unknown on line 0
2 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/gettext.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/gettext.so: open failed: No such file or
directory in Unknown on line 0
3 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/ldap.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/ldap.so: open failed: No such file or
directory in Unknown on line 0
4 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/mcrypt.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/mcrypt.so: open failed: No such file or
directory in Unknown on line 0
5 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/mhash.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/mhash.so: open failed: No such file or
directory in Unknown on line 0
6 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/mysql.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/mysql.so: open failed: No such file or
directory in Unknown on line 0
7 PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/mysqli.so' - ld.so.1: php: fatal:
/usr/local/lib/php/extensions/mysqli.so: open failed: No such file or
directory in Unknown on line 0
8 Connected to MySQL
So I am happy with the final line but annoyed by the seven previous.
There seems to be no need for gd.so or any of the other dynamic libs
that are being searched for. Not sure why these messages are
happening and I looked in /usr/local/lib/php.ini where I see this :
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions"
Seems reasonable. However I do not need mysql.so because the php
binaries were linked with -lmysqlclient.
So how to get rid of these warnings ?
Paul
--- End Message ---
--- Begin Message ---
Paul Lanken <lanken.p...@gmail.com> hat am 11. Februar 2013 um 14:27
geschrieben:
> I ran a quick mysql_connect test using the php 5.4.11 cli and was met
> with many annoying warnings :
>
> $ php -r "mysql_connect( \"localhost\", \"username\", \"password\" )
> or die(\"Unable to connect to MySQL\"); echo \"Connected to
> MySQL\\n\";" 2>&1 | cat -n -
> 1 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/gd.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/gd.so: open failed: No such file or
> directory in Unknown on line 0
> 2 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/gettext.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/gettext.so: open failed: No such file or
> directory in Unknown on line 0
> 3 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/ldap.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/ldap.so: open failed: No such file or
> directory in Unknown on line 0
> 4 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/mcrypt.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/mcrypt.so: open failed: No such file or
> directory in Unknown on line 0
> 5 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/mhash.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/mhash.so: open failed: No such file or
> directory in Unknown on line 0
> 6 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/mysql.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/mysql.so: open failed: No such file or
> directory in Unknown on line 0
> 7 PHP Warning: PHP Startup: Unable to load dynamic library
> '/usr/local/lib/php/extensions/mysqli.so' - ld.so.1: php: fatal:
> /usr/local/lib/php/extensions/mysqli.so: open failed: No such file or
> directory in Unknown on line 0
> 8 Connected to MySQL
>
> So I am happy with the final line but annoyed by the seven previous.
> There seems to be no need for gd.so or any of the other dynamic libs
> that are being searched for. Not sure why these messages are
> happening and I looked in /usr/local/lib/php.ini where I see this :
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "/usr/local/lib/php/extensions"
>
>
> Seems reasonable. However I do not need mysql.so because the php
> binaries were linked with -lmysqlclient.
>
> So how to get rid of these warnings ?
remove the loading entries from php.ini or from you /etc/php5/conf.d directory
>
> Paul
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz
--- End Message ---
--- Begin Message ---
I think this is what happened. As the application was trying to open
our url domain the request was sent to the load balancer, and as it
does not accept internal requests, the connection was timed out.
The only way we could avoid that is to not use fopen our url, is that right?
On Mon, Feb 11, 2013 at 4:26 AM, ma...@behnke.biz <ma...@behnke.biz> wrote:
>
>
> Adam Tong <adam.to...@gmail.com> hat am 10. Februar 2013 um 23:41 geschrieben:
>> Hi,
>>
>> We had an issue with the code of a junior php developer that used
>> fopen to load images using the url of the companies website that is
>> load balanced.
>>
>> We could not the detect the problem in dev and test because the dev
>> and test servers are not load balanced.
>>
>> I know that he could load the images using just the filesystem, but I
>> am curious to know why it failed and if the load balancer is really
>> the source of the problem or it is a limitation on the function
>> itself.
>
> Do you have any error messages for us?
> If the load balancer accessable from the internal servers? Normally it is not.
>
>
>>
>> Thank you
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> Marco Behnke
> Dipl. Informatiker (FH), SAE Audio Engineer Diploma
> Zend Certified Engineer PHP 5.3
>
> Tel.: 0174 / 9722336
> e-Mail: ma...@behnke.biz
>
> Softwaretechnik Behnke
> Heinrich-Heine-Str. 7D
> 21218 Seevetal
>
> http://www.behnke.biz
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I have noticed when doing a "top" via SSH on my GoDaddy virtual dedicated
server that every time a user logs in in the COMMAND column I see the
PHP-CGI process start to run, followed by mysqld. Often when these two
processes run I start to see a spike in average load, and sometimes this
spike spins out of control to the point that when trying to log on to my
Moodle 2.3.2 LMS I get an 500 Internal Server Error from Apache. Now, what
I'd like to know given the fact that I have only 2GBytes of RAM and am
sharing a processor with other users :-( is if there is any way to make
sure my PHP 5.3.3 is properly configured. I am given, for example, a choice
between CGI, fastCGI and Apache in my Plesk panel, and I am not quite sure
how to optimize things for my environment. I went to the Moodle.org site to
try and see what's the right setting, but it's not clear if the persons
writing there have a different setup or not. Unfortunately, it's impossible
to get specs on my VDS's processor from the fine folks at GoDaddy, and
perhaps there is just a simple processor power issue going on here, but I
only have 30 students and only a handful going in simultaneously. And at
times my average load can move from .08 to 1.5+ and all the way up to 2+
within the space of a few seconds. I should point out that at one point it
was discovered by GoDaddy technicial people that a user was running a rogue
process that overtaxing resources. But perhaps I also need to tweak my
installation despite this incident. Any help here would be appreciated.
--- End Message ---