|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Fri Nov 08 2002 - 19:57:52 CST
php-general Digest 9 Nov 2002 01:57:52 -0000 Issue 1693
Topics (messages 123376 through 123528):
Re: string to array
123376 by: Erwin
123378 by: Marek Kilimajer
123379 by: Maxim Maletsky
Re: How to echo the end marker '?>'
123377 by: . Edwin
123451 by: John W. Holmes
123454 by: Jason Young
Re: Convince teh boss
123380 by: . Edwin
Unable to execute c++ .exe file from php
123381 by: Ladan Pickering
123385 by: Marek Kilimajer
123386 by: Ernest E Vogelsinger
123438 by: Mike Mannakee
123469 by: Ladan Pickering
123470 by: John W. Holmes
123472 by: Ladan Pickering
123504 by: Ladan Pickering
123519 by: Mike Mannakee
123523 by: Ernest E Vogelsinger
Wildcard search
123382 by: Mako Shark
123383 by: Marco Tabini
123387 by: Mark Charette
123407 by: Mako Shark
123408 by: Marco Tabini
123439 by: Charles Wiltgen
123443 by: Mako Shark
123445 by: Marco Tabini
123458 by: Mako Shark
Re: ob_gzhandler
123384 by: Serge Paquin
123388 by: Serge Paquin
123389 by: Ernest E Vogelsinger
123390 by: Serge Paquin
123391 by: Ernest E Vogelsinger
Other Notice problem...
123392 by: R B
123393 by: Marco Tabini
123394 by: Ernest E Vogelsinger
123403 by: R B
123405 by: Marco Tabini
123406 by: Ernest E Vogelsinger
123410 by: R B
123411 by: Ernest E Vogelsinger
123415 by: R B
123417 by: Stuart
123418 by: R B
123420 by: Stuart
123425 by: Ernest E Vogelsinger
123427 by: Jason Wong
123428 by: Jason Wong
123430 by: Marco Tabini
123436 by: Jason Wong
123440 by: R B
123441 by: Stuart
Re: Weird behaviour with references to objects...
123395 by: Tim Molendijk
123397 by: Ernest E Vogelsinger
123398 by: Ernest E Vogelsinger
123402 by: Tim Molendijk
123404 by: Ernest E Vogelsinger
123413 by: Tim Molendijk
123419 by: Ernest E Vogelsinger
Re: File locking problem
123396 by: Charles Wiltgen
123400 by: Ernest E Vogelsinger
123437 by: Charles Wiltgen
Re: PHP fopen() bug + solution
123399 by: Charles Wiltgen
Re: For ... <= max($myArray) vs For ... <= $max
123401 by: Kjartan Mannes
123433 by: Maxim Maletsky
123455 by: .: B i g D o g :.
123463 by: Marek Kilimajer
123471 by: .: B i g D o g :.
registering object in session - Object to string notice error?
123409 by: Paul
123520 by: BAROILLER Pierre-Emmanuel
php/html debug
123412 by: Anna Gyor
123426 by: .: B i g D o g :.
123431 by: Maxim Maletsky
Re: confirm unsubscribe from php-general
lists.php.net
123414 by: Serge Paquin
problem compiling php
123416 by: dk1eng
123422 by: Jason Wong
123423 by: .: B i g D o g :.
ftp file exists
123421 by: Fifield, Mike
123424 by: Marco Tabini
123429 by: Jule Slootbeek
dynamic variable headache
123432 by: ROBERT MCPEAK
123434 by: Maxim Maletsky
123435 by: Bobby Patel
123447 by: John W. Holmes
Search engine simulation...
123442 by: R B
123444 by: Marco Tabini
123449 by: R B
123456 by: R B
Re: HTTP POST FILE UPLOAD HELP
123446 by: . Darwin
123448 by: . Darwin
123464 by: . Darwin
123466 by: Jason Wong
123513 by: Justin French
123514 by: BAROILLER Pierre-Emmanuel
Lynx/Apache PHP execution vs. PHP interpreter
123450 by: Jason Young
123453 by: John W. Holmes
123461 by: Chris Wesley
arg parsing
123452 by: phil
123457 by: Jason Young
123459 by: Marco Tabini
123460 by: John W. Holmes
how can I unsubscribe from this
123462 by: Joe Reichmuth, PolyTechDev, GTD USA
123517 by: BAROILLER Pierre-Emmanuel
Re: specifying different port for db connections
123465 by: heath boutwell
LDAP + Exchange
123467 by: Raceeend
123468 by: .: B i g D o g :.
123473 by: Raceeend
123474 by: .: B i g D o g :.
123475 by: Marco Tabini
123476 by: .: B i g D o g :.
123477 by: Raceeend
123478 by: Raceeend
123479 by: Raceeend
123480 by: Raceeend
php.ini
123481 by: dk1eng
123483 by: Marco Tabini
123485 by: dk1eng
123486 by: Marco Tabini
123487 by: Stuart
123488 by: Sascha Cunz
123497 by: Ernest E Vogelsinger
123503 by: dk1eng
Questions on PHP Variables
123482 by: Ray Seals
123484 by: Marco Tabini
123512 by: Justin French
Installation Kit
123489 by: Stephen
123490 by: Adam Williams
123491 by: Stephen
123495 by: John W. Holmes
123501 by: Stephen
123510 by: electroteque
big include
123492 by: Khalid El-Kary
123493 by: Marco Tabini
123498 by: Ernest E Vogelsinger
123499 by: Khalid El-Kary
123516 by: BAROILLER Pierre-Emmanuel
Re: Finding HTML
123494 by: Stephen
123496 by: Marco Tabini
123500 by: Stephen
123502 by: Marco Tabini
123509 by: Stephen
123511 by: Marco Tabini
wanted: array_diff for more than values
123505 by: Nick Eby
123507 by: Nick Eby
123508 by: Kevin Stone
123515 by: BAROILLER Pierre-Emmanuel
123518 by: Nick Eby
123521 by: Nick Eby
php 4.3r2 and directive overrides
123506 by: electroteque
DHTML and PHP
123522 by: John Meyer
Do I need the closing ?> tag
123524 by: David McArthur
123527 by: Ernest E Vogelsinger
RE
123525 by: Karl James
Re: [PHP-DEV] Do I need the closing ?> tag
123526 by: Sterling Hughes
¿ QUIERES GANAR DINERO POR INTERNET ??
123528 by: Dinero en Internet
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
>> $string = explode( '', 'string' );
Timothy Hitchens wrote:
> That won't work.. empty delimiter errors always..
Your right, I didn't know.
> you will have to use
> my preg one from earlier...
But your preg thingy will only split at spaces, so that'll have to change to
<?
$string = 'test';
preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
?>
in this case, right?
Grtz Erwin
attached mail follows:
This is working great, thank you.
Timothy's expression output one empty element at the start and the end,
but otherwise worked ( and
I don't know why :-(
Erwin wrote:
>>>$string = explode( '', 'string' );
>>>
>>>
>
>Timothy Hitchens wrote:
>
>
>>That won't work.. empty delimiter errors always..
>>
>>
>
>Your right, I didn't know.
>
>
>
>>you will have to use
>>my preg one from earlier...
>>
>>
>
>But your preg thingy will only split at spaces, so that'll have to change to
>
><?
>$string = 'test';
>preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
>?>
>
>in this case, right?
>
>Grtz Erwin
>
>
>
>
attached mail follows:
Guys, not to confuse you, but I think there is a more elegant way doing
it that. I had the same issue once long ago (2-3 years ago?) and had put
it up on the mailing lists too.
Gotta remember what it was and for what project then find the code in my
libraries. I really think i accomplished it without preg_split()...
-- Maxim Maletsky maximphp.net
"
Edwin" <copperwalls
hotmail.com> wrote... :
> Hello, > > > "Maxim Maletsky" <maxim
php.net> wrote: > > > [snip] > > As of actually converting it you could do that very loop and have an: > > $atr_arr[] = $str[$i] in it, or, even more elegantly by using split() > > function or "...chunk.." something function(), don't remember right now. > [/snip] > > Perhaps, this would remind you... :) > > <?php > $str = 'string'; > $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); > print_r($chars); > ?> > > That was from the manual: > http://www.php.net/manual/en/function.preg-split.php > > - E > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Hello,
"Petre Agenbag" <internet
vsa.co.za> wrote:
> I'm just curious.
Me, too. :)
> Why do you want to echo within an echo? > echo '<form action="'.$PHP_SELF.'">'; > will do the trick won't it?
True.
> Unless I miss the point, I cannot see why you need to open new php tags > for this?
But, if there's a special reason...
> > >echo $PHP_SELF ?> !! But I can't figure out how to escape ?> so that the > > > interpreter doesn't take it as the end of the script ! Any idea ?
Well, we can use < instead of < and > instead of > , etc...
- E
...[snip]...
attached mail follows:
> subject's allready my question ! I want to echo something like : "<form > action = \",?php echo $PHP_SELF ?> \" >" so that the action becomes <? > echo $PHP_SELF ?> !! But I can't figure out how to escape ?> so that the > interpreter doesn't take it as the end of the script ! Any idea ?
Maybe I don't understand... but,
echo "<form action=\"<? echo \$PHP_SELF ?>\" >";
---John Holmes...
attached mail follows:
If you're trying to get a LITERAL ?> Use > for your > symbol so that you have
?>
I also noticed you didn't have a <? at the beginning of your string, so use <? for that.
Does this help?
John W. Holmes wrote:
> >subject's allready my question ! I want to echo something like : > > " > action = \",?php echo $PHP_SELF ?> \" >" so that the action becomes > echo $PHP_SELF ?> !! But I can't figure out how to escape ?> so that > > the > > > interpreter doesn't take it as the end of the script ! Any idea ? > > > Maybe I don't understand... but, > > echo "\" >"; > > ---John Holmes... > >
attached mail follows:
Very interesting! Thanks! I'm sure the list will be very useful. ;)
BTW, perhaps you can add apple.com to your list. (Apache, Linux--should be BSD...)
- E
attached mail follows:
I am unable to execute my c++ program from within PHP when it runs as a cgi in Apache. I am able to run:
$cmd="dir c:\abc" system ($cmd, $errCode);
and see the content of the directory, but I don't seem to be able to run a simple hello.exe (c++) file.
$cmd = "c:\abc\hello.exe"; system ($cmd, $errCode);
The errCode always comes back with 128. What does 128 mean? Here is some info on my setup. OS: Windows XP Server: Apache 2.0.43 (win32) PHP 4.2.3 I am running PHP as a CGI
I am able to execute my c++ program (hello.exe) from this .php file just fine if I use the PHP cli. I appreciate any help.
attached mail follows:
escape your backslashes:
$cmd = "c:\\abc\\hello.exe";
Ladan Pickering wrote:
>I am unable to execute my c++ program from within PHP when it runs as a >cgi in Apache. >I am able to run: > >$cmd="dir c:\abc" >system ($cmd, $errCode); > >and see the content of the directory, but I don't seem to >be able to run a simple hello.exe (c++) file. > >$cmd = "c:\abc\hello.exe"; >system ($cmd, $errCode); > >The errCode always comes back with 128. What does 128 mean? > >Here is some info on my setup. >OS: Windows XP >Server: Apache 2.0.43 (win32) >PHP 4.2.3 >I am running PHP as a CGI > >I am able to execute my c++ program (hello.exe) from this .php file >just fine if I use the PHP cli. > >I appreciate any help. > > > >
attached mail follows:
At 15:30 08.11.2002, Ladan Pickering spoke out and said: --------------------[snip]-------------------- >I am unable to execute my c++ program from within PHP when it runs as a >cgi in Apache. >I am able to run: > >$cmd="dir c:\abc" >system ($cmd, $errCode); > >and see the content of the directory, but I don't seem to >be able to run a simple hello.exe (c++) file. > >$cmd = "c:\abc\hello.exe"; >system ($cmd, $errCode); --------------------[snip]--------------------
I think you need to either escape the backslash (like c:\\abc\\hello.exe), or simply use forward slashes (as c:/abc/hello.exe).
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
My question is how do you know it's not running? If it really is a "hello world" application, where do you want the output to go? To the browser? That's pretty involved. Try making it write to a file and see if it contains any output after execution.
Mike
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote in message
news:5.1.1.6.2.20021108155320.03285f28
mail.vogelsinger.at...
> At 15:30 08.11.2002, Ladan Pickering spoke out and said:
> --------------------[snip]--------------------
> >I am unable to execute my c++ program from within PHP when it runs as a
> >cgi in Apache.
> >I am able to run:
> >
> >$cmd="dir c:\abc"
> >system ($cmd, $errCode);
> >
> >and see the content of the directory, but I don't seem to
> >be able to run a simple hello.exe (c++) file.
> >
> >$cmd = "c:\abc\hello.exe";
> >system ($cmd, $errCode);
> --------------------[snip]--------------------
>
> I think you need to either escape the backslash (like c:\\abc\\hello.exe),
> or simply use forward slashes (as c:/abc/hello.exe).
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
attached mail follows:
I have tried escaping with backslashes and also tried forward slashes with no luck. I believe my path specification is correct because I can look at different directories. $cmd = "dir c:\abc\efg"; system ($cmd, $errCode); Correctly display the content of "efg", and the errCode is 0;
I think the key to my problem is the return_var (errCode) of 128. (That is what I get in errCode when I try to execute hello.exe)
Do you know where the return_var(s) for php (exec, system, ...) are defined?
Is there something in php.ini that have to be set up inorder to be able to execute a file on the server?
I have looked at php.net but had no luck.
Thanks for your suggestions.
"Marek Kilimajer" <kilimajer
webglobe.sk> wrote in
message news:3DCBCF6B.9050000
webglobe.sk...
> escape your backslashes:
>
> $cmd = "c:\\abc\\hello.exe";
>
>
>
> Ladan Pickering wrote:
>
> >I am unable to execute my c++ program from within
PHP when it runs as a
> >cgi in Apache.
> >I am able to run:
> >
> >$cmd="dir c:\abc"
> >system ($cmd, $errCode);
> >
> >and see the content of the directory, but I don't
seem to
> >be able to run a simple hello.exe (c++) file.
> >
> >$cmd = "c:\abc\hello.exe";
> >system ($cmd, $errCode);
> >
> >The errCode always comes back with 128. What does
128 mean?
> >
> >Here is some info on my setup.
> >OS: Windows XP
> >Server: Apache 2.0.43 (win32)
> >PHP 4.2.3
> >I am running PHP as a CGI
> >
> >I am able to execute my c++ program (hello.exe)
from this .php file
> >just fine if I use the PHP cli.
> >
> >I appreciate any help.
> >
> >
> >
> >
>
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
I haven't been following this whole thread, but have you ruled out permissions problems? If you have NTFS, does whatever user PHP is running as have permission to run the program?
---John Holmes...
> -----Original Message-----
> From: Ladan Pickering [mailto:ladan_pickering
yahoo.com]
> Sent: Friday, November 08, 2002 3:11 PM
> To: php-general
lists.php.net
> Cc: kilimajer
webglobe.sk
> Subject: Re: [PHP] Unable to execute c++ .exe file from php
>
> I have tried escaping with backslashes and also tried
> forward slashes with no luck. I believe my path
> specification is correct because I can look at
> different directories.
> $cmd = "dir c:\abc\efg";
> system ($cmd, $errCode);
> Correctly display the content of "efg", and the
> errCode is 0;
>
> I think the key to my problem is the return_var
> (errCode) of 128. (That is what I get in errCode when
> I try to execute hello.exe)
>
> Do you know where the return_var(s) for php
> (exec, system, ...) are defined?
>
> Is there something in php.ini that have to be set up
> inorder to be able to execute a file on the server?
>
> I have looked at php.net but had no luck.
>
> Thanks for your suggestions.
>
> "Marek Kilimajer" <kilimajer
webglobe.sk> wrote in
> message news:3DCBCF6B.9050000
webglobe.sk...
> > escape your backslashes:
> >
> > $cmd = "c:\\abc\\hello.exe";
> >
> >
> >
> > Ladan Pickering wrote:
> >
> > >I am unable to execute my c++ program from within
> PHP when it runs as a
> > >cgi in Apache.
> > >I am able to run:
> > >
> > >$cmd="dir c:\abc"
> > >system ($cmd, $errCode);
> > >
> > >and see the content of the directory, but I don't
> seem to
> > >be able to run a simple hello.exe (c++) file.
> > >
> > >$cmd = "c:\abc\hello.exe";
> > >system ($cmd, $errCode);
> > >
> > >The errCode always comes back with 128. What does
> 128 mean?
> > >
> > >Here is some info on my setup.
> > >OS: Windows XP
> > >Server: Apache 2.0.43 (win32)
> > >PHP 4.2.3
> > >I am running PHP as a CGI
> > >
> > >I am able to execute my c++ program (hello.exe)
> from this .php file
> > >just fine if I use the PHP cli.
> > >
> > >I appreciate any help.
> > >
> > >
> > >
> > >
> >
>
> __________________________________________________
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive greatest hits videos
> http://launch.yahoo.com/u2
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Very good question Mike. In my hello.cc file, I have a cout to the stdout and I open a file and write a couple of lines to it. The reason I believe it is not running is that when the .php file is running from the cli, I see my "cout" and the file (test.txt) that I open is created and my lines are written to it. When I run the same .php file from within my browser, the cout is not displayed and the file (test.txt) is not created.
I am new to Windows, do you see something that I am not doing correctly?
Thanks
My question is how do you know it's not running? If it really is a "hello world" application, where do you want the output to go? To the browser? That's pretty involved. Try making it write to a file and see if it contains any output after execution.
Mike
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote
in message
news:5.1.1.6.2.20021108155320.03285f28
mail.vogelsinger.at...
> At 15:30 08.11.2002, Ladan Pickering spoke out and
said:
> --------------------[snip]--------------------
> >I am unable to execute my c++ program from within
PHP when it runs as a
> >cgi in Apache.
> >I am able to run:
> >
> >$cmd="dir c:\abc"
> >system ($cmd, $errCode);
> >
> >and see the content of the directory, but I don't
seem to
> >be able to run a simple hello.exe (c++) file.
> >
> >$cmd = "c:\abc\hello.exe";
> >system ($cmd, $errCode);
> --------------------[snip]--------------------
>
> I think you need to either escape the backslash
(like c:\\abc\\hello.exe),
> or simply use forward slashes (as c:/abc/hello.exe).
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
--------------------------------------------------------------------------------
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
When I look at the program (hello.exe) under cygwin. I see that the "x" bit is set for all. As far as I can tell anyone is permitted to execute this program.
Thanks for your suggestion.
--- "John W. Holmes" <holmes072000
charter.net> wrote:
> I haven't been following this whole thread, but have
> you ruled out
> permissions problems? If you have NTFS, does
> whatever user PHP is
> running as have permission to run the program?
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Ladan Pickering
> [mailto:ladan_pickering
yahoo.com]
> > Sent: Friday, November 08, 2002 3:11 PM
> > To: php-general
lists.php.net
> > Cc: kilimajer
webglobe.sk
> > Subject: Re: [PHP] Unable to execute c++ .exe file
> from php
> >
> > I have tried escaping with backslashes and also
> tried
> > forward slashes with no luck. I believe my path
> > specification is correct because I can look at
> > different directories.
> > $cmd = "dir c:\abc\efg";
> > system ($cmd, $errCode);
> > Correctly display the content of "efg", and the
> > errCode is 0;
> >
> > I think the key to my problem is the return_var
> > (errCode) of 128. (That is what I get in errCode
> when
> > I try to execute hello.exe)
> >
> > Do you know where the return_var(s) for php
> > (exec, system, ...) are defined?
> >
> > Is there something in php.ini that have to be set
> up
> > inorder to be able to execute a file on the
> server?
> >
> > I have looked at php.net but had no luck.
> >
> > Thanks for your suggestions.
> >
> > "Marek Kilimajer" <kilimajer
webglobe.sk> wrote in
> > message news:3DCBCF6B.9050000
webglobe.sk...
> > > escape your backslashes:
> > >
> > > $cmd = "c:\\abc\\hello.exe";
> > >
> > >
> > >
> > > Ladan Pickering wrote:
> > >
> > > >I am unable to execute my c++ program from
> within
> > PHP when it runs as a
> > > >cgi in Apache.
> > > >I am able to run:
> > > >
> > > >$cmd="dir c:\abc"
> > > >system ($cmd, $errCode);
> > > >
> > > >and see the content of the directory, but I
> don't
> > seem to
> > > >be able to run a simple hello.exe (c++) file.
> > > >
> > > >$cmd = "c:\abc\hello.exe";
> > > >system ($cmd, $errCode);
> > > >
> > > >The errCode always comes back with 128. What
> does
> > 128 mean?
> > > >
> > > >Here is some info on my setup.
> > > >OS: Windows XP
> > > >Server: Apache 2.0.43 (win32)
> > > >PHP 4.2.3
> > > >I am running PHP as a CGI
> > > >
> > > >I am able to execute my c++ program (hello.exe)
> > from this .php file
> > > >just fine if I use the PHP cli.
> > > >
> > > >I appreciate any help.
> > > >
> > > >
> > > >
> > > >
> > >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > U2 on LAUNCH - Exclusive greatest hits videos
> > http://launch.yahoo.com/u2
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>
>
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
I see. Well, it isn't executing, then. It doesn't surprise me that the output doesn't go to the browser, but not showing up in the file seals the deal. Sorry I can't be of more help.
Mike
----- Original Message -----
From: "Ladan Pickering" <ladan_pickering
yahoo.com>
To: <php-general
lists.php.net>
Cc: <mike
basementideas.com>
Sent: Friday, November 08, 2002 3:28 PM
Subject: Re: [PHP] Unable to execute c++ .exe file from php
> Very good question Mike.
> In my hello.cc file, I have a cout to the stdout and
> I open a file and write a couple of lines to it. The
> reason I believe it is not running is that when
> the .php file is running from the cli, I see my
> "cout" and the file (test.txt) that I open is created
> and my lines are written to it. When I run the same
> .php file from within my browser, the cout is not
> displayed and the file (test.txt) is not created.
>
> I am new to Windows, do you see something that I am
> not doing correctly?
>
> Thanks
>
> My question is how do you know it's not running? If
> it really is a "hello
> world" application, where do you want the output to
> go? To the browser?
> That's pretty involved. Try making it write to a file
> and see if it
> contains any output after execution.
>
> Mike
>
>
>
> "Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote
> in message
> news:5.1.1.6.2.20021108155320.03285f28
mail.vogelsinger.at...
> > At 15:30 08.11.2002, Ladan Pickering spoke out and
> said:
> > --------------------[snip]--------------------
> > >I am unable to execute my c++ program from within
> PHP when it runs as a
> > >cgi in Apache.
> > >I am able to run:
> > >
> > >$cmd="dir c:\abc"
> > >system ($cmd, $errCode);
> > >
> > >and see the content of the directory, but I don't
> seem to
> > >be able to run a simple hello.exe (c++) file.
> > >
> > >$cmd = "c:\abc\hello.exe";
> > >system ($cmd, $errCode);
> > --------------------[snip]--------------------
> >
> > I think you need to either escape the backslash
> (like c:\\abc\\hello.exe),
> > or simply use forward slashes (as c:/abc/hello.exe).
> >
> >
> > --
> > >O Ernest E. Vogelsinger
> > (\) ICQ #13394035
> > ^ http://www.vogelsinger.at/
> >
>
>
>
> --------------------------------------------------------------------------
------
>
>
>
> __________________________________________________
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive greatest hits videos
> http://launch.yahoo.com/u2
>
attached mail follows:
At 00:00 09.11.2002, Ladan Pickering said: --------------------[snip]-------------------- >When I look at the program (hello.exe) under cygwin. >I see that the "x" bit is set for all. As far as I can >tell anyone is permitted to execute this program. --------------------[snip]--------------------
Make your command like this
c:/abc/hello.exe 2>&1
to see if some error is given... might be a problem with environment space?
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
I've tried doing a search for this problem on the web, but haven't found anything, nor have I found any solution on the php.net documentation.
Does anyone know if it's possible to do a file search with a wildcard character? I need to find if there are any HTML files in a certain directory, but file_exists("htmls/*.html") doesn't seem to work when tested. Neither do similar applications of readdir(). Is there another way to do this, or do I have to do a readdir() and read the filename of every file until I find an HTML or until all files have been read.
--------------------------------- Do you Yahoo!? U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD
attached mail follows:
How about:
$a = explode (' ', shell_exec ("ls $foldername/*.html"));
This should return an array that contains the name of all the *.html files in the folder $foldername, if any.
Hope this helps.
Cheers,
Marco
------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com!
On Fri, 2002-11-08 at 09:34, Mako Shark wrote: > > I've tried doing a search for this problem on the web, but haven't found anything, nor have I found any solution on the php.net documentation. > > > > Does anyone know if it's possible to do a file search with a wildcard character? I need to find if there are any HTML files in a certain directory, but file_exists("htmls/*.html") doesn't seem to work when tested. Neither do similar applications of readdir(). Is there another way to do this, or do I have to do a readdir() and read the filename of every file until I find an HTML or until all files have been read. > > > > --------------------------------- > Do you Yahoo!? > U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD
attached mail follows:
> -----Original Message-----
> From: Mako Shark [mailto:phpman2000
yahoo.com]
> do I have to do a
> readdir() and read the filename of every file until I find an
> HTML or until all files have been read.
This is what the shell expression supplied by Marco Tabini actually does; doing it in PHP (readdir(), etc.) eliminates the exec of the shell process and is faster (readdir() is a thin veneer on the readdir system call) and the problem of portability if you want to use this on both Unix and Windows.
attached mail follows:
<<$a = explode (' ', shell_exec ("ls $foldername/*.html"));>>
Didn't know of shell_exec() until now. It works, though. Thanks!
Is there any reason why it wouldn't work? If I changed servers, say, and there were some ports blocked and etc. etc., is there a risk that I should know?
--------------------------------- Do you Yahoo!? U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD
attached mail follows:
Well, as a general rule, it won't work if you're not using a UNIX o/s or if PHP has been set up with safe mode on, or if you don't have the right permission to see that folder. That's probably a non-inclusive list, but there should be ways around each of these problems (depending on the degree of control you have over the server).
Marco
------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com!
On Fri, 2002-11-08 at 11:14, Mako Shark wrote: > > <<$a = explode (' ', shell_exec ("ls $foldername/*.html"));>> > > > > Didn't know of shell_exec() until now. It works, though. Thanks! > > Is there any reason why it wouldn't work? If I changed servers, say, and there were some ports blocked and etc. etc., is there a risk that I should know? > > > > > > --------------------------------- > Do you Yahoo!? > U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD
attached mail follows:
Mako Shark wrote...
> Didn't know of shell_exec() until now. It works, though. Thanks! > > Is there any reason why it wouldn't work? If I changed servers, say, and there > were some ports blocked and etc. etc., is there a risk that I should know?
My understanding is that many security-conscious providers don't allow shell_exec(). Mine doesn't.
-- Charles Wiltgen
attached mail follows:
<<Well, as a general rule, it won't work if you're not using a UNIX o/s orif PHP has been set up with safe mode on, or if you don't have the rightpermission to see that folder. That's probably a non-inclusive list, butthere should be ways around each of these problems (depending on thedegree of control you have over the server).>>
These are fine. I'm not going to use Windows for a server. Won't the same problem in relation to directory permissions stop me even if I just did a simple readdir()? The only one I'm too worried about is the safe mode thing. It works for now, though. The next server I'm moving to will hopefully be my own, so I'll have complete control. And, if not, all of my shell_execs() are in a function, so I only have to change it in one place.
But is it less troublesome to use a popen instead of shell_exec? What are the differences, aside from that popen remains open past one command? I'm using both here and there in my site, and am wondering if one is better than the other if all my shell commands are single-line commands.
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
<<Well, as a general rule, it won't work if you're not using a UNIX o/s orif PHP has been set up with safe mode on, or if you don't have the rightpermission to see that folder. That's probably a non-inclusive list, butthere should be ways around each of these problems (depending on thedegree of control you have over the server).>>
These are fine. I'm not going to use Windows for a server. Won't the same problem in relation to directory permissions stop me even if I just did a simple readdir()? The only one I'm too worried about is the safe mode thing. It works for now, though. The next server I'm moving to will hopefully be my own, so I'll have complete control. And, if not, all of my shell_execs() are in a function, so I only have to change it in one place.
But is it less troublesome to use a popen instead of shell_exec? What are the differences, aside from that popen remains open past one command? I'm using both here and there in my site, and am wondering if one is better than the other if all my shell commands are single-line commands.
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
If you're only executing one-liners and get all the results back you're better off using shell_exec(). popen() lets you open a pipe to a command--that way, you can funnel data to it as if you were typing from the keyboard.
Permissions would be a problem with readdir() as well.
Marco
-- ------------ php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmerCome visit us at http://www.phparch.com!
attached mail follows:
<<Well, as a general rule, it won't work if you're not using a UNIX o/s orif PHP has been set up with safe mode on, or if you don't have the rightpermission to see that folder. That's probably a non-inclusive list, butthere should be ways around each of these problems (depending on thedegree of control you have over the server).>>
These are fine. I'm not going to use Windows for a server. Won't the same problem in relation to directory permissions stop me even if I just did a simple readdir()? The only one I'm too worried about is the safe mode thing. It works for now, though. The next server I'm moving to will hopefully be my own, so I'll have complete control. And, if not, all of my shell_execs() are in a function, so I only have to change it in one place.
But is it less troublesome to use a popen instead of shell_exec? What are the differences, aside from that popen remains open past one command? I'm using both here and there in my site, and am wondering if one is better than the other if all my shell commands are single-line commands.
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
<<Well, as a general rule, it won't work if you're not using a UNIX o/s orif PHP has been set up with safe mode on, or if you don't have the rightpermission to see that folder. That's probably a non-inclusive list, butthere should be ways around each of these problems (depending on thedegree of control you have over the server).>>
These are fine. I'm not going to use Windows for a server. Won't the same problem in relation to directory permissions stop me even if I just did a simple readdir()? The only one I'm too worried about is the safe mode thing. It works for now, though. The next server I'm moving to will hopefully be my own, so I'll have complete control. And, if not, all of my shell_execs() are in a function, so I only have to change it in one place.
But is it less troublesome to use a popen instead of shell_exec? What are the differences, aside from that popen remains open past one command? I'm using both here and there in my site, and am wondering if one is better than the other if all my shell commands are single-line commands.
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--=-+TTZsvRyjwFQ7ask772T--
attached mail follows:
> If you're only executing one-liners and get all the > results back you're > better off using shell_exec(). popen() lets you open > a pipe to a > command--that way, you can funnel data to it as if > you were typing from the keyboard.
That's what I'll do then: use shell_exec().
> Permissions would be a problem with readdir() as > well.
So this really shouldn't be a deciding factor then.
Anyway, I've got it working out. I have it returning an array of filenames if successful. If it's a successful call, but no files exists (for instance *.html with no HTML files), then it returns 0. If it can't read the directory or the dir doesn't exist, it returns NULL.
Just to make sure, I can do this: if($files = GetFileListing("htmls\*.html")) { . . . }
and it will skip it if there either are no HTML files, oe htmls doesn't exist, right? If I get a 0 or a NULL return? (I figure, if I need to distinguish between these two, I can always do a $==0 or $==NULL comparison).
__________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2
attached mail follows:
I get no output at all.
All DoCache does is write $buffer to a file then return $buffer since I use this for some other serverside caching to save on database hits.
I have other areas that I call ob_start("ob_gzhandler") and that works fine but when I call in via DoCache it breaks.
I much prefer your idea of mod_deflate. I will look into that since I believe that belongs in apache rather than a PHP program also.
I am still curious why it doesn't work though.
Here is my "True" DoCache function:
function docache ($buffer) { $fp=fopen(cachefilename(), "w"); if($fp) fputs($fp,$buffer);
return ob_gzhandler($buffer); }
cachefilename() simply returns an MD5 of the requested URI.
This will return a blank webpage in IE and Mozilla. When I take out ob_gzhandler it then works fine.
Thanks, Serge.
----- Original Message -----
From: "Ernest E Vogelsinger" <ernest
vogelsinger.at>
To: <php-general
lists.php.net>
Sent: Friday, November 08, 2002 4:00 AM
Subject: Re: [PHP] ob_gzhandler
> At 07:45 08.11.2002, Serge Paquin said: > --------------------[snip]-------------------- > >Hello, > > > > Is their anyway to use ob_gzhandler along with another callback? I've > >tried the following which does not work: > > > >function DoCache($buffer) { > > /* Do a bunch of stuff */ > > return ob_gzhandler($buffer); > >} > > > >ob_start("DoCache"); > > What do you mean by "does not work"? Does it output "nothing", or can't you > see any compressed data? > > 1) output is empty > Must be an error in your DoCache() function - check the buffer you're > passing to ob_gzhandler() by writing it to a file (you can't echo it here...) > > 2) you don't see compressed output > 2.a) That's how it is designed. ob_gzhandler checks the request headers to > see if the browser supports any of the compressed formats (gzip, deflate), > and if it doesn't find it then it simply does nothing. > 2.b) PHP needs to be compiled using --with-zlib to provide ob_gzhandler > support. You don't get any error if you don't have zlib configured. Check > phpinfo() to see if zlib support is available. > > > Personal hint: > If you're using the url_rewriter.tags and have session cookies disabled, > ob_gzhandler will break this. The reason is that PHP parses the > _very_final_ output to mangle the session identifier to any (local) url; in > case this _very_final_ output is compressed ir can't find any link and > can't merge the session identifier. > > I personally believe it's better to have compression be done at the web > server (refer to http://httpd.apache.org/docs-2.0/mod/mod_deflate.html). > It's more general then, after all... > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
I just realized that "mod_deflate" is for Apache 2. I am still on the Apache 1.3 tree so I don't beleive I can take advantage.
----- Original Message -----
From: "Ernest E Vogelsinger" <ernest
vogelsinger.at>
To: <php-general
lists.php.net>
Sent: Friday, November 08, 2002 4:00 AM
Subject: Re: [PHP] ob_gzhandler
> At 07:45 08.11.2002, Serge Paquin said: > --------------------[snip]-------------------- > >Hello, > > > > Is their anyway to use ob_gzhandler along with another callback? I've > >tried the following which does not work: > > > >function DoCache($buffer) { > > /* Do a bunch of stuff */ > > return ob_gzhandler($buffer); > >} > > > >ob_start("DoCache"); > > What do you mean by "does not work"? Does it output "nothing", or can't you > see any compressed data? > > 1) output is empty > Must be an error in your DoCache() function - check the buffer you're > passing to ob_gzhandler() by writing it to a file (you can't echo it here...) > > 2) you don't see compressed output > 2.a) That's how it is designed. ob_gzhandler checks the request headers to > see if the browser supports any of the compressed formats (gzip, deflate), > and if it doesn't find it then it simply does nothing. > 2.b) PHP needs to be compiled using --with-zlib to provide ob_gzhandler > support. You don't get any error if you don't have zlib configured. Check > phpinfo() to see if zlib support is available. > > > Personal hint: > If you're using the url_rewriter.tags and have session cookies disabled, > ob_gzhandler will break this. The reason is that PHP parses the > _very_final_ output to mangle the session identifier to any (local) url; in > case this _very_final_ output is compressed ir can't find any link and > can't merge the session identifier. > > I personally believe it's better to have compression be done at the web > server (refer to http://httpd.apache.org/docs-2.0/mod/mod_deflate.html). > It's more general then, after all... > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
At 15:48 08.11.2002, Serge Paquin spoke out and said: --------------------[snip]-------------------- >I get no output at all. > >All DoCache does is write $buffer to a file then return $buffer since I use >this for some other serverside caching to save on database hits. > >I have other areas that I call ob_start("ob_gzhandler") and that works fine >but when I call in via DoCache it breaks. > >I much prefer your idea of mod_deflate. I will look into that since I >believe that belongs in apache rather than a PHP program also. > >I am still curious why it doesn't work though. > >Here is my "True" DoCache function: > >function docache ($buffer) { > $fp=fopen(cachefilename(), "w"); > if($fp) > fputs($fp,$buffer); > > return ob_gzhandler($buffer); >} > >cachefilename() simply returns an MD5 of the requested URI. > >This will return a blank webpage in IE and Mozilla. When I take out >ob_gzhandler it then works fine. --------------------[snip]--------------------
It seems to me your ob_gzhandler is broken... anyway, since PHP 4.0.3 the output callback function has a second parameter called "mode", even if you don't do anythiong with it you should pass it on:
function docache ($buffer, $mode) { $fp=fopen(cachefilename(), "w"); if($fp) fputs($fp,$buffer);
return ob_gzhandler($buffer, $mode); }
But I doubt this would change anything here... ob_gzhandler _should_ return some value. You have some output in the file do you?
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Yes their is always output.
Also the way my system works if it finds a current cache file then it just does "readfile" and no database connection.
On that output I use ob_start("ob_gzhandler") and it outputs compressed without an error so it seems that ob_gzhandler is working fine that's the part that gets me.
Serge.
On Fri, 08 Nov 2002 15:58:12 +0100
Ernest E Vogelsinger <ernest
vogelsinger.at> wrote:
> At 15:48 08.11.2002, Serge Paquin spoke out and said: > --------------------[snip]-------------------- > >I get no output at all. > > > >All DoCache does is write $buffer to a file then return $buffer since I use > >this for some other serverside caching to save on database hits. > > > >I have other areas that I call ob_start("ob_gzhandler") and that works fine > >but when I call in via DoCache it breaks. > > > >I much prefer your idea of mod_deflate. I will look into that since I > >believe that belongs in apache rather than a PHP program also. > > > >I am still curious why it doesn't work though. > > > >Here is my "True" DoCache function: > > > >function docache ($buffer) { > > $fp=fopen(cachefilename(), "w"); > > if($fp) > > fputs($fp,$buffer); > > > > return ob_gzhandler($buffer); > >} > > > >cachefilename() simply returns an MD5 of the requested URI. > > > >This will return a blank webpage in IE and Mozilla. When I take out > >ob_gzhandler it then works fine. > --------------------[snip]-------------------- > > It seems to me your ob_gzhandler is broken... anyway, since PHP 4.0.3 the > output callback function has a second parameter called "mode", even if you > don't do anythiong with it you should pass it on: > > function docache ($buffer, $mode) { > $fp=fopen(cachefilename(), "w"); > if($fp) > fputs($fp,$buffer); > > return ob_gzhandler($buffer, $mode); > } > > But I doubt this would change anything here... ob_gzhandler _should_ return > some value. You have some output in the file do you? > > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ >
attached mail follows:
At 16:08 08.11.2002, Serge Paquin spoke out and said: --------------------[snip]-------------------- >Yes their is always output. > >Also the way my system works if it finds a current cache file then it just >does "readfile" and no database connection. > >On that output I use ob_start("ob_gzhandler") and it outputs compressed >without an error so it seems that ob_gzhandler is working fine that's the >part that gets me. --------------------[snip]--------------------
Hmm - one glitch comes to my mind - maybe you need to close the buffer file before passing the buffer to ob_gzhandler?
function docache ($buffer, $mode) { $fp=fopen(cachefilename(), "w"); if($fp) { fputs($fp,$buffer); fclose($fp); } return ob_gzhandler($buffer, $mode); }
But I believe the problem must be somewhere in the outer logic - the callback you showed doesn't do any discrimination if it has a cache file or not. Check here, I'd suggest...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
This is not the same question i asked yesterday.
When i set error_reporting = E_ALL and display_errors = On in my php.ini, i get the next message:
"Notice: Undefined variable: varname in ....".
How can i fix this problem without setting error_reporting = E_ALL & ~E_NOTICE and/or display_errors = Off, or what way do you think is the best to resolve this problem?
Thanks,
RB
_________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.microsoft.com/es
attached mail follows:
This usually means that you're using a variable without having initialized it. For example
$a = $b + 1;
will give you that warning if no value is assigned to $b prior to this line. It's PHP's way of telling you that you might be doing something wrong.
Perhaps if you post some of your code we can help better?
Marco
------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com!
On Fri, 2002-11-08 at 10:31, R B wrote: > This is not the same question i asked yesterday. > > When i set error_reporting = E_ALL and display_errors = On in my php.ini, > i get the next message: > > "Notice: Undefined variable: varname in ....". > > How can i fix this problem without setting error_reporting = E_ALL & > ~E_NOTICE and/or display_errors = Off, or what way do you think is the best > to resolve this problem? > > Thanks, > > RB > > > > _________________________________________________________________ > Charla con tus amigos en línea mediante MSN Messenger: > http://messenger.microsoft.com/es > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
At 16:31 08.11.2002, R B spoke out and said: --------------------[snip]-------------------- >This is not the same question i asked yesterday. > >When i set error_reporting = E_ALL and display_errors = On in my php.ini, >i get the next message: > >"Notice: Undefined variable: varname in ....". > >How can i fix this problem without setting error_reporting = E_ALL & >~E_NOTICE and/or display_errors = Off, or what way do you think is the best >to resolve this problem? --------------------[snip]--------------------
But it's the same answer ;-) If you want to be completely warning-and-notice-free, you need to define the variable before accessing it:
// this will give a notice echo $undefined_var;
// and this won't $define_var = 'some data, or simply put "null" here'; echo $defined_var;
The same holds true for array indices:
$test_array = array('One', 'Two', 'Three');
// this will give a notice echo $test_array[3];
// and this won't echo $test_array[2];
// and this won't as well if (array_key_exists(3)) echo $test_array[3];
Get the idea? IMHO it's complete overkill with PHP to predefine variables since they're auto-initialized with NULL when used first. These notices are only for the development cycle, to aid us in spotting a problem where you expect some data to be there, but it aint because the variable name has been mistyped...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
My code is:
<?php some code..... .... ....
if ($status == "ADD") {
some code ... ... ... } ?> The message is: "Notice: Undefined variable: status in ...."
I'm going to explain how my script work. I have an php page (addProduct.php) with an input form. I have 2 buttons (add and cancel) and a hidden control with name=status. If i press the add button, the page submit the form data to the same page (<form action="addProduct.php">) with status hidden control name set to ADD, so the if statement its true only if i press the add button. I see the message when i call the page to add the data not when i submit the data.
How can i fix the problem? or there is another best way to do this?
>From: Marco Tabini <marcot
tabini.ca>
>To: R B <rbphp
hotmail.com>
>CC: php-general
lists.php.net
>Subject: Re: [PHP] Other Notice problem...
>Date: 08 Nov 2002 10:25:46 -0500
>
>This usually means that you're using a variable without having
>initialized it. For example
>
>$a = $b + 1;
>
>will give you that warning if no value is assigned to $b prior to this
>line. It's PHP's way of telling you that you might be doing something
>wrong.
>
>Perhaps if you post some of your code we can help better?
>
>
>Marco
>
>-------------
>php|architect -- The Monthly Magazine For PHP Professionals
>Come visit us on the web at http://www.phparch.com!
>
>On Fri, 2002-11-08 at 10:31, R B wrote:
> > This is not the same question i asked yesterday.
> >
> > When i set error_reporting = E_ALL and display_errors = On in my
>php.ini,
> > i get the next message:
> >
> > "Notice: Undefined variable: varname in ....".
> >
> > How can i fix this problem without setting error_reporting = E_ALL &
> > ~E_NOTICE and/or display_errors = Off, or what way do you think is the
>best
> > to resolve this problem?
> >
> > Thanks,
> >
> > RB
> >
> >
> >
> > _________________________________________________________________
> > Charla con tus amigos en línea mediante MSN Messenger:
> > http://messenger.microsoft.com/es
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
_________________________________________________________________ MSN. Más Útil Cada Día http://www.msn.es/intmap/
attached mail follows:
Try
if (isset ($status) && $status == 'ADD')
instead... this should take care of the error--IF you're sure that the fact that the $status variable is not set at that point is ok.
Marco
------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com!
On Fri, 2002-11-08 at 11:04, R B wrote:
> My code is:
>
> <?php
> some code.....
> ....
> ....
>
> if ($status == "ADD") {
>
> some code ...
> ...
> ...
> }
> ?>
> The message is: "Notice: Undefined variable: status in ...."
>
> I'm going to explain how my script work.
> I have an php page (addProduct.php) with an input form. I have 2 buttons
> (add and cancel) and a hidden control with name=status. If i press the add
> button, the page submit the form data to the same page (<form
> action="addProduct.php">) with status hidden control name set to ADD, so the
> if statement its true only if i press the add button.
> I see the message when i call the page to add the data not when i submit the
> data.
>
> How can i fix the problem? or there is another best way to do this?
>
>
>
> >From: Marco Tabini <marcot
tabini.ca>
> >To: R B <rbphp
hotmail.com>
> >CC: php-general
lists.php.net
> >Subject: Re: [PHP] Other Notice problem...
> >Date: 08 Nov 2002 10:25:46 -0500
> >
> >This usually means that you're using a variable without having
> >initialized it. For example
> >
> >$a = $b + 1;
> >
> >will give you that warning if no value is assigned to $b prior to this
> >line. It's PHP's way of telling you that you might be doing something
> >wrong.
> >
> >Perhaps if you post some of your code we can help better?
> >
> >
> >Marco
> >
> >-------------
> >php|architect -- The Monthly Magazine For PHP Professionals
> >Come visit us on the web at http://www.phparch.com!
> >
> >On Fri, 2002-11-08 at 10:31, R B wrote:
> > > This is not the same question i asked yesterday.
> > >
> > > When i set error_reporting = E_ALL and display_errors = On in my
> >php.ini,
> > > i get the next message:
> > >
> > > "Notice: Undefined variable: varname in ....".
> > >
> > > How can i fix this problem without setting error_reporting = E_ALL &
> > > ~E_NOTICE and/or display_errors = Off, or what way do you think is the
> >best
> > > to resolve this problem?
> > >
> > > Thanks,
> > >
> > > RB
> > >
> > >
> > >
> > > _________________________________________________________________
> > > Charla con tus amigos en línea mediante MSN Messenger:
> > > http://messenger.microsoft.com/es
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
>
>
> _________________________________________________________________
> MSN. Más Útil Cada Día http://www.msn.es/intmap/
>
attached mail follows:
At 17:04 08.11.2002, R B spoke out and said: --------------------[snip]-------------------- >I'm going to explain how my script work. >I have an php page (addProduct.php) with an input form. I have 2 buttons >(add and cancel) and a hidden control with name=status. If i press the add >button, the page submit the form data to the same page (<form >action="addProduct.php">) with status hidden control name set to ADD, so the >if statement its true only if i press the add button. >I see the message when i call the page to add the data not when i submit the >data. --------------------[snip]--------------------
Ahhh.... your $status variable should be a form variable? Well, as pointed out many times the last days, register_globals is OFF by default since PHP v.4.something. Either turn register_globals on in your PHP.ini (bad and deprecated, read the security bulletins), or you refer to the _POST array:
if ($_POST['status'] == "ADD")
if the data is not set (the status control empty), you'll still get a notice about an undefined array index, so you might
if (array_key_exists('status', $_POST)) { switch ($_POST['status']) { case 'ADD': break; default: echo 'Unsupported status!'; } } else echo 'No status sent!';
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
The array_key_exists or isset is a good solution. About your comment, i have the register_globals=on. I have 2 questions:
1.- What's the relation to have register_globals=off with this notice message?
2.- I read the security comment about register_globals=on in the php.ini, but i set to on because if i set to off, i can't pass GET variables to other page. how can you pass GET variables to other page without setting register_globals=on?
>From: Ernest E Vogelsinger <ernest
vogelsinger.at>
>To: "R B" <rbphp
hotmail.com>
>CC: marcot
tabini.ca,php-general
lists.php.net
>Subject: Re: [PHP] Other Notice problem...
>Date: Fri, 08 Nov 2002 17:14:30 +0100
>
>At 17:04 08.11.2002, R B spoke out and said:
>--------------------[snip]--------------------
> >I'm going to explain how my script work.
> >I have an php page (addProduct.php) with an input form. I have 2 buttons
> >(add and cancel) and a hidden control with name=status. If i press the
>add
> >button, the page submit the form data to the same page (<form
> >action="addProduct.php">) with status hidden control name set to ADD, so
>the
> >if statement its true only if i press the add button.
> >I see the message when i call the page to add the data not when i submit
>the
> >data.
>--------------------[snip]--------------------
>
>Ahhh.... your $status variable should be a form variable? Well, as pointed
>out many times the last days, register_globals is OFF by default since PHP
>v.4.something. Either turn register_globals on in your PHP.ini (bad and
>deprecated, read the security bulletins), or you refer to the _POST array:
>
> if ($_POST['status'] == "ADD")
>
>if the data is not set (the status control empty), you'll still get a
>notice about an undefined array index, so you might
>
> if (array_key_exists('status', $_POST)) {
> switch ($_POST['status']) {
> case 'ADD':
> break;
> default:
> echo 'Unsupported status!';
> }
> }
> else echo 'No status sent!';
>
>
>
>--
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
_________________________________________________________________ MSN. Más Útil Cada Día http://www.msn.es/intmap/
attached mail follows:
At 17:27 08.11.2002, R B spoke out and said: --------------------[snip]-------------------- >The array_key_exists or isset is a good solution. >About your comment, i have the register_globals=on. >I have 2 questions: > >1.- What's the relation to have register_globals=off with this notice >message?
If register_globals is OFF, $status will simply not be set by PHP. You can always access it as $_POST['status'] or $_REQUEST['status'].
>2.- I read the security comment about register_globals=on in the php.ini, >but i set to on because if i set to off, i can't pass GET variables to other >page. how can you pass GET variables to other page without setting >register_globals=on?
What do you mean by "pass it on to other page"? I'm afraid I don't get you. What are you trying to accomplish?
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
About your comment 1:
if i have register_globals=on, why $status is not be set by PHP?
About your comment 2:
if i have 2 pages: p01.php and p02.php, with p01.php code: ... ... <a href="p02.php?pp=2">link</a> ... ...
and p02.php code: ... ... echo "$pp"; ... ...
If i have register_globals=off, then when i click the link, in p02.php page, the echo command display nothing. If i have register_globals=on, then the echo command displays the value buy this way is deprecated. How can i run the script without problems having register_globals=off?
Thanks,
RB
>From: Ernest E Vogelsinger <ernest
vogelsinger.at>
>To: "R B" <rbphp
hotmail.com>
>CC: marcot
tabini.ca,php-general
lists.php.net
>Subject: Re: [PHP] Other Notice problem...
>Date: Fri, 08 Nov 2002 17:31:25 +0100
>
>At 17:27 08.11.2002, R B spoke out and said:
>--------------------[snip]--------------------
> >The array_key_exists or isset is a good solution.
> >About your comment, i have the register_globals=on.
> >I have 2 questions:
> >
> >1.- What's the relation to have register_globals=off with this notice
> >message?
>
>If register_globals is OFF, $status will simply not be set by PHP. You can
>always access it as $_POST['status'] or $_REQUEST['status'].
>
> >2.- I read the security comment about register_globals=on in the php.ini,
> >but i set to on because if i set to off, i can't pass GET variables to
>other
> >page. how can you pass GET variables to other page without setting
> >register_globals=on?
>
>What do you mean by "pass it on to other page"? I'm afraid I don't get you.
>What are you trying to accomplish?
>
>
>--
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
_________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.microsoft.com/es
attached mail follows:
On Friday, Nov 8, 2002, at 16:44 Europe/London, R B wrote: > if i have 2 pages: p01.php and p02.php, > with p01.php code: > ... > ... > <a href="p02.php?pp=2">link</a> > ... > ... > > and p02.php code: > ... > ... > echo "$pp"; > ... > ... > > If i have register_globals=off, then when i click the link, in p02.php > page, the echo command display nothing. > If i have register_globals=on, then the echo command displays the > value buy this way is deprecated. > How can i run the script without problems having register_globals=off?
p02.php code: ... ... echo $_GET['pp']; ... ...
-- Stuart
attached mail follows:
And without using the $_GET[] array.....
>From: Stuart <lists
sharedserver.net>
>To: "R B" <rbphp
hotmail.com>
>CC: ernest
vogelsinger.at, marcot
tabini.ca, php-general
lists.php.net
>Subject: Re: [PHP] Other Notice problem...
>Date: Fri, 8 Nov 2002 16:52:50 +0000
>
>On Friday, Nov 8, 2002, at 16:44 Europe/London, R B wrote:
>>if i have 2 pages: p01.php and p02.php,
>>with p01.php code:
>>...
>>...
>><a href="p02.php?pp=2">link</a>
>>...
>>...
>>
>>and p02.php code:
>>...
>>...
>>echo "$pp";
>>...
>>...
>>
>>If i have register_globals=off, then when i click the link, in p02.php
>>page, the echo command display nothing.
>>If i have register_globals=on, then the echo command displays the value
>>buy this way is deprecated.
>>How can i run the script without problems having register_globals=off?
>
>p02.php code:
>...
>...
>echo $_GET['pp'];
>...
>...
>
>--
>Stuart
_________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.microsoft.com/es
attached mail follows:
On Friday, Nov 8, 2002, at 16:56 Europe/London, R B wrote: > And without using the $_GET[] array.....
Why don't you want to use the $_GET array? If you really don't want to use it you can use the extract function but if you're going to do that you might as well have register_globals on.
-- Stuart>> p02.php code: >> ... >> ... >> echo $_GET['pp']; >> ... >> ... >> >> -- >> Stuart
attached mail follows:
At 17:44 08.11.2002, R B spoke out and said: --------------------[snip]-------------------- >About your comment 1: > >if i have register_globals=on, why $status is not be set by PHP?
well _then_ we have 2 possibilities: 1) your form input field isn't named "status" but rather "Status" or "STATUS" - take care of the case here, PHP is case sensitive with variables and associative indices. 2) Your form simply submits _nothing_ in this field - check your JavaScript (perhaps it is disabled?)
>About your comment 2: > >if i have 2 pages: p01.php and p02.php, >with p01.php code: >... ><a href="p02.php?pp=2">link</a> >... > >and p02.php code: >... >echo "$pp"; > >If i have register_globals=off, then when i click the link, in p02.php page, >the echo command display nothing. >If i have register_globals=on, then the echo command displays the value buy >this way is deprecated. >How can i run the script without problems having register_globals=off?
<?php $parms = null; foreach ($_GET as $p=>$v) { if ($parms) $parms .= '&'; $parms .= "$p=".urlencode($v); } ?> ... <a href="p02.php?<?php=$parms?>">
This will do what you want (untested, but should work)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
On Saturday 09 November 2002 00:52, Stuart wrote: > > How can i run the script without problems having register_globals=off? > > p02.php code: > ... > ... > echo $_GET['pp']; > ... > ...
Yes. And try reading the manual, or the archives.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* While money can't buy happiness, it certainly lets you choose your own form of misery. */
attached mail follows:
On Saturday 09 November 2002 00:56, R B wrote: > And without using the $_GET[] array.....
Probably by using black magic instead -- or maybe use $_REQUEST, but I don't think you want to use that either :)
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Auribus teneo lupum. [I hold a wolf by the ears.] [Boy, it *sounds* good. But what does it *mean*?] */
attached mail follows:
Well, it's possible he's using an older version of PHP in which superglobals did not yet exist.
Marco
------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com!
On Fri, 2002-11-08 at 12:09, Jason Wong wrote: > On Saturday 09 November 2002 00:56, R B wrote: > > And without using the $_GET[] array..... > > Probably by using black magic instead -- or maybe use $_REQUEST, but I don't > think you want to use that either :) > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Auribus teneo lupum. > [I hold a wolf by the ears.] > [Boy, it *sounds* good. But what does it *mean*?] > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
On Saturday 09 November 2002 01:02, Marco Tabini wrote: > Well, it's possible he's using an older version of PHP in which > superglobals did not yet exist.
It looks to me as if he just wants to use plain $variable but with register_globals disabled that's just not possible.
Unless you go through that extract($_POST) ritual, all of which is covered in the manual and archives.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* The biggest problem with communication is the illusion that it has occurred. */
attached mail follows:
It's ok. I understand that i can't use plain variables with register_globals=on, but this is only for GET variables or to all variables?
Thanks,
RB
>From: Jason Wong <php-general
gremlins.com.hk>
>Reply-To: php-general
lists.php.net
>To: php-general
lists.php.net
>Subject: Re: [PHP] Other Notice problem...
>Date: Sat, 9 Nov 2002 01:42:56 +0800
>
>On Saturday 09 November 2002 01:02, Marco Tabini wrote:
> > Well, it's possible he's using an older version of PHP in which
> > superglobals did not yet exist.
>
>It looks to me as if he just wants to use plain $variable but with
>register_globals disabled that's just not possible.
>
>Unless you go through that extract($_POST) ritual, all of which is covered
>in
>the manual and archives.
>
>--
>Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>Open Source Software Systems Integrators
>* Web Design & Hosting * Internet & Intranet Applications Development *
>
>/*
>The biggest problem with communication is the illusion that it has
>occurred.
>*/
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ MSN Fotos: la forma más fácil de compartir e imprimir fotos. http://photos.msn.es/support/worldwide.aspx
attached mail follows:
On Friday, Nov 8, 2002, at 17:59 Europe/London, R B wrote: > It's ok. I understand that i can't use plain variables with > register_globals=on, but this is only for GET variables or to all > variables?
The value of register_globals only affects the CGI variables (get, post, server, cookies, etc). You can use other variables in the same way as you ever did.
-- Stuart
attached mail follows:
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote in message
news:5.1.1.6.2.20021108092657.02befe20
mail.vogelsinger.at...
> At 03:36 08.11.2002, Tim Molendijk said:
> --------------------[snip]--------------------
>
> Ahh - culprit 1:
>
> You said the container is creating a child instance - I assume it's done
in
> the constructor...
>
> What you're doing here is to create a clone when assigning new()'s result
> to $testContainer1. You should rather
> $testContainer1 =& new Container(TRUE);
>
> Note the ampersand here - if you don't you'll get a clone.
>
> Rule for references:
> If your object does something in its constructor, use a reference
> assignment for
> new class()
>
Ernest,
Before your post I accidently found out a solution: $testContainer1 = &new Container(TRUE) instead of $testContainer1 = new Container(TRUE);
When I found this out I didn't understand WHY this was the solution...
Thanks to your comments I DO understand why... I suddenly see every jigsaw piece fall in place :D
The difference between the first code snippet (that with $testContainer1) and the second code snippet (that with $testContainer2) is that in code snippet 2 the Container object is already constructed and assigned to $testContainer2 when loading it. Then when it is loaded $this (in add()) refers to the object in $testContainer2 so no problem occurs. But in code snippet 1 the Container object loads itself before it is assigned to $testContainer1. During this process $this (in add()) refers to the object that is being created. And now the core is: the object that is being created is *not* the same object as the one that is assigned to $testContainer1!! So the references to the created object will not refer to $testContainer1!! That's it!!! I completely understand... Thanks a lot Ernest!
> > Again - make this > $newChild =& new Child(1); > > > But you don't pass "$child" by reference! Make this > function (&$child) > > If you don't pass $child as a reference, the line > $child->parent = $this; > will set the parent value of the clone that's passed as an argument, and > leave the "original" $child unmodified! >
This is not true in my case, because instead of doing: function add(&$child) { ... } I do: function add($child) { ... } and then call it with: $this->add(&$child);
This has the same result... As far as I know I doesn't matter whether you put an ampersand before the variable in your function definition or your in your function call.
> Crosscheck all of your class code (and the code utilizing it) it you're > always passing references. Ref's work like a charm until you mess up at a > single location. Well, having made my way from C/C++ to PHP I'd rather deal > with pointers, but unfortunately PHP doesn't have them. So keep an eye open .-) >
The problem is solved and I completely understand why now. This last thing is thanks to you Ernest.
Regards, Tim
> > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > >
attached mail follows:
At 16:48 08.11.2002, Tim Molendijk spoke out and said: --------------------[snip]-------------------- >The problem is solved and I completely understand why now. This last thing >is thanks to you Ernest. --------------------[snip]--------------------
Glad it works - you're very welcome :)
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
One more:
At 16:48 08.11.2002, Tim Molendijk spoke out and said: --------------------[snip]-------------------- > >This is not true in my case, because instead of doing: >function add(&$child) { ... } >I do: >function add($child) { ... } >and then call it with: >$this->add(&$child); > >This has the same result... As far as I know I doesn't matter whether you >put an ampersand before the variable in your function definition or your in >your function call. --------------------[snip]--------------------
True for now, but this is "officially deprecated". Functions or methods accepting a reference are required to be "prototyped" that way - this helps you not to "forget" to pass by reference. You really should modify your functions using reference parameters when declaring them, if you're using references...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote in message
news:5.1.1.6.2.20021108165218.03238948
mail.vogelsinger.at...
> One more:
>
> True for now, but this is "officially deprecated". Functions or methods
> accepting a reference are required to be "prototyped" that way - this
helps
> you not to "forget" to pass by reference. You really should modify your
> functions using reference parameters when declaring them, if you're using
> references...
>
Yes I know it is poor programming habits to do like I did... But I have a reason for it. I have quite a lot methods that accept objects *optional*. So f.e.:
---
class Product
{
var $language;
function Product($language = FALSE)
{
$this->language = $language;
}
}
---
Now to make this possible it becomes impossible to do what you suggest:
function Product(&$language = FALSE)
is not allowed. And in my application this optional arguments functionality
is very important. So I have preferred this over the decent habit.
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
attached mail follows:
At 17:04 08.11.2002, Tim Molendijk spoke out and said: --------------------[snip]-------------------- >Yes I know it is poor programming habits to do like I did... But I have a >reason for it. I have quite a lot methods that accept objects *optional*. So >f.e.: >--- >class Product >{ > var $language; > function Product($language = FALSE) > { > $this->language = $language; > } >} >--- >Now to make this possible it becomes impossible to do what you suggest: >function Product(&$language = FALSE) >is not allowed. And in my application this optional arguments functionality >is very important. So I have preferred this over the decent habit. --------------------[snip]--------------------
You might always simply omit the parameter when calling the function (you'll get a notice about that if enabled). You just cannot pass constants:
function Product(&$language) { ... }
// ok, but gives a notice Product();
// will fail Product('ger');
If you keep your code like it is be warned that it may break with a future version of PHP.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
"Ernest E Vogelsinger" <ernest
vogelsinger.at> wrote in message
news:5.1.1.6.2.20021108170633.00b8cb60
mail.vogelsinger.at...
>
> You might always simply omit the parameter when calling the function
> (you'll get a notice about that if enabled). You just cannot pass
constants:
>
> function Product(&$language)
> {
> ...
> }
>
> // ok, but gives a notice
> Product();
>
> // will fail
> Product('ger');
>
ok well that's an idea indeed... i'll think about it.
> If you keep your code like it is be warned that it may break with a future > version of PHP. >
why do you think it won't be supported by future versions? all i do is passing an object by reference. because in this case this function always should accept its argument as a reference and therefore is bad programming habit does not mean the php construction is bad or weird!?!
> > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ >
attached mail follows:
At 17:32 08.11.2002, Tim Molendijk spoke out and said: --------------------[snip]-------------------- >why do you think it won't be supported by future versions? all i do is >passing an object by reference. because in this case this function always >should accept its argument as a reference and therefore is bad programming >habit does not mean the php construction is bad or weird!?! --------------------[snip]--------------------
This is clearly said in your PHP.ini file:
; Whether to enable the ability to force arguments to be passed by reference ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function ; declaration. You're encouraged to try and turn this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by ; reference). allow_call_time_pass_reference = On
...god has spoken :)
I'd rather have the abilty to pass A reference like "foo(&$a)" and have the opportunity to choose at runtime if I want to use a reference here or not, but it's how they say...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Krzysztof Dziekiewicz wrote...
> Do you use "include" or "require". In such situation you should not use > "include".
I tried require() too, but it made no difference. I later learned that if you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the file is complete (or that it even exists).
This has to be a PHP bug, which I'd be happy to file if someone more experienced could confirm that it isn't stupid user error.
For a workaround, after I fflush() and fclose() I while() until the file exists, and then while() until it's larger than 10 bytes. I should while() until it's the size of the data I've written, but this method has been reliable so far.
-- Charles Wiltgen"Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick
attached mail follows:
At 16:50 08.11.2002, Charles Wiltgen spoke out and said: --------------------[snip]-------------------- >I tried require() too, but it made no difference. I later learned that if >you fopen(), write some stuff, fflush() and ffclose(), that doesn't mean the >file is complete (or that it even exists). > >This has to be a PHP bug, which I'd be happy to file if someone more >experienced could confirm that it isn't stupid user error. --------------------[snip]--------------------
I don't believe it has something to do with PHP, much more with the FTP server you're accessing... This might delay the actual flushing for what reason ever. I don't believe PHP buffers files differently if they are accessed using an fopen url wrapper.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
attached mail follows:
Ernest E Vogelsinger wrote...
>> This has to be a PHP bug, which I'd be happy to file if someone more >> experienced could confirm that it isn't stupid user error. > > I don't believe it has something to do with PHP, much more with the FTP server > you're accessing... This might delay the actual flushing for what reason ever. > I don't believe PHP buffers files differently if they are accessed using an > fopen url wrapper.
The Linux system I'm FTPing to is using ProFTPD, which as I understand it is one of the best open-source servers out there.
I will add a note to the documentation along the lines of "If you fopen() to an FTP URI, write some stuff, fflush() and ffclose(), that doesn't mean the file is complete (or that it even exists). Check for both of these things before you do anything with the file."
Thanks!
-- Charles Wiltgen
attached mail follows:
Ernest,
> To be more effective, and to allow the OS to do something else while you're > waiting at the file, your script should sleep for some microseconds...
An excellent suggestion, thanks very much! :^)
-- Charles Wiltgen
attached mail follows:
Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote: > $max = max($myArray); > for( $x = 1; $x <= $length; $x++ ) {}
> -- OR --
> for( $x = 1; $x <= max($myArray); $x++ ) {}
> My gut instinct tells me since PHP is interpreted, that the top one is > the better way to go, but with the Zend Optimizer, I don't know if PHP > handles them the same way or not?
The first one is faster, but it depends on the site of the array and how often you call the loop. I prefer doing it like this though:
for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
For some good optimization (and other) tips check out: http://phplens.com/lens/php-book/optimizing-debugging-php.php http://www.lerdorf.com/tips.pdf
-- Kjartan <kjartanzind.net> (http://natrak.net/) :: "Silence is one great art of conversation."
attached mail follows:
the most correct way is probably:
$size = sizeof($myArray); for( $x = 1; $x <= $size; $x++ ) {}
But, this is too personal and is "my way".
-- Maxim Maletsky maximphp.net
Kjartan Mannes <kjartan
zind.net> wrote... :
> Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote: > > $max = max($myArray); > > for( $x = 1; $x <= $length; $x++ ) {} > > > -- OR -- > > > for( $x = 1; $x <= max($myArray); $x++ ) {} > > > My gut instinct tells me since PHP is interpreted, that the top one is > > the better way to go, but with the Zend Optimizer, I don't know if PHP > > handles them the same way or not? > > The first one is faster, but it depends on the site of the array and how > often you call the loop. I prefer doing it like this though: > > for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {} > > For some good optimization (and other) tips check out: > http://phplens.com/lens/php-book/optimizing-debugging-php.php > http://www.lerdorf.com/tips.pdf > > -- > Kjartan <kjartan
zind.net> (http://natrak.net/) > :: "Silence is one great art of conversation." > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Then only problem with doing it like
for($x = 1, $max = count($myArray); $x <= $max; $x++ )
is that the $max = count( $myArray ) is always verified in each loop...slowing the for loop down...
faster to do $max = count( $myArray ); for( $x = 1, $x <= $max; $x++ )
just my $0.02...for the day...
On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
> Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> > $max = max($myArray);
> > for( $x = 1; $x <= $length; $x++ ) {}
>
> > -- OR --
>
> > for( $x = 1; $x <= max($myArray); $x++ ) {}
>
> > My gut instinct tells me since PHP is interpreted, that the top one is
> > the better way to go, but with the Zend Optimizer, I don't know if PHP
> > handles them the same way or not?
>
> The first one is faster, but it depends on the site of the array and how
> often you call the loop. I prefer doing it like this though:
>
> for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
>
> For some good optimization (and other) tips check out:
> http://phplens.com/lens/php-book/optimizing-debugging-php.php
> http://www.lerdorf.com/tips.pdf
>
> --
> Kjartan <kjartan
zind.net> (http://natrak.net/)
> :: "Silence is one great art of conversation."
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- .: B i g D o g :.
attached mail follows:
If you reed the code carefully, it first assigns $x=1 and $max=count($myArray), then it compares $x with $max
.: B i g D o g :. wrote:
>Then only problem with doing it like
>
>for($x = 1, $max = count($myArray); $x <= $max; $x++ )
>
>is that the $max = count( $myArray ) is always verified in each
>loop...slowing the for loop down...
>
>faster to do
>$max = count( $myArray );
>for( $x = 1, $x <= $max; $x++ )
>
>
>just my $0.02...for the day...
>
>
>
>On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
>
>
>>Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
>>
>>
>>>$max = max($myArray);
>>>for( $x = 1; $x <= $length; $x++ ) {}
>>>
>>>
>>> -- OR --
>>>
>>>
>>>for( $x = 1; $x <= max($myArray); $x++ ) {}
>>>
>>>
>>>My gut instinct tells me since PHP is interpreted, that the top one is
>>>the better way to go, but with the Zend Optimizer, I don't know if PHP
>>>handles them the same way or not?
>>>
>>>
>>The first one is faster, but it depends on the site of the array and how
>>often you call the loop. I prefer doing it like this though:
>>
>> for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
>>
>>For some good optimization (and other) tips check out:
>> http://phplens.com/lens/php-book/optimizing-debugging-php.php
>> http://www.lerdorf.com/tips.pdf
>>
>>--
>>Kjartan <kjartan
zind.net> (http://natrak.net/)
>>:: "Silence is one great art of conversation."
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
attached mail follows:
Sorry bro,
was thinking that in the initialization section that it would run the count again, but that is not the case...
$max is initialized first and never looked at again during the for loop...
On Fri, 2002-11-08 at 19:00, Marek Kilimajer wrote:
> If you reed the code carefully, it first assigns $x=1 and
> $max=count($myArray),
> then it compares $x with $max
>
>
> .: B i g D o g :. wrote:
>
> >Then only problem with doing it like
> >
> >for($x = 1, $max = count($myArray); $x <= $max; $x++ )
> >
> >is that the $max = count( $myArray ) is always verified in each
> >loop...slowing the for loop down...
> >
> >faster to do
> >$max = count( $myArray );
> >for( $x = 1, $x <= $max; $x++ )
> >
> >
> >just my $0.02...for the day...
> >
> >
> >
> >On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
> >
> >
> >>Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> >>
> >>
> >>>$max = max($myArray);
> >>>for( $x = 1; $x <= $length; $x++ ) {}
> >>>
> >>>
> >>> -- OR --
> >>>
> >>>
> >>>for( $x = 1; $x <= max($myArray); $x++ ) {}
> >>>
> >>>
> >>>My gut instinct tells me since PHP is interpreted, that the top one is
> >>>the better way to go, but with the Zend Optimizer, I don't know if PHP
> >>>handles them the same way or not?
> >>>
> >>>
> >>The first one is faster, but it depends on the site of the array and how
> >>often you call the loop. I prefer doing it like this though:
> >>
> >> for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
> >>
> >>For some good optimization (and other) tips check out:
> >> http://phplens.com/lens/php-book/optimizing-debugging-php.php
> >> http://www.lerdorf.com/tips.pdf
> >>
> >>--
> >>Kjartan <kjartan
zind.net> (http://natrak.net/)
> >>:: "Silence is one great art of conversation."
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- .: B i g D o g :.
attached mail follows:
I have a simple object/class:
Class MainData { Var items =array();
...some other functions but nothing to initialize it }
in a code when I do :
$somevar= new MainData(); session_register($somevar);
I get "notice" type of error: Notice: Object to string conversion in C...\page_vip.php on line 27
How can I avoid this? It does not stop code and it is not a fatal error but perhaps I am missing something
Paul
attached mail follows:
To this : session_register('somevar') and it'll work.. if your're using PHP4, you can also do this : $_SESSIONS['somevar']=$somevar
Regards, P.E. Baroiller
"Paul" <pax
cfl.rr.com> a écrit dans le message de news:
002601c28743$42bebbf0$6401a8c0
pawel...
>
> I have a simple object/class:
>
> Class MainData {
> Var items =array();
>
> ...some other functions but nothing to initialize it
> }
>
> in a code when I do :
>
> $somevar= new MainData();
> session_register($somevar);
>
> I get "notice" type of error:
> Notice: Object to string conversion in C...\page_vip.php on line 27
>
> How can I avoid this? It does not stop code and it is not a fatal error
> but perhaps I am missing something
>
> Paul
>
>
attached mail follows:
Hi,
is there any software on the market with I can test my html/php based web portal? I mean for example the data flow between html forms and php files/scripts. For Example a login form on html site and a check with an other php site and I want begin the test on the html site and check weather the right values goes to the php script.
Thanks!
attached mail follows:
I have used nusphere PHPEd and it works okay...but i do not know what you are really trying to do here...
On Fri, 2002-11-08 at 16:31, Anna Gyor wrote: > Hi, > > is there any software on the market with I can test my html/php based web > portal? I mean for example the data flow between html forms and php > files/scripts. For Example a login form on html site and a check with an > other php site and I want begin the test on the html site and check weather > the right values goes to the php script. > > Thanks! > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
-- .: B i g D o g :.
attached mail follows:
PHP does not really have a MS Front Page or MM Dreamweaver tool, but it has Zend IDE and Nusphere apps that can ingrate with your server and make your life much easier while developing.
-- Maxim Maletsky maximphp.net
"Anna Gyor" <bali1a
freemail.hu> wrote... :
> Hi, > > is there any software on the market with I can test my html/php based web > portal? I mean for example the data flow between html forms and php > files/scripts. For Example a login form on html site and a check with an > other php site and I want begin the test on the html site and check weather > the right values goes to the php script. > > Thanks! > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
On 8 Nov 2002 16:33:54 -0000
php-general-help
lists.php.net wrote:
> Hi! This is the ezmlm program. I'm managing the
> php-general
lists.php.net mailing list.
>
> I'm working for my owner, who can be reached
> at php-general-owner
lists.php.net.
>
> To confirm that you would like
>
> php
skycomp.ca
>
> removed from the php-general mailing list, please send an empty reply
> to this address:
>
> php-general-uc.1036773234.bmjobgjakdnakaciclja-php=skycomp.ca
lists.php.net
>
> Usually, this happens when you just hit the "reply" button.
> If this does not work, simply copy the address and paste it into
> the "To:" field of a new message.
>
> or click here:
> mailto:php-general-uc.1036773234.bmjobgjakdnakaciclja-php=skycomp.ca
lists.php.net
>
> PLEASE NOTE: I haven't checked whether your address is currently
> on the mailing list. To see what address you used to subscribe,
> look at the messages you are receiving from the mailing list. Each
> message has your address hidden inside its return path; for
> example, mary
xdd.ff.com receives messages with return path:
> <php-general-return-<number>-mary=xdd.ff.com
lists.php.net.
>
> Some mail programs are broken and cannot handle long addresses. If you
> cannot reply to this request, instead send a message to
> <php-general-request
lists.php.net> and put the entire address listed above
> into the "Subject:" line.
>
>
> --- Administrative commands for the php-general list ---
>
> I can handle administrative requests automatically. Please
> do not send them to the list address! Instead, send
> your message to the correct command address:
>
> For help and a description of available commands, send a message to:
> <php-general-help
lists.php.net>
>
> To subscribe to the list, send a message to:
> <php-general-subscribe
lists.php.net>
>
> To remove your address from the list, just send a message to
> the address in the ``List-Unsubscribe'' header of any list
> message. If you haven't changed addresses since subscribing,
> you can also send a message to:
> <php-general-unsubscribe
lists.php.net>
>
> or for the digest to:
> <php-general-digest-unsubscribe
lists.php.net>
>
> For addition or removal of addresses, I'll send a confirmation
> message to that address. When you receive it, simply reply to it
> to complete the transaction.
>
> If you need to get in touch with the human owner of this list,
> please send a message to:
>
> <php-general-owner
lists.php.net>
>
> Please include a FORWARDED list message with ALL HEADERS intact
> to make it easier to help you.
>
> --- Enclosed is a copy of the request I received.
>
> Return-Path: <root
php.net>
> Received: (qmail 34754 invoked from network); 8 Nov 2002 16:33:54 -0000
> Received: from unknown (HELO php.net) (64.246.30.37)
> by pb1.pair.com with SMTP; 8 Nov 2002 16:33:54 -0000
> Received: (qmail 7378 invoked by uid 99); 8 Nov 2002 16:30:07 -0000
> Date: 8 Nov 2002 16:30:07 -0000
> Message-ID: <20021108163007.7377.qmail
php.net>
> To: php-general-unsubscribe-php=skycomp.ca
lists.php.net
> Subject: Website Subscription
> From: php
skycomp.ca
>
>
> This was a request generated from the form at http://php.net/mailing-lists.php by 209.167.145.30.
attached mail follows:
hi there again, here's the problem: I compiled apache using --enable-modules=so What do i need to do now in order to compile and install php on my machine? Furthermore, how do i add mysql support to apache? Is there a --with-mysql switch? Kind regards, dimitris
attached mail follows:
On Saturday 09 November 2002 00:52, dk1eng wrote: > hi there again, > here's the problem: > I compiled apache using --enable-modules=so > What do i need to do now in order to compile and install php on my machine?
The manual says it all. Basically:
./configure --with-apxs=/usr/local/apache/bin/apxs \ --with-config-file-path=/usr/local/apache/conf ...
If you want a more comprehensive set of installation instructions have a look at the "LAMP guide", google for "lamp install php apache mysql", it's a bit old but the stuff there should still be relevant.
> Furthermore, how do i add mysql support to apache? Is there a > --with-mysql switch?
You probably want to add mysql support to PHP rather than apache.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Our policy is, when in doubt, do the right thing. -- Roy L. Ash, ex-president, Litton Industries */
attached mail follows:
i would always make sure you check the manuals for the information first...
http://www.php.net/manual/en/install.apache.php
On Fri, 2002-11-08 at 16:52, dk1eng wrote: > hi there again, > here's the problem: > I compiled apache using --enable-modules=so > What do i need to do now in order to compile and install php on my machine? > Furthermore, how do i add mysql support to apache? Is there a > --with-mysql switch? > Kind regards, > dimitris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: