[PHP] Command line has no network access

2012-04-01 Thread Lester Caine
OK I probably know how to do this 10 years ago, but I'm not finding any prompts to remind me. Windows 2000, PHP5.2.10 cli ... I'm trying to set up a simple dump to run from scheduler. The code runs perfectly via the browser so I'm manually having to log in each day to run it. I've got an

Re: [PHP] Command line has no network access

2012-04-01 Thread David OBrien
On Apr 1, 2012 12:11 PM, Lester Caine les...@lsces.co.uk wrote: OK I probably know how to do this 10 years ago, but I'm not finding any prompts to remind me. Windows 2000, PHP5.2.10 cli ... I'm trying to set up a simple dump to run from scheduler. The code runs perfectly via the browser so

Re: [PHP] Command line has no network access

2012-04-01 Thread Matijn Woudt
On Sun, Apr 1, 2012 at 6:10 PM, Lester Caine les...@lsces.co.uk wrote: OK I probably know how to do this 10 years ago, but I'm not finding any prompts to remind me. Windows 2000, PHP5.2.10 cli ... I'm trying to set up a simple dump to run from scheduler. The code runs perfectly via the

Re: [PHP] Command line has no network access

2012-04-01 Thread Lester Caine
Matijn Woudt wrote: This is usually because of security settings. You might want to check under which user the scheduler starts the php script. Runs as administrator, it's on a secure internal network so it's not locked down. There aren't any other users on the machine anyway. wget has solved

Re: [PHP] Command line PHP

2011-01-11 Thread Richard Quadling
their own options/arguments too (so script command --help would show that command's help). If you are on windows, take a look at PHP command line usage on windows [2] to make things a lot easier for yourself. The app shows me differences in source files between different servers (live, dev, test, etc

Re: [PHP] Command line PHP

2011-01-11 Thread Robert Cummings
On 11-01-11 11:27 AM, Richard Quadling wrote: As PHP on windows requires an [ENTER] key to be pressed to pass the typed string to the code (even for fgetc(STDIN) ), then this may not be what you want. Have you tried setting the stream to non-blocking to prevent the need for the return key?

Re: [PHP] Command line PHP

2011-01-11 Thread Richard Quadling
On 11 January 2011 16:43, Robert Cummings rob...@interjinn.com wrote: On 11-01-11 11:27 AM, Richard Quadling wrote: As PHP on windows requires an [ENTER] key to be pressed to pass the typed string to the code (even for fgetc(STDIN) ), then this may not be what you want. Have you tried

Re: [PHP] Command line PHP

2011-01-11 Thread Richard Quadling
On 11 January 2011 16:43, Robert Cummings rob...@interjinn.com wrote: On 11-01-11 11:27 AM, Richard Quadling wrote: As PHP on windows requires an [ENTER] key to be pressed to pass the typed string to the code (even for fgetc(STDIN) ), then this may not be what you want. Have you tried

Re: [PHP] Command line PHP

2011-01-11 Thread Robert Cummings
On 11-01-11 11:55 AM, Richard Quadling wrote: On 11 January 2011 16:43, Robert Cummingsrob...@interjinn.com wrote: On 11-01-11 11:27 AM, Richard Quadling wrote: As PHP on windows requires an [ENTER] key to be pressed to pass the typed string to the code (even for fgetc(STDIN) ), then this

Re: [PHP] Command line PHP

2011-01-11 Thread Donovan Brooke
tedd wrote: At 1:54 PM -0500 1/7/11, Joshua Kehn wrote: Why should someone stop learning ever? Because my head fills up. I have to wait until I forget something before I can learn something new. The up-side is that I'm learning something new almost every day now. Cheers, tedd lol.. I

Re: [PHP] Command line PHP

2011-01-11 Thread Robert Cummings
On 11-01-11 12:14 PM, Donovan Brooke wrote: tedd wrote: At 1:54 PM -0500 1/7/11, Joshua Kehn wrote: Why should someone stop learning ever? Because my head fills up. I have to wait until I forget something before I can learn something new. The up-side is that I'm learning something new

Re: [PHP] Command line PHP

2011-01-11 Thread tedd
At 11:14 AM -0600 1/11/11, Donovan Brooke wrote: tedd wrote: At 1:54 PM -0500 1/7/11, Joshua Kehn wrote: Why should someone stop learning ever? Because my head fills up. I have to wait until I forget something before I can learn something new. The up-side is that I'm learning something new

Re: [PHP] Command line PHP

2011-01-11 Thread Richard Quadling
On 11 January 2011 17:53, Robert Cummings rob...@interjinn.com wrote: On 11-01-11 12:14 PM, Donovan Brooke wrote: tedd wrote: At 1:54 PM -0500 1/7/11, Joshua Kehn wrote: Why should someone stop learning ever? Because my head fills up. I have to wait until I forget something before I can

Re: [PHP] Command line PHP

2011-01-11 Thread David Harkness
On Tue, Jan 11, 2011 at 10:12 AM, tedd tedd.sperl...@gmail.com wrote: My down time is playing XBOX Black Ops. It allows my mind to focus on things that don't matter, much like a vacation, that's frees space For me that's Left 4 Dead 2 as Captain Cujo. I think it's beneficial to cultivate

Re: [PHP] Command line PHP

2011-01-08 Thread TR Shaw
On Jan 7, 2011, at 8:50 PM, David Hutto wrote: On Fri, Jan 7, 2011 at 8:44 PM, TR Shaw ts...@oitc.com wrote: On Jan 7, 2011, at 8:36 PM, David Hutto wrote: I'm with some of the others above on using Python. Writing a command line app is about as simple as: import subprocess word =

Re: [PHP] Command line PHP

2011-01-08 Thread David Hutto
Like i said, my introduction to php is browser,and desktop app is python, but I will try php in the command line out. 1) set a variable 2) call an external program with the variable as an argument this is something I recognize very well:) -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Command line PHP

