php-general Digest 19 Mar 2013 08:46:29 -0000 Issue 8169
php-general Digest 19 Mar 2013 08:46:29 - Issue 8169 Topics (messages 320631 through 320648): Re: [PHP-DEV] feature request : easy shared memory 320631 by: Matijn Woudt Re: significance of escape character in string in PHP 320632 by: Stuart Dallas 320634 by: Matijn Woudt Re: significance of escape character in string in PHP - MySQL 320633 by: Arno Kuhl Surge 2013 CFP open 320635 by: Katherine Jeschke Session variable not persisting 320636 by: Éric Oliver Paquette 320637 by: Matijn Woudt 320638 by: Éric Oliver Paquette 320639 by: Matijn Woudt 320640 by: Éric Oliver Paquette 320641 by: Éric Oliver Paquette 320642 by: Matijn Woudt 320643 by: Éric Oliver Paquette 320644 by: Éric Oliver Paquette 320645 by: Ashley Sheridan 320646 by: Éric Oliver Paquette 320647 by: Marco Behnke Compiler for the PHP code 320648 by: Kevin Peterson 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 -- ---BeginMessage--- On Mon, Mar 18, 2013 at 3:46 AM, Larry Garfield la...@garfieldtech.comwrote: On 03/14/2013 01:21 PM, Bob Weinand wrote: Sharing active memory between processes goes against the shared nothing design of PHP. The lack of the feature you're describing is itself a feature. :-) If you had real shared memory, then you're now writing a multi-threaded app. Even if you aren't using threads per se it's the same level of potential for spooky action at a distance. If your problem space really requires that (and there certainly are those that do), Java or NodeJs will suit you better because those are built specifically for a persistent-server model, rather than PHP's shared-nothing design. However, in practice most PHP/web applications don't need that, because HTTP is a stateless request/response system. Shared-nothing more closely models what the actual environment is doing, and can still be very performant as long as you don't do anything naive. If you're doing something stateful like Web Sockets, then you can run PHP as a cli application that is its own persistent server rather than as an Apache add-on. For that, look at Ratchet: http://socketo.me/ --Larry Garfield If PHP should be so restrictive against sharing, why are there extensions like memcached, ...? Someone must have missed this possibility to share rapidly... If I need something like websockets, I use the pthreads extension: perfectly suited for stateful applications. For example: I want to have the database in memory (no, no mysql Memory-tables; this is too slow...) and only do the updates into the database for faster access when most contents are read-only. What are these good reasons against such a feature except it violates the shares-nothing superlative of PHP. (Even if this feature would exist, you can still write PHP without sharing) Bo Weinand Memcache is out of process. There are possible race conditions there, but FAR fewer and FAR more contained than true multi-threaded environments. This list has debated the merits of shared-nothing many times before; it was a deliberate design decision in the interest of simplifying development for the overwhelming majority of users. If your app is so performance sensitive that a memcache lookup is going to bring it to its knees, then either you're misusing PHP or you're better off using something other than PHP. (PHP is not the tool for every use case.) In any event, adding true shared memory to PHP would be nearly impossible without completely redesigning the way it interacts with web servers. The alternative is to write your own PHP CLI application that connects to sockets itself and runs as a daemon (possibly using the pthreads extention as you mention), and cut apache/nginx out of the picture entirely. If your use case calls for that, knock yourself out. But the good reasons against adding such a feature is that it would require rewriting everything and rearchitecting the entire Apache SAPI, which is not happening any time soon. --Larry Garfield I don't see why you would need to cut out apache/nginx. I would set up the server just like you (Larry) describe, with socket pthreads, but it would be far more easier to just create a simple php file inside your apache/nginx directory. Use something like mod_rewrite to redirect all urls to this php file. In this file, connect to the application server, send the request data ($_GET, $_POST, etc) to the application server, and pass all data retrieved from the application server back to the user. And there you go, you have an application server. - Matijn ---End
[PHP] Compiler for the PHP code
My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. Please suggest if we have any compiler option available for the PHP code and more important is this new option.
Re: [PHP] Compiler for the PHP code
Googling compile php code gave me this : http://stackoverflow.com/questions/1408417/can-you-compile-php-code It looks like you have some options but I haven't tried any yet, so I can't help you with the installation 2013/3/19 Kevin Peterson qh.res...@gmail.com My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. Please suggest if we have any compiler option available for the PHP code and more important is this new option. -- Camille Hodoul http://camille-hodoul.com/
Re: [PHP] Compiler for the PHP code
Dear Kevin, please install and use the PECL bcompiler extension. You will need to use the approprate version for your php regards On Tue, Mar 19, 2013 at 11:46 AM, Kevin Peterson qh.res...@gmail.comwrote: My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. Please suggest if we have aany compiler option available for the PHP code and more important is this new option. -- Tumwijukye Vincent Chief Executive Officer Future Link Technologies Plot 78 Kanjokya Street, P. O. BOX 75408, KAMPALA - UGANDA Tel: +256(0)774638790 Off:+256(0)41531274 Website: www.fl-t.com, www.savingsplus.info
Re: [PHP] Compiler for the PHP code
Checkout HipHop by the Facebook guys, it turns PHP into C code and compiles down to binary. ...although I don't think it's for the faint hearted. Have you tried other optimisation techniques first - eg Caching, and Profiling?? If this is a production environment you might wanna think about increasing resources or introducing a load balancer (in the case of PHP based websites) Cheers Ads. Sent from my BlackBerry® wireless device -Original Message- From: Camille Hodoul camille.hod...@gmail.com Date: Tue, 19 Mar 2013 09:52:14 To: Kevin Petersonqh.res...@gmail.com Cc: php-general@lists.php.net Subject: Re: [PHP] Compiler for the PHP code Googling compile php code gave me this : http://stackoverflow.com/questions/1408417/can-you-compile-php-code It looks like you have some options but I haven't tried any yet, so I can't help you with the installation 2013/3/19 Kevin Peterson qh.res...@gmail.com My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. Please suggest if we have any compiler option available for the PHP code and more important is this new option. -- Camille Hodoul http://camille-hodoul.com/
[PHP] Re: Compiler for the PHP code
Il Tue, 19 Mar 2013 08:46:22 +, Kevin Peterson ha scritto: My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. PHP gets compiled to bytecode on the server before being executed. You can cache the precompiled code with (for example) APC. Unless your code is several thousand lines of code (or your server very slow... 486-slow), the compilation phase is not that long. I think your main problem can be one of: 1- wrong algorithm 2- long waits (database, files, network, etc.) 3- heavy calculations Solutions: 1- find and use a different algorithm 2- Try to parallelize code (with gearman or similar, or via pctnl_fork) 3- rewrite the heavy functions in C, C++ or Go and compile them, then call them via PHP extensions or via gearman/fork. Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SPL Recursive Iterator Examples
I have not found enough documents about Recursive Iterators on the net, so started to collect my mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SPL Recursive Iterator Examples
On Tue, Mar 19, 2013 at 04:40:59AM -0700, NaMarPi wrote: I have not found enough documents about Recursive Iterators on the net, so started to collect my mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples If you are putting them up as examples, then it would be good if there were plentiful comments that said what they were supposed to do, why, how ... Regards -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include std_disclaimer.h -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SPL Recursive Iterator Examples
The usage of the examples: 1. the name of the php file reflects to the method(s) under consideration - find the related php.net manual page for more information 2. scroll down in the file, and you will find the result of the execution - Original Message - From: NaMarPi nama...@yahoo.com To: nama...@yahoo.com nama...@yahoo.com Cc: Sent: Tuesday, March 19, 2013 12:37 PM Subject: SPL Recursive Iterator Examples I have not found enough documents about Recursive iterators on the net, so started to colect mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SPL Recursive Iterator Examples
Why don't you post them on php.net? http://www.php.net/manual/add-note.php?sect=class.recursiveiteratorredirect=http://www.php.net/manual/de/class.recursiveiterator.php NaMarPi nama...@yahoo.com hat am 19. März 2013 um 13:01 geschrieben: The usage of the examples: 1. the name of the php file reflects to the method(s) under consideration - find the related php.net manual page for more information 2. scroll down in the file, and you will find the result of the execution - Original Message - From: NaMarPi nama...@yahoo.com To: nama...@yahoo.com nama...@yahoo.com Cc: Sent: Tuesday, March 19, 2013 12:37 PM Subject: SPL Recursive Iterator Examples I have not found enough documents about Recursive iterators on the net, so started to colect mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples -- 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
[PHP] Re: Re: SPL Recursive Iterator Examples
Thanks, I have heard about that feature for the first time. I will examine it. Why don't you post them on php.net? http://www.php.net/manual/add-note.php?sect=class.recursiveiteratorredirect=http://www.php.net/manual/de/class.recursiveiterator.php NaMarPi nama...@yahoo.com hat am 19. März 2013 um 13:01 geschrieben: The usage of the examples: 1. the name of the php file reflects to the method(s) under consideration - find the related php.net manual page for more information 2. scroll down in the file, and you will find the result of the execution I have not found enough documents about Recursive Iterators on the net, so started to collect mini-examples here: https://github.com/namarpi/PHP-SPL-Recursive-Examples -- 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/
RE: [PHP] Re: Compiler for the PHP code (memecached)
-Original Message- From: Alessandro Pellizzari [mailto:a...@amiran.it] Sent: Tuesday, March 19, 2013 2:06 AM To: php-general@lists.php.net Subject: [PHP] Re: Compiler for the PHP code Il Tue, 19 Mar 2013 08:46:22 +, Kevin Peterson ha scritto: My webcode written in PHP and it is running in the interpreted way. My problem is it is not giving the desired performance so want to try the compiler if any. PHP gets compiled to bytecode on the server before being executed. You can cache the precompiled code with (for example) APC. Unless your code is several thousand lines of code (or your server very slow... 486-slow), the compilation phase is not that long. I think your main problem can be one of: 1- wrong algorithm 2- long waits (database, files, network, etc.) 3- heavy calculations Solutions: 1- find and use a different algorithm 2- Try to parallelize code (with gearman or similar, or via pctnl_fork) 3- rewrite the heavy functions in C, C++ or Go and compile them, then call them via PHP extensions or via gearman/fork. Another thing you can do is store both page renders as well as database results in http://memcached.org/ blobs and pull from those in intelligent ways (you can creatively mix and match live stuff with cached stuff and you can make pages expire in defined hours via your cache class or even a crontab). We also add another layer in that if a blob exists in the memecached but not locally, we save it locally for the next hit. Depending on your hardware though the Gigabit/Fiber might be faster access than a local HD/SSD/RAM disk, so YMMV. We use LAMP and our site gets 30,000 hits per SECOND on two servers and 5 pools. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php