On Wed, 12 Sep 2007, bruce wrote:
> while you are correct in your assertion that the shell cmds provided are
> specific to linux,
What assertions? I didn't know I made one. It's common sense but I
don't recall making an assertion and then asking you if it was correct.
> your assertion/statement
On 9/12/07, Chris <[EMAIL PROTECTED]> wrote:
> bruce wrote:
> > greg...
actually, i was the one that said this.
> Sure they can - enable safe-mode and it causes all sorts of weirdness
> with running exec or system calls.
not to mention shell commands expect to be in PATH, and if you
hardcode in
bruce wrote:
greg...
while you are correct in your assertion that the shell cmds provided are
specific to linux, your assertion/statement that the functions might be 'turned
off' are fud... basic bash functions are inherently part of the shell
Sure they can - enable safe-mode and it caus
eral@lists.php.net
Subject: Re: [PHP] Getting line count of a text file
On 9/12/07, Greg Donald <[EMAIL PROTECTED]> wrote:
> Why? Shell commands are a lot less likely to change than the
> current PHP function names.
>
> I'm aware the PHP function naming algorithm curre
On 9/12/07, Greg Donald <[EMAIL PROTECTED]> wrote:
> Why? Shell commands are a lot less likely to change than the
> current PHP function names.
>
> I'm aware the PHP function naming algorithm currently remains a
> secret, but without a doubt, someday someone _will_ crack it. I
> personally hope t
On Wed, 12 Sep 2007, mike wrote:
> personally i try to use as little shell commands as possible,
> especially stacked on top of each other in exec().
Why? Shell commands are a lot less likely to change than the
current PHP function names.
I'm aware the PHP function naming algorithm currently rem
Frank J. Schima wrote:
Hi all,
In PHP 5, I'm counting the number of lines in a text file using the
following code:
$myfile = file ( '/path/to/myfile.txt');
$count = count ($myfile);
However, sometimes it fails with the following error:
PHP Fatal error: Allowed memory size of
Hi Gang,
On Sep 12, 2007, at 1:58 PM, bruce wrote:
if you're going to do the system approach, go ahead and use awk/cut...
wc -l foo.txt | awk -F' ' '{print $1}'
should work assuming you're on linux.
I have solved the problem with this approach. Thanks for all the
suggestions.
FYI,
Frank J. Schima wrote:
> In PHP 5, I'm counting the number of lines in a text file using the
> following code:
> $myfile = file ( '/path/to/myfile.txt');
> $count = count ($myfile);
>
> However, sometimes it fails with the following error:
> PHP Fatal error: Allowed memory size of bytes exh
personally i try to use as little shell commands as possible,
especially stacked on top of each other in exec().
i'd just use explode, str_split, substr/strpos, etc. after i got it back.
On 9/12/07, Wolf <[EMAIL PROTECTED]> wrote:
> Novel approach... But mine's less typing. :)
>
> never thought
7; '{print $1}'
>
> should work assuming you're on linux.
>
>
>
> -Original Message-
> From: mike [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 12, 2007 12:46 PM
> To: Frank J. Schima
> Cc: php-general@lists.php.net
> Subject
2:46 PM
To: Frank J. Schima
Cc: php-general@lists.php.net
Subject: Re: [PHP] Getting line count of a text file
On 9/12/07, Frank J. Schima <[EMAIL PROTECTED]> wrote:
> In PHP 5, I'm counting the number of lines in a text file using the
> following code:
> $myfile
We all know REAL servers are *nix...
:)
And his path is *nix based...
:)
Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> On 9/12/07, Wolf <[EMAIL PROTECTED]> wrote:
> >
> > $command= escapeshellcmd("cat {$file} | wc -l");
> > // Run command and capture results
> > $count = exec($com
On Sep 12, 2007, at 1:46 PM, Nathan Nobbe wrote:
On 9/12/07, Wolf <[EMAIL PROTECTED]> wrote:
$command= escapeshellcmd("cat {$file} | wc -l");
// Run command and capture results
$count = exec($command);
that would work on *nix, but not windows.
Since I am developing and deploying
On 9/12/07, Wolf <[EMAIL PROTECTED]> wrote:
>
> $command= escapeshellcmd("cat {$file} | wc -l");
> // Run command and capture results
> $count = exec($command);
that would work on *nix, but not windows.
"Frank J. Schima" <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> >
> > In PHP
On 9/12/07, Frank J. Schima <[EMAIL PROTECTED]> wrote:
> In PHP 5, I'm counting the number of lines in a text file using the
> following code:
> $myfile = file ( '/path/to/myfile.txt');
> $count = count ($myfile);
>
> However, sometimes it fails with the following error:
>
$command= escapeshellcmd("cat {$file} | wc -l");
// Run command and capture results
$count = exec($command);
"Frank J. Schima" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>
> In PHP 5, I'm counting the number of lines in a text file using the
> following code:
> $myfil
17 matches
Mail list logo