2011-01-08 Thread Lester Caine
David Hutto wrote: I'm with some of the others above on using Python. Writing a command line app is about as simple as: snip I think of PHP as more browser, than desktop app/webapp. The point I was trying to make was one where there are two paths to doing the same job ... Example

Re: [PHP] Command line PHP

2011-01-08 Thread Daniel Brown
On Sat, Jan 8, 2011 at 07:25, TR Shaw ts...@oitc.com wrote: Sorry, David I should not reply quickly when I have a cold but again its all pretty similar. Here it is on unix/linux. PHP: $word = hello; exec(say \$word\); Bash: word=hello say $word ?php txt2wav('Hello','hello.wav'); ?

Re: [PHP] Command line PHP

2011-01-08 Thread Daniel Brown
On Sat, Jan 8, 2011 at 00:23, Larry Garfield la...@garfieldtech.com wrote: On Friday, January 07, 2011 9:34:42 pm David Hutto wrote: Which yielded this as the first result: http://php.net/manual/en/features.commandline.php As noted in my original email, I find the native SAPI clunky and

[PHP] Command line PHP

2011-01-07 Thread la...@garfieldtech.com
Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do command line interation. I'm not sure yet if it will be interactive or if I just need

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do command line

Re: [PHP] Command line PHP

2011-01-07 Thread Daniel Brown
On Fri, Jan 7, 2011 at 11:55, la...@garfieldtech.com la...@garfieldtech.com wrote: Hi folks.  I have a project coming up that will involve writing a non-trivial command line PHP application.  Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do

Re: [PHP] Command line PHP

2011-01-07 Thread a...@ashleysheridan.co.uk
...@garfieldtech.com Date: Fri, Jan 7, 2011 16:55 Subject: [PHP] Command line PHP To: php-general@lists.php.net Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 12:12 PM, Daniel Brown wrote: On Fri, Jan 7, 2011 at 12:01, Joshua Kehn josh.k...@gmail.com wrote: Why are you writing a command line application in PHP? I would think that is starting off on a very wrong foot. I would not be exaggerating to say that I've written

