php-general Digest 8 Nov 2011 10:46:22 -0000 Issue 7557
Topics (messages 315607 through 315610):
Re: Regular Expression
315607 by: Richard Quadling
Re: session_start(), memcache taking too much resources
315608 by: Stuart Dallas
Increasing maximum file descriptors (OS X Lion 10.7, PHP 5.3.8 via Macports)
315609 by: René Fournier
Re: pcre little problem
315610 by: tamouse mailing lists
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On 5 November 2011 05:39, Negin Nickparsa <[email protected]> wrote:
> your welcome my Friend,I used it myself.
>
> On 11/4/11, drive view <[email protected]> wrote:
> > Thanks alot Negin for the prompt reply. This is most useful.
> >
> > Regards
> >
> > Best Toni
> >
> > On Sat, Nov 5, 2011 at 6:30 AM, Negin Nickparsa <[email protected]>
> wrote:
> >
> >> http://weblogtoolscollection.com/regex/regex.php
> >>
> >> On 11/4/11, drive view <[email protected]> wrote:
> >> > Hi
> >> >
> >> > I'm new to PHP. I'm currently trying understand how to apply the
> >> patterns
> >> > for the preg* commands and I am having difficulty finding a good
> source
> >> > explaining in detail how to build a filter. I would appreciate if
> >> someone
> >> > can direct me to such a website.
> >> >
> >> > Thanks
> >> >
> >> > Toni
> >> >
> >>
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I use http://www.regular-expressions.info
The site's author also has a book which I would recommend :
http://www.regular-expressions.info/cookbook.html
--
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370
--- End Message ---
--- Begin Message ---
On 3 Nov 2011, at 20:22, Ing. Branislav Geržo wrote:
> I am running high loaded website and I did some profiling, because
> webservers got high load. PHP Version 5.3.8, running FreeBSD 8.2-STABLE,
> on lighttpd 1.4.29, running php-fpm on 3 servers
>
> xdebug is showing, that calling line "session_start()" is taking too
> much time, which I am really surprised. So I think, something is wrong
> with session handler. Please check screenshot:
>
> http://oi42.tinypic.com/24czlu8.jpg
>
> session.save_handler memcache
> session.save_path
> tcp://web1:11211?persistent=1&weight=1timeout=2&retry_interval=5,
> tcp://web2:11211?persistent=1&weight=1&timeout=2&retry_interval=5
>
> I am using pecl memcache 3.0.6
Sounds to me like an issue connecting to memcached, possibly DNS-related. How
is the lookup of web1/web2 being performed? Have you tried the lookup on the
server?
Alternatively try connecting to the memcached servers using netcat or telnet -
does that exhibit the same delay?
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
I have a working socket server in PHP that I wish to improve (allow for more
socket connections). I am running into a limit I can't crack, related to the
max number of incoming socket connections. Using Macports for package
management... I've recompiled PHP with the --enable-fd-setsize=2048 in the port
file) … but I still get the following PHP warning once my socket server tries
to accept more than 1024 clients (800, 900 are okay):
PHP Warning: socket_select(): You MUST recompile PHP with a larger value of
FD_SETSIZE.
It is set to 2048, but you have descriptors numbered at least as high as
1027.
--enable-fd-setsize=2048 is recommended, but you may want to set it
to equal the maximum number of open files supported by your system,
Weird right? Shows I have it set in PHP, so maybe it's a resource limit? But
having changed sysctl.conf, ulimit -a shows:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 2048
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 709
virtual memory (kbytes, -v) unlimited
So I should be able to have up to 2048 files (sockets) open, but PHP still
complains. What am I missing? Any ideas what I should try next?
...Rene
--- End Message ---
--- Begin Message ---
On Mon, Nov 7, 2011 at 5:54 AM, Richard Quadling <[email protected]> wrote:
> On 4 November 2011 16:52, QI.VOLMAR QI <[email protected]> wrote:
>
>> i have this part of code that works with DOMDocument:
>>
>> public function translateNFeXML(NFE $nfe_factory) {
>> $inf_adic = $nfe_factory->createElement('infAdic');
>> if ($this->inf_ad_fisco) {
>> $inf_adic_fisco =
>> $nfe_factory->createElement('infAdicFisco', $this->inf_ad_fisco);
>> $inf_adic->appendChild($inf_adic_fisco);
>> }
>>
>> $string = "a=10&b[]=20&c=30n°&d=40+:50";
>> die(preg_filter('/[^:][[:punct:]]/', '', $string));
>> $inf_cpl = $nfe_factory->createElement('infCpl',
>> $this->inf_complementar);
>>
>> QUESTION: Why the preg_filter causes a end of the application, with no
>> error throwing (even in die don't appears nothing)?
>
>
> preg_filter() returns NULL if there are no matches and the subject is a
> string.
>
> And ...
>
> php -r "die(null);"
>
> outputs nothing.
Here:
>> die(preg_filter('/[^:][[:punct:]]/', '', $string));
Did you really want to do this:
preg_filter('/[^:][[:punct:]]/', '', $string) or die("nothing returned\n");
???
See http://php.net/manual/en/function.preg-filter.php "Return values"
as Richard points out preg_filter returns NULL if there are no matched
in a string.
Now this is interesting:
>> $string = "a=10&b[]=20&c=30n°&d=40+:50";
There is a wide character in that string following 30n. The preg
functions sometimes don't deal well with wide characters in my
experience (it's not 100% anyway), you probably need to use the mb_
functions instead.
--- End Message ---