Re: [PHP] Command line PHP

2011-01-07 Thread Daniel Brown
On Fri, Jan 7, 2011 at 12:18, Joshua Kehn josh.k...@gmail.com wrote: Using another language more suited towards CLI / standalone (non-web) development would be easier. PHP at it's core is a templating language. I don't think it is as suited as say Python for developing standalone

Re: [PHP] Command line PHP

2011-01-07 Thread Andy McKenzie
On Fri, Jan 7, 2011 at 11:55 AM, la...@garfieldtech.com la...@garfieldtech.com wrote: Hi folks.  I have a project coming up that will involve writing a non-trivial command line PHP application.  Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 12:34 PM, Daniel Brown wrote: On Fri, Jan 7, 2011 at 12:18, Joshua Kehn josh.k...@gmail.com wrote: Using another language more suited towards CLI / standalone (non-web) development would be easier. PHP at it's core is a templating language. I don't think it is as suited

Re: [PHP] Command line PHP

2011-01-07 Thread Nathan Nobbe
On Fri, Jan 7, 2011 at 11:31 AM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 7, 2011, at 12:34 PM, Daniel Brown wrote: On Fri, Jan 7, 2011 at 12:18, Joshua Kehn josh.k...@gmail.com wrote: Using another language more suited towards CLI / standalone (non-web) development would be easier.

Re: [PHP] Command line PHP

2011-01-07 Thread Ashley Sheridan
On Fri, 2011-01-07 at 13:31 -0500, Joshua Kehn wrote: On Jan 7, 2011, at 12:34 PM, Daniel Brown wrote: On Fri, Jan 7, 2011 at 12:18, Joshua Kehn josh.k...@gmail.com wrote: Using another language more suited towards CLI / standalone (non-web) development would be easier. PHP at it's

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 1:48 PM, Nathan Nobbe wrote: shrug, you must not be too familiar with php then. 9 times out of 10 it's the natural, perfect choice for a cli program. there are situations where you get past what php is ideal for on the cli, typically when you get into heavy forking or

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 1:53 PM, Ashley Sheridan wrote: There's no real reason why you shouldn't use PHP for cli apps, it has a lot of features specifically intended for it even. I've found it to be fast enough for my needs, it's familiar, and I don't need to compile an app every time I make a

Re: [PHP] Command line PHP

2011-01-07 Thread Daniel Brown
On Fri, Jan 7, 2011 at 13:31, Joshua Kehn josh.k...@gmail.com wrote: My apologies. I just view PHP as a perfected web language, due to it's templating nature, while using it for other things (scripts, utilities, cron) is a misuse in my opinion. No one ever needs to apologize for their

Re: [PHP] Command line PHP

2011-01-07 Thread la...@garfieldtech.com
On 1/7/11 11:08 AM, Nicholas Kell wrote: On Jan 7, 2011, at 11:01 AM, Joshua Kehn wrote: On Jan 7, 2011, at 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and

Re: [PHP] Command line PHP

2011-01-07 Thread David Harkness
On Fri, Jan 7, 2011 at 10:31 AM, Joshua Kehn josh.k...@gmail.com wrote: My apologies. I just view PHP as a perfected web language, due to it's templating nature, while using it for other things (scripts, utilities, cron) is a misuse in my opinion. Even if you are proficient in more

Re: [PHP] Command line PHP

2011-01-07 Thread Robert Cummings
On 11-01-07 01:31 PM, Joshua Kehn wrote: On Jan 7, 2011, at 12:34 PM, Daniel Brown wrote: On Fri, Jan 7, 2011 at 12:18, Joshua Kehnjosh.k...@gmail.com wrote: Using another language more suited towards CLI / standalone (non-web) development would be easier. PHP at it's core is a templating

Re: [PHP] Command line PHP

2011-01-07 Thread Nathan Nobbe
On Fri, Jan 7, 2011 at 11:54 AM, Joshua Kehn josh.k...@gmail.com wrote: On Jan 7, 2011, at 1:48 PM, Nathan Nobbe wrote: shrug, you must not be too familiar with php then. 9 times out of 10 it's the natural, perfect choice for a cli program. there are situations where you get past what php

Re: [PHP] Command line PHP

2011-01-07 Thread Joshua Kehn
On Jan 7, 2011, at 1:41 PM, la...@garfieldtech.com wrote: Application is perhaps a misnomer. I'm not looking at rewriting Emacs or anything. Just some batch processing that would get run as: php myscript.php --config=foo.xml --setting-1=stuff And then it will run off and move a few

Re: [PHP] Command line PHP

2011-01-07 Thread David Harkness
On Fri, Jan 7, 2011 at 10:41 AM, la...@garfieldtech.com la...@garfieldtech.com wrote: Application is perhaps a misnomer. I'm not looking at rewriting Emacs or anything. Just some batch processing that would get run as: php myscript.php --config=foo.xml --setting-1=stuff For this I used

Re: [PHP] Command line PHP

2011-01-07 Thread Robert Cummings
On 11-01-07 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz, but it will need to do command line interation. I'm not

Re: [PHP] Command line PHP

2011-01-07 Thread TR Shaw
On Jan 7, 2011, at 12:08 PM, Nicholas Kell wrote: On Jan 7, 2011, at 11:01 AM, Joshua Kehn wrote: On Jan 7, 2011, at 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be

Re: [PHP] Command line PHP

2011-01-07 Thread Ashley Sheridan
On Fri, 2011-01-07 at 11:31 -0800, David Harkness wrote: On Fri, Jan 7, 2011 at 10:41 AM, la...@garfieldtech.com la...@garfieldtech.com wrote: Application is perhaps a misnomer. I'm not looking at rewriting Emacs or anything. Just some batch processing that would get run as: php

Re: [PHP] Command line PHP

2011-01-07 Thread tedd
At 11:48 AM -0700 1/7/11, Nathan Nobbe wrote: why bother learning 2 languages when 1 will suit most needs perfectly? for most folks who work with the web and a typical deployment environment like a linux server, the second language of choice most likely would be a client side one like

Re: [PHP] Command line PHP

2011-01-07 Thread Robert Cummings
On 11-01-07 02:33 PM, Robert Cummings wrote: On 11-01-07 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial command line PHP application. Most of it will be nice and abstracted and standalone and all of that jazz, but it will

Re: [PHP] Command line PHP

2011-01-07 Thread tedd
At 1:54 PM -0500 1/7/11, Joshua Kehn wrote: Why should someone stop learning ever? Because my head fills up. I have to wait until I forget something before I can learn something new. The up-side is that I'm learning something new almost every day now. Cheers, tedd -- ---

Re: [PHP] Command line PHP

2011-01-07 Thread tedd
At 12:16 PM -0700 1/7/11, Nathan Nobbe wrote: On Fri, Jan 7, 2011 at 11:54 AM, Joshua Kehn josh.k...@gmail.com wrote: Why bother learning other languages? Is this a joke? Why should someone stop learning *ever?** *Having a mastery of multiple languages can only enhance you. No, it's not

Re: [PHP] Command line PHP

2011-01-07 Thread Robert Cummings
On 11-01-07 02:53 PM, tedd wrote: At 12:16 PM -0700 1/7/11, Nathan Nobbe wrote: On Fri, Jan 7, 2011 at 11:54 AM, Joshua Kehnjosh.k...@gmail.com wrote: Why bother learning other languages? Is this a joke? Why should someone stop learning *ever?** *Having a mastery of multiple languages

Re: [PHP] Command line PHP

2011-01-07 Thread Nathan Nobbe
On Fri, Jan 7, 2011 at 12:53 PM, tedd tedd.sperl...@gmail.com wrote: At 12:16 PM -0700 1/7/11, Nathan Nobbe wrote: On Fri, Jan 7, 2011 at 11:54 AM, Joshua Kehn josh.k...@gmail.com wrote: Why bother learning other languages? Is this a joke? Why should someone stop learning *ever?**

Re: [PHP] Command line PHP

2011-01-07 Thread Robert Cummings
On 11-01-07 03:24 PM, Nathan Nobbe wrote: much of the gripe comparing php to python over the years is slowly fading with the advent of new features of php, most notably closures. once traits are available im sure the multiple inheritance that python offers will be less of an advantage over

Re: [PHP] Command line PHP

2011-01-07 Thread Nicholas Kell
On Jan 7, 2011, at 1:34 PM, TR Shaw wrote: On Jan 7, 2011, at 12:08 PM, Nicholas Kell wrote: On Jan 7, 2011, at 11:01 AM, Joshua Kehn wrote: On Jan 7, 2011, at 11:55 AM, la...@garfieldtech.com wrote: Hi folks. I have a project coming up that will involve writing a non-trivial

Re: [PHP] Command line PHP

2011-01-07 Thread tedd
At 1:24 PM -0700 1/7/11, Nathan Nobbe wrote: On Fri, Jan 7, 2011 at 12:53 PM, tedd mailto:tedd.sperl...@gmail.comtedd.sperl...@gmail.com wrote: much of the gripe comparing php to python -nathan I try to stay away from snakes. Cheers, tedd -- --- http://sperling.com/ -- PHP General

Re: [PHP] Command line PHP

2011-01-07 Thread tedd
At 3:05 PM -0500 1/7/11, Robert Cummings wrote: Is the winner JavaScript? *ducks and runs* Rob. Careful or I'll have to fog you as well. :-) Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Command line PHP

2011-01-07 Thread Nathan Nobbe
On Fri, Jan 7, 2011 at 2:52 PM, tedd tedd.sperl...@gmail.com wrote: At 1:24 PM -0700 1/7/11, Nathan Nobbe wrote: On Fri, Jan 7, 2011 at 12:53 PM, tedd mailto:tedd.sperl...@gmail.com tedd.sperl...@gmail.com wrote: much of the gripe comparing php to python -nathan I try to stay away from

Re: [PHP] Command line PHP

2011-01-07 Thread Lester Caine
Joshua Kehn wrote: why bother learning 2 languages when 1 will suit most needs perfectly? for most folks who work with the web and a typical deployment environment like a linux server, the second language of choice most likely would be a client side one like javascript. You can't say that

Re: [PHP] Command line PHP

2011-01-07 Thread David Hutto
I'm with some of the others above on using Python. Writing a command line app is about as simple as: import subprocess word = 'hello' self.espeak = subprocess.Popen(['espeak', word], stdout = subprocess.PIPE).communicate()[0] I think of PHP as more browser, than desktop app/webapp. -- PHP

Re: [PHP] Command line PHP

2011-01-07 Thread David Hutto
There have been a lot of responses, but this might be the best place to start: http://www.google.com/search?client=ubuntuchannel=fsq=command+line+PHP+application.ie=utf-8oe=utf-8 Which yielded this as the first result: http://php.net/manual/en/features.commandline.php -- PHP General Mailing

Re: [PHP] Command line PHP

2011-01-07 Thread Larry Garfield
On Friday, January 07, 2011 9:34:42 pm David Hutto wrote: Which yielded this as the first result: http://php.net/manual/en/features.commandline.php As noted in my original email, I find the native SAPI clunky and difficult to work with. Hence I was looking for something more usable and

Re: [PHP] Command line PHP

2011-01-07 Thread David Hutto
I could go yoda, but suffice it to say, From The Language Speaks The Soul Of The Man's Design. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Command-line PHP memory limit

2008-06-12 Thread Shawn McKenzie
Per Jessen wrote: Rene Fournier wrote: Is it possible to set a unique memory limit for PHP scripts that are run from the command line? (That is, different from what's specified in php.ini.) This might specific to openSUSE, but the typical installation comes with separate php.inis for apache

RE: [PHP] Command-line PHP memory limit

2008-06-12 Thread Boyd, Todd M.
-Original Message- From: Shawn McKenzie [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2008 11:06 AM To: php-general@lists.php.net Subject: Re: [PHP] Command-line PHP memory limit Per Jessen wrote: Rene Fournier wrote: Is it possible to set a unique memory limit for PHP

[PHP] Command-line PHP memory limit

2008-06-11 Thread Rene Fournier
Is it possible to set a unique memory limit for PHP scripts that are run from the command line? (That is, different from what's specified in php.ini.) ...Rene

Re: [PHP] Command-line PHP memory limit

2008-06-11 Thread Robert Cummings
On Wed, 2008-06-11 at 23:48 +0200, Rene Fournier wrote: Is it possible to set a unique memory limit for PHP scripts that are run from the command line? (That is, different from what's specified in php.ini.) In your script: ini_set( 'memory_limit', -1 ); Cheers, Rob. --

Re: [PHP] Command-line PHP memory limit

2008-06-11 Thread Per Jessen
Rene Fournier wrote: Is it possible to set a unique memory limit for PHP scripts that are run from the command line? (That is, different from what's specified in php.ini.) This might specific to openSUSE, but the typical installation comes with separate php.inis for apache and cli.

Re: [PHP] MySQL to blame? (was Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?)

2008-01-02 Thread Chris
M5 wrote: On 20-Dec-07, at 1:17 AM, Per Jessen wrote: René Fournier wrote: I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal: When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's doing. I have, and I can't see anything

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-20 Thread Per Jessen
René Fournier wrote: I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal: When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's doing. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] MySQL to blame? (was Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?)

2007-12-20 Thread M5
On 20-Dec-07, at 1:17 AM, Per Jessen wrote: René Fournier wrote: I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal: When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's doing. I have, and I can't see anything unusual. There

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-19 Thread René Fournier
On 11-Dec-07, at 2:13 PM, Per Jessen wrote: René Fournier wrote: However, the number of socket clients connecting in the past 3-4 months has steadily increased, and this seems to have exposed (if not created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45 and/or Mac OS X Server

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-12 Thread Per Jessen
Jochem Maas wrote: Have you tried stracing it to see what's really happening when the load goes that high? am I correct that that would be done like so?: strace -p process id of php deamon Yep, that's it. You'll probably want to record the output for analysis, but sometimes it's very

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Jim Lucas
M5 wrote: Thanks Jim. No problem. The processing is pretty quick. I don't think that's a bottleneck. It basically just inserts the data into MySQL, not much processing actually. What is the likely hood that two connections would come in at the same time, or at least within close

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Nathan Rixham
stream_socket_server simply listens, stream_socket_accept handles the connection, stream_set_write_buffer and stream_set_blocking help you keep up, especially when combined with stream_get_line, no need to shile forever when you can just: while (is_resource($conn =

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Jochem Maas
hi Nathan, any chance of a 'full blown' example for all the muppets who want to try and grok this stuff? (bork bork, say I :-)) Nathan Rixham wrote: stream_socket_server simply listens, stream_socket_accept handles the connection, stream_set_write_buffer and stream_set_blocking help you keep

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Per Jessen
Jochem Maas wrote: Nathan Rixham wrote: Key I find though is multithreading, listener thread with stream_socket_server, 2 or 3 stream_socket_accept threads and a pair of new thread spawned to handle each connection (one to read, one to write) (not needed for stateless http style request

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Jochem Maas
Per Jessen wrote: Jochem Maas wrote: Nathan Rixham wrote: Key I find though is multithreading, listener thread with stream_socket_server, 2 or 3 stream_socket_accept threads and a pair of new thread spawned to handle each connection (one to read, one to write) (not needed for stateless

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Per Jessen
Jochem Maas wrote: I'd be interested to see how he does the multi-threading in php. Personally I'd always opt for C to write this type of thing, except for perhaps the most simple cases. any chance of an example from you too? Sure - http://jessen.ch/files/distripg_main.c It can't be

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread René Fournier
That makes sense, but I'm not sure I really want to do this, since it's fairly important that Listener continue listening without interruption. I also don't think it's probably necessary, since from what I read, I'm not really pushing the envelope in terms of real load. Right now, I

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Per Jessen
René Fournier wrote: However, the number of socket clients connecting in the past 3-4 months has steadily increased, and this seems to have exposed (if not created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45 and/or Mac OS X Server 10.4.11. (I say and/or because I am unsure

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-11 Thread Jochem Maas
Per Jessen wrote: René Fournier wrote: However, the number of socket clients connecting in the past 3-4 months has steadily increased, and this seems to have exposed (if not created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45 and/or Mac OS X Server 10.4.11. (I say and/or

[PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread René Fournier
Hello, I have a command-line PHP script--called Listener--that is designed to run indefinitely with a predictable CPU usage and memory footprint. In a nutshell, it's a multi-client socket server that waits for incoming connections, processes incoming data, stores results in a MySQL

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Jim Lucas
René Fournier wrote: Hello, I have a command-line PHP script--called Listener--that is designed to run indefinitely with a predictable CPU usage and memory footprint. In a nutshell, it's a multi-client socket server that waits for incoming connections, processes incoming data, stores

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread René Fournier
Hi Jim, I have a server that listens like yours does. I get 80k - 85k connections a day to it. When I first started it, I was only getting about 3k of connections aday. Then I upped the listening pattern and it tanked. I noticed that all my mail/web/db connections just sat there.

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Tom Rogers
Hi, Tuesday, December 11, 2007, 6:42:18 AM, you wrote: RF Hello, RF I have a command-line PHP script--called Listener--that is designed RF to run indefinitely with a predictable CPU usage and memory RF footprint. In a nutshell, it's a multi-client socket server that RF waits for incoming

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread René Fournier
On 10-Dec-07, at 4:42 PM, Tom Rogers wrote: Put a usleep(1000) in the listen while() loop and give the cpu a break. Good advice, but I've already been doing that. The thing is, when the script first starts up, the CPU rarely exceeds 30%, even when many clients (200+) are simultaneously

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Jim Lucas
Tom Rogers wrote: Hi, Tuesday, December 11, 2007, 6:42:18 AM, you wrote: RF Hello, Put a usleep(1000) in the listen while() loop and give the cpu a break. This makes me think about asking if you have to short of a timeout on your receiving connection? What are you using to setup your

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Jochem Maas
Jim Lucas wrote: Tom Rogers wrote: Hi, ... Also, make sure you are not using an array that you are not re-initializing through each iteration of the loop. If the array keeps getting bigger, PHP might $*% on itself. Always re-initialize arrays to clean them up. even then he may still

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread René Fournier
On 10-Dec-07, at 5:20 PM, Jim Lucas wrote: Tom Rogers wrote: Hi, Tuesday, December 11, 2007, 6:42:18 AM, you wrote: RF Hello, Put a usleep(1000) in the listen while() loop and give the cpu a break. This makes me think about asking if you have to short of a timeout on your receiving

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Jochem Maas
Jochem Maas wrote: Jim Lucas wrote: Tom Rogers wrote: Hi, ... Also, make sure you are not using an array that you are not re-initializing through each iteration of the loop. If the array keeps getting bigger, PHP might $*% on itself. Always re-initialize arrays to clean them up.

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Jim Lucas
René Fournier wrote: FWIW, here's the stripped-down skeleton of the server: As always, constructive criticism is very welcome. ?php $socket = stream_socket_server(tcp://127.0.0.1:9876, $errno, $errstr); if ($socket) { $master[] = $socket; $read = $master; $write = $master;

Re[2]: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread Tom Rogers
Hi, Tuesday, December 11, 2007, 10:01:38 AM, you wrote: RF On 10-Dec-07, at 4:42 PM, Tom Rogers wrote: Put a usleep(1000) in the listen while() loop and give the cpu a break. RF Good advice, but I've already been doing that. The thing is, when the RF script first starts up, the CPU rarely

Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread M5
Thanks Jim. Several good points here that I will look into. I've already moved the include() bits into function calls. (That's simple thing I should have corrected long ago.) The socket areas though I'm less sure about how to adjust, since networking programming isn't something I grok

Re: Re[2]: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-10 Thread M5
Curiously, would you agree with this guy's comments concerning low- level PHP socket functions vs stream_socket_server() ? If you want a high speed socket server, use the low-level sockets instead (socket_create/bind/listen). The stream_socket_server version appears to have internal fixed

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul
Below you have described a client. I'm talking about a server. That was clear in my original post. -Paul W Greg Donald wrote: On Tue, 4 Sep 2007, Paul wrote: Which part do you need help with? The SSL part or the command line or the port or ... ? http://www.php.net/openssl

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Greg Donald
On Wed, 5 Sep 2007, Paul wrote: Below you have described a client. I'm talking about a server. That was clear in my original post. Why on earth would you need to implement an SSL socket in PHP when we have Apache and openssl? That's pointless. Anywhere PHP can run Apache can run.. and with

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul
Greg Donald wrote: On Wed, 5 Sep 2007, Paul wrote: Below you have described a client. I'm talking about a server. That was clear in my original post. Why on earth would you need to implement an SSL socket in PHP when we have Apache and openssl? That's pointless. Anywhere PHP can run Apache

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Per Jessen
Paul wrote: Why on earth would you need to implement an SSL socket in PHP when we have Apache and openssl? That's pointless. Anywhere PHP can run Apache can run.. and with much better performance. Because the client is incapable of HTTPS or HTTP protocols. Not that I really should need

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Kirk Friggstad
On 9/5/07, Paul [EMAIL PROTECTED] wrote: Greg Donald wrote: Why on earth would you need to implement an SSL socket in PHP when we have Apache and openssl? That's pointless. Anywhere PHP can run Apache can run.. and with much better performance. Because the client is incapable of HTTPS

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Greg Donald
On Wed, 5 Sep 2007, Paul wrote: Because the client is incapable of HTTPS or HTTP protocols. Not that I really should need to answer this. Why on earth would you assume I don't have a good reason? In what way is this answer to my question even a little helpful? It's not every day someone

Re: [PHP] Command line socket server and SSL

2007-09-05 Thread Paul
Greg Donald wrote: On Wed, 5 Sep 2007, Paul wrote: Because the client is incapable of HTTPS or HTTP protocols. Not that I really should need to answer this. Why on earth would you assume I don't have a good reason? In what way is this answer to my question even a little helpful? It's not

[PHP] Command line socket server and SSL

2007-09-04 Thread Paul
I need to program a socket server in PHP that can use a certificate and communicate over SSL. I'm doing fine without SSL. Can't use port 443 or the web server for this, so it needs to be a command line app. Can't seem to find any documentation about how to set that up. Can anyone help or

Re: [PHP] Command line socket server and SSL

2007-09-04 Thread Chris
Paul wrote: I need to program a socket server in PHP that can use a certificate and communicate over SSL. I'm doing fine without SSL. Can't use port 443 or the web server for this, so it needs to be a command line app. Can't seem to find any documentation about how to set that up. Can anyone

Re: [PHP] Command line socket server and SSL

2007-09-04 Thread Paul
Chris wrote: Paul wrote: I need to program a socket server in PHP that can use a certificate and communicate over SSL. I'm doing fine without SSL. Can't use port 443 or the web server for this, so it needs to be a command line app. Can't seem to find any documentation about how to set that

Re: [PHP] Command line socket server and SSL

2007-09-04 Thread Greg Donald
On Tue, 4 Sep 2007, Paul wrote: Which part do you need help with? The SSL part or the command line or the port or ... ? http://www.php.net/openssl http://www.php.net/sockets I am familiar with the above links. What I cannot locate is anything that indicates that a cmd line socket

  1   2   3   >