Re: [PHP] Help Sending Mail

2007-12-11 Thread Jim Lucas

Robert Cummings wrote:


Yeah, he's all over the place with his line endings. Personally, I use
an array to track the headers and use implode in one shot before
sending.

Cheers,
Rob.


Same here

--
Jim Lucas


Perseverance is not a long race;
it is many short races one after the other

Walter Elliot



Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2007-12-11 Thread Jim Lucas

M5 wrote:

Thanks Jim.


No problem.



The processing is pretty quick. I don't think that's a bottleneck. It 
basically just inserts the data into MySQL, not much processing actually.




What is the likely hood that two connections would come in at the same 
time, or at least within close enough time that the second would have to 
wait for the first to finish its job?




--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Jim Lucas


Perseverance is not a long race;
it is many short races one after the other

Walter Elliot



Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] LoadXML trouble

2007-12-11 Thread Dani Castaños

If i use your script like this:

$xml = '?xml version=1.0?
response
 ticketID1197027955_8310/ticketID
 statusOK/status
 errCode200/errCode
 errMsg/errMsg
/response';

$obj = new DOMDocument();
$obj-loadXML( $xml );

echo print_r( $obj, true );
echo $obj-saveXML() . PHP_EOL;

The first statement writes:
DOMDocument Object
(
)

The second:
?xml version=1.0?
response
 ticketID1197027955_8310/ticketID
 statusOK/status
 errCode200/errCode
 errMsg/
/response

It's just the xml is not properly stored in loadXML method... but the 
string must be inside due to saveXML returns the proper value.



Nathan Nobbe escribió:
On Dec 10, 2007 12:08 PM, Dani Castaños [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Yep, it works when i do saveXML, but not on loadXML step...


did the loadXML() method work in the test script i sent over in my 
last post?
if it does then something else is going on when loadXML() is called in 
the context

of your application.

The thing is... i'm trying to do something like this:

$request = $_POST['xml'];
$logger-debug( 'New ticket request' );

/**
 * Parse XML request to obtain values
 */
$xml = new DOMDocument();
//$xml-validateOnParse = true;
$xml-loadXML( $request );


you should always sanitize input.  at the very least you should be 
running $_POST['xml']

through a call to trim() before handing it to the DOMDocument  instance.

$request = trim($_POST['xml']);
$xml = new DOMDocument();
$xml-loadXML($request);

i suspect there is some garbage in or around the string contained in 
$_POST['xml'] that
the DomDocument instance doesnt like, therefore its not behaving the 
way youd anticipate.
for example if you modify the script i sent over last time by putting 
some spaces in between the
xml declaration and the opening tag of the envelope (response) you 
should see the following error

(or something similar [depending on the value of error_reporting])

Warning: DOMDocument::loadXML(): XML declaration allowed only at the 
start of the document in Entity,

line: 3 in /home/nathan/testDom.php on line 19

which consequently leads to
?xml version=1.0?

when invoking
echo $domDoc-saveXML() . PHP_EOL;
rather than
?xml version= 1.0?
response
 ticketID1197026188_ec76/ticketID
 statusKO/status
 errCode500/errCode
 errMsgInternal Server Error/errMsg
/response

which is what you would expect.
-nathan
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generating Random Numbers with Normal Distribution

2007-12-11 Thread Robin Vickery
On 10/12/2007, Nathan Nobbe [EMAIL PROTECTED] wrote:
 On Dec 10, 2007 5:29 PM, Robert Cummings [EMAIL PROTECTED] wrote:

  On Mon, 2007-12-10 at 14:22 -0600, Jay Blanchard wrote:
   [snip]
   Can you say for certain nature is truly random? Just because the seed
   may have occurred 13.7 billion years ago and we don't know what that
   initial state was and we couldn't possibly calculate all the
   interactions since, doesn't mean that everything since hasn't been
   happening in accordance with some universal formula and in absence of
   randomness. We know that there appear to be certain laws in physics,
   would they not have applied to that initial state in a non random
   manner? It may just be that due to the hugantic sample space from which
   to draw arbitrary values that we think things are random.
  
   Food for thought :)
   [/snip]
  
   Without order there cannot be randomness.
 
  But is the reverse true?


 i would have to say randomness came before order.  but i suppose thats a
 chicken
 and egg problem..

In the worlds before Monkey, primal chaos reigned. Heavens sought
order. But the phoenix can fly only when its feathers are grown.

The four worlds formed again and yet again, as endless aeons wheeled
and passed. Time and the pure essence of Heaven, the moisture of the
Earth, the powers of the Sun and the Moon all worked upon a certain
rock, old as creation. And it became magically fertile. That first egg
was named Thought.

Tathagata Buddha, the Father Buddha, said, With our thoughts, we make
the World. Elemental forces caused the egg to hatch. From it came a
stone monkey.

The nature of Monkey was irrepressible!

Monkeey

-robin

[I'll get my coat...]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes

You use a session variable for that?


Why not?


That's entirely the wrong place to
store something like which database API is installed.


Not really. You could even wrap a function called (for example) 
Feature() around it.


 It should a class

variable or global configuration variable. Heck, I'd say it's more
appropriate to do extension_loaded( 'mysqli' ) on every call than to use
a session variable.


Why? It's very unlikely to be changing between calls. And even if it 
does, it's once in a blue moon. Granted though, I can't see it being a 
particularly intensive function call, so I can't see the harm in calling 
it on every invocation.


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Stut

Richard Heyes wrote:

You use a session variable for that?


Why not?


Because it's not user data, it's server data.


That's entirely the wrong place to
store something like which database API is installed.


Not really. You could even wrap a function called (for example) 
Feature() around it.


Yeah, really.  Sessions are for user data. If it's the same for all 
users then it doesn't belong in the session, it belongs in a server-wide 
cache.



It should a class
variable or global configuration variable. Heck, I'd say it's more
appropriate to do extension_loaded( 'mysqli' ) on every call than to use
a session variable.


Why? It's very unlikely to be changing between calls. And even if it 
does, it's once in a blue moon. Granted though, I can't see it being a 
particularly intensive function call, so I can't see the harm in calling 
it on every invocation.


AFAIK a call to extension_loaded is pretty cheap, but if you really feel 
the need to cache it between requests the best place to store it would 
be in a file on the server. However, I'd expect a stat on that file will 
be more expensive than calling extension_loaded.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Jochem Maas
Stut wrote:
 Richard Heyes wrote:
 You use a session variable for that?

 Why not?
 
 Because it's not user data, it's server data.
 
 That's entirely the wrong place to
 store something like which database API is installed.

 Not really. You could even wrap a function called (for example)
 Feature() around it.
 
 Yeah, really.  Sessions are for user data. If it's the same for all
 users then it doesn't belong in the session, it belongs in a server-wide
 cache.
 
 It should a class
 variable or global configuration variable. Heck, I'd say it's more
 appropriate to do extension_loaded( 'mysqli' ) on every call than to use
 a session variable.

 Why? It's very unlikely to be changing between calls. And even if it
 does, it's once in a blue moon. Granted though, I can't see it being a
 particularly intensive function call, so I can't see the harm in
 calling it on every invocation.
 
 AFAIK a call to extension_loaded is pretty cheap, but if you really feel
 the need to cache it between requests the best place to store it would
 be in a file on the server. However, I'd expect a stat on that file will
 be more expensive than calling extension_loaded.

the on disk file could be [re]generated automatically when the server is started
up by the application and dumped onto tmpfs or even not stored as a file at all
but directly in memory using apc or something similar

either way I agree it's a server wide setting that is garanteed not change as 
long
as the webserver is not restarted - atleast I can't see an extension becoming 
available
'just like that' ... going on the basis that dl() should be illegal ;-) - 
actually
it is not available if your using a threaded webserver (who does?) and as of 
php6 not
webserver SAPI implements dl() not to mention safe_mode which also disables it.

 
 -Stut
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Per Jessen
Stut wrote:

 However, I'd expect a stat on that
 file will be more expensive than calling extension_loaded.

Difficult to say, but a stat() is cheap, especially if the inode is
cached already.


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Nathan Rixham
If you want a source to very verify against, send yourself an email, 
then view it's source; then change your class till it outputs the same 
info, gauranteed winner every time.


Nathan

Jim Lucas wrote:

Robert Cummings wrote:


Yeah, he's all over the place with his line endings. Personally, I use
an array to track the headers and use implode in one shot before
sending.

Cheers,
Rob.


Same here



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

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


while (is_resource($conn = stream_socket_accept($socket, -1)))
while (is_resource($conn)  $pkt = stream_get_line($conn, 100, \n))

Key I find though is multithreading, listener thread with 
stream_socket_server, 2 or 3 stream_socket_accept threads and a pair of 
new thread spawned to handle each connection (one to read, one to write) 
(not needed for stateless http style request processing).


Nathan

M5 wrote:
Curiously, would you agree with this guy's comments concerning low-level 
PHP socket functions vs stream_socket_server() ?


If you want a high speed socket server, use the low-level sockets 
instead (socket_create/bind/listen). The stream_socket_server version 
appears to have internal fixed 8k buffers that will overflow if you 
don't keep up by reading.


This is a serious problem if you an application that reads the socket 
for messages and then, say, saves the result in a database. The delay 
while it is busy processing means you can't read the data in time unless 
you get involved in muti-threading.


With the the low-level functions, the OS quietly buffers TCP/IP packets 
so there is no problem (tested on Windows XP Professional). 
(http://www.php.net/manual/en/function.stream-socket-server.php#67837)



On 10-Dec-07, at 9:46 PM, Tom Rogers wrote:


Hi,

Tuesday, December 11, 2007, 10:01:38 AM, you wrote:
RF On 10-Dec-07, at 4:42 PM, Tom Rogers wrote:



Put a usleep(1000) in the listen while() loop and give the cpu a
break.


RF Good advice, but I've already been doing that. The thing is, when the
RF script first starts up, the CPU rarely exceeds 30%, even when many
RF clients (200+) are simultaneously connected and sending data. When a
RF few clients are connected, CPU is typically below 10%. Again, it's
RF only after 24-48 hours that, all of a sudden, CPU usage increases by
RF 40-50%. And it stays high until I stop the script and restart it.

RF One question I have though is, is there actually any benefit to using
RF mysql_pconnect(), since the script simply loops? My understanding is
RF that pconnect only benefits if a script would otherwise be using
RF mysql_connect repeatedly--and this script doesn't, since it calls
RF mysql_[p]connect() just once, in the start tof execution.

RF ...Rene

I have found pconnect to be a problem (several years ago) and have
never tried it since, it may well be ok now. The most likely cause is
memory consumption on long running php scripts, what does top say?

I have a script which runs from cron and was hammering the system when
it ran and i have had to put the usleep() in the while($result = ..)
loop as there are a few thousand rows. Probably bad design but it
works and I'm loath to touch it :)

One way to solve the memory issue is to have the script started by
inetd, slower but more memory friendly.

Also have a look at memcached to reduce the load a bit.

--
regards,
Tom

--
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



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

2007-12-11 Thread Jochem Maas
hi Nathan,

any chance of a 'full blown' example for all the muppets who want to try and
grok this stuff? (bork bork, say I :-))

Nathan Rixham wrote:
 stream_socket_server simply listens, stream_socket_accept handles the
 connection, stream_set_write_buffer and stream_set_blocking help you
 keep up, especially when combined with stream_get_line, no need to shile
 forever when you can just:
 
 while (is_resource($conn = stream_socket_accept($socket, -1)))
 while (is_resource($conn)  $pkt = stream_get_line($conn, 100, \n))
 
 Key I find though is multithreading, listener thread with
 stream_socket_server, 2 or 3 stream_socket_accept threads and a pair of
 new thread spawned to handle each connection (one to read, one to write)
 (not needed for stateless http style request processing).
 
 Nathan
 
 M5 wrote:
 Curiously, would you agree with this guy's comments concerning
 low-level PHP socket functions vs stream_socket_server() ?

 If you want a high speed socket server, use the low-level sockets
 instead (socket_create/bind/listen). The stream_socket_server version
 appears to have internal fixed 8k buffers that will overflow if you
 don't keep up by reading.

 This is a serious problem if you an application that reads the socket
 for messages and then, say, saves the result in a database. The delay
 while it is busy processing means you can't read the data in time
 unless you get involved in muti-threading.

 With the the low-level functions, the OS quietly buffers TCP/IP
 packets so there is no problem (tested on Windows XP Professional).
 (http://www.php.net/manual/en/function.stream-socket-server.php#67837)


 On 10-Dec-07, at 9:46 PM, Tom Rogers wrote:

 Hi,

 Tuesday, December 11, 2007, 10:01:38 AM, you wrote:
 RF On 10-Dec-07, at 4:42 PM, Tom Rogers wrote:


 Put a usleep(1000) in the listen while() loop and give the cpu a
 break.

 RF Good advice, but I've already been doing that. The thing is, when
 the
 RF script first starts up, the CPU rarely exceeds 30%, even when many
 RF clients (200+) are simultaneously connected and sending data. When a
 RF few clients are connected, CPU is typically below 10%. Again, it's
 RF only after 24-48 hours that, all of a sudden, CPU usage increases by
 RF 40-50%. And it stays high until I stop the script and restart it.

 RF One question I have though is, is there actually any benefit to
 using
 RF mysql_pconnect(), since the script simply loops? My understanding is
 RF that pconnect only benefits if a script would otherwise be using
 RF mysql_connect repeatedly--and this script doesn't, since it calls
 RF mysql_[p]connect() just once, in the start tof execution.

 RF ...Rene

 I have found pconnect to be a problem (several years ago) and have
 never tried it since, it may well be ok now. The most likely cause is
 memory consumption on long running php scripts, what does top say?

 I have a script which runs from cron and was hammering the system when
 it ran and i have had to put the usleep() in the while($result = ..)
 loop as there are a few thousand rows. Probably bad design but it
 works and I'm loath to touch it :)

 One way to solve the memory issue is to have the script started by
 inetd, slower but more memory friendly.

 Also have a look at memcached to reduce the load a bit.

 -- 
 regards,
 Tom

 -- 
 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



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes

Because it's not user data, it's server data.


So? It's there - use it.


That's entirely the wrong place to
store something like which database API is installed.


Not really. You could even wrap a function called (for example) 
Feature() around it.


Yeah, really.  Sessions are for user data. If it's the same for all 
users then it doesn't belong in the session, it belongs in a server-wide 
cache.



Sessions are for whatever you choose to put in them. And why implement a 
cache when you've got something perfectly usable (sessions) already?


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2007-12-11 Thread Per Jessen
Jochem Maas wrote:

 Nathan Rixham wrote:

 Key I find though is multithreading, listener thread with
 stream_socket_server, 2 or 3 stream_socket_accept threads and a pair
 of new thread spawned to handle each connection (one to read, one to
 write) (not needed for stateless http style request processing).
 
 Nathan
 hi Nathan,

 
 any chance of a 'full blown' example for all the muppets who want to
 try and grok this stuff? (bork bork, say I :-))

I'd be interested to see how he does the multi-threading in php. 
Personally I'd always opt for C to write this type of thing, except for
perhaps the most simple cases. 



/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

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

 Nathan
 hi Nathan,


 any chance of a 'full blown' example for all the muppets who want to
 try and grok this stuff? (bork bork, say I :-))
 
 I'd be interested to see how he does the multi-threading in php. 
 Personally I'd always opt for C to write this type of thing, except for
 perhaps the most simple cases. 
 

any chance of an example from you too?

 
 /Per Jessen, Zürich
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] LoadXML trouble

2007-12-11 Thread Nathan Nobbe
On Dec 11, 2007 3:52 AM, Dani Castaños [EMAIL PROTECTED] wrote:

 If i use your script like this:

 $xml = '?xml version=1.0?
 response
  ticketID1197027955_8310/ticketID
  statusOK/status
  errCode200/errCode
  errMsg/errMsg
 /response';

 $obj = new DOMDocument();
 $obj-loadXML( $xml );

 echo print_r( $obj, true );
 echo $obj-saveXML() . PHP_EOL;

 The first statement writes:
 DOMDocument Object
 (
 )

 The second:
 ?xml version=1.0?
 response
  ticketID1197027955_8310/ticketID
  statusOK/status
  errCode200/errCode
  errMsg/
 /response

 It's just the xml is not properly stored in loadXML method... but the
 string must be inside due to saveXML returns the proper value.


that is expected behavior.  some of the internal classes dont define
any member variables that the php language has access to.  obviously
they are storing data internally, said variables just arent accessible as
member variables of the class thats being defined.
you can look at the structure of a class in one line with:
Reflection::export(new ReflectionClass('DomDocument'));

-nathan


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

2007-12-11 Thread Per Jessen
Jochem Maas wrote:

 I'd be interested to see how he does the multi-threading in php.
 Personally I'd always opt for C to write this type of thing, except
 for perhaps the most simple cases.
 
 
 any chance of an example from you too?

Sure - 

http://jessen.ch/files/distripg_main.c

It can't be compiled, but the pseudo-code goes like this:

initialize
bind() to address(es) to listen to
start a number of threads (=workers)
do until terminated
   poll() for new work 
   if new_work(), accept(), queue it, then wake up the workers. 
done

A worker thread:
initialize
do until terminated
wait for work
accept()
process work
done

It wouldn't be too difficult to have threads dynamically started and
stopped depending on the amount of work queued up.



/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] A SESSION Problem

2007-12-11 Thread tedd

Hi gang:

I just had this happen and wonder what the fix is for it.

I am sending session data from a script in a http to another script 
in https. However, sometimes the data gets through and sometimes it 
don't.


Any ideas or fixes?

Both scripts are listed below


[1]

?php session_start();
$x = 'zzz';
$_SESSION['x'] = $x;
?

form action=https://example.com/a-session2.php; method=post
input type=submit value=Proceed to Step 2
/form


[2]

?php session_start();
print_r($_SESSION);
?

form action=http://example.com/a-session1.php; method=post
input type=submit value=Proceed back to Step 1
/form


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A SESSION Problem

2007-12-11 Thread Jochem Maas
are you looking at a cache problem - i.e. (pun intended ;-)) the second page is 
a locally cached copy
and thereby not showing the data you would expect?

tedd wrote:
 Hi gang:
 
 I just had this happen and wonder what the fix is for it.
 
 I am sending session data from a script in a http to another script in
 https. However, sometimes the data gets through and sometimes it don't.
 
 Any ideas or fixes?
 
 Both scripts are listed below
 
 
 [1]
 
 ?php session_start();
 $x = 'zzz';
 $_SESSION['x'] = $x;
 ?
 
 form action=https://example.com/a-session2.php; method=post
 input type=submit value=Proceed to Step 2
 /form
 
 
 [2]
 
 ?php session_start();
 print_r($_SESSION);
 ?
 
 form action=http://example.com/a-session1.php; method=post
 input type=submit value=Proceed back to Step 1
 /form
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Generating Random Numbers with Normal Distribution

2007-12-11 Thread Jay Blanchard
[snip]
...stuff...
[/snip]

It is also wise to remember that order and randomness are relative,
making each less or more so dependent upon observation and observation
changes the observed.

Furthermore 'random numbers with normal distribution' implies that there
is certain order to the randomness since normal distribution typically
follows a bell curve.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A SESSION Problem

2007-12-11 Thread Daniel Brown
On Dec 11, 2007 9:53 AM, tedd [EMAIL PROTECTED] wrote:
 Hi gang:

 I just had this happen and wonder what the fix is for it.

 I am sending session data from a script in a http to another script
 in https. However, sometimes the data gets through and sometimes it
 don't.

 Any ideas or fixes?

 Both scripts are listed below


 [1]

 ?php session_start();
 $x = 'zzz';
 $_SESSION['x'] = $x;
 ?

 form action=https://example.com/a-session2.php; method=post
 input type=submit value=Proceed to Step 2
 /form


 [2]

 ?php session_start();
 print_r($_SESSION);
 ?

 form action=http://example.com/a-session1.php; method=post
 input type=submit value=Proceed back to Step 1
 /form

Provided the real code isn't directing to a different
CNAME/subdomain (e.g. - [Script 1] http://domain.com redirects to
[Script 2] https://www.domain.com/) it shouldn't be a problem.  The
snippet of code you provided looks fine.

The other problem could be, though, that - because a session uses
a cookie on the client side - the cookie can't be accessed reliably
across both SSL and normal (unsecured) HTTP connections.  Try
appending the SID to the end of the URL, or as a hidden form field.
You may also want to make sure that session.cookie_secure is to set to
'Off', since the SID will change with each page load otherwise.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] tidy memory corruption problem

2007-12-11 Thread Eric Wood
My first attempt at leaning the tidy suite of functions has ran into a major 
snag


I get this:

*** glibc detected *** /usr/sbin/httpd: malloc(): memory corruption: 
0x81946e30


whenever the tidy_parse_string() is called.

I'm running the latest apache/php/tidy that FC6 has to offer...
php-tidy-5.1.6-4.fc6
libtidy-0.99.0-12.20070228.fc6.1

Does the below code work on someone else's FC6 by chance?
thanks,
-eric wood




The code is:

html
head
titlePHP Tidy Test/title
body
?
$xml=EOX
begin
level1
level2
Text
/level2
/level1
/begin
EOX;
?
textarea cols='80' rows='10'
?
echo $xml;
?
/textarea
br/
Becomes...
br/
textarea cols='80' rows='10'
?
$config = array('indent' = TRUE,
  'input-xml' = TRUE,
  'output-xml' = TRUE,
  'wrap' = 200);
$tidy = tidy_parse_string($xml, $config, 'UTF8');
echo $tidy;
?
/textarea
/body
/html 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Stut

Richard Heyes wrote:

Because it's not user data, it's server data.


So? It's there - use it.


So are cookies, would you stuff this into a cookie? No, because that's 
not what cookies are there for.


Because it's there is never a good reason to do something.


That's entirely the wrong place to
store something like which database API is installed.


Not really. You could even wrap a function called (for example) 
Feature() around it.


Yeah, really.  Sessions are for user data. If it's the same for all 
users then it doesn't belong in the session, it belongs in a 
server-wide cache.



Sessions are for whatever you choose to put in them. And why implement a 
cache when you've got something perfectly usable (sessions) already?


You could potentially be pointlessly duplicating that data hundreds or 
thousands of times depending on how busy your site is. Also, in this 
particular example there is no need to cache that information beyond the 
request level because asking PHP for it is not an expensive operation, 
or at the very least is no more expensive than maintaining it in a session.


One other thing to note is that putting it in the session will survive a 
rebuild of PHP to add/remove modules and a restart of the web server. 
It's probably not likely to happen but that could seriously break your 
application.


However this is just my opinion. You're free to implement your 
application in whatever way you choose.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] A SESSION Problem

2007-12-11 Thread Cesar D. Rodas
Estrange problem.

On 11/12/2007, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 I just had this happen and wonder what the fix is for it.

 I am sending session data from a script in a http to another script
 in https. However, sometimes the data gets through and sometimes it
 don't.

 Any ideas or fixes?

 Both scripts are listed below


 [1]

 ?php session_start();
 $x = 'zzz';
 $_SESSION['x'] = $x;
 ?

 form action= https://example.com/a-session2.php; method=post
 input type=submit value=Proceed to Step 2
 /form


 [2]

 ?php session_start();
 print_r($_SESSION);
 ?

 form action=http://example.com/a-session1.php; method=post
 input type=submit value=Proceed back to Step 1
 /form


+  Are those pages in same hostname?

+  Have you test with other browsers?

+  The index of you $_SESSION (in this example x) is the same, the index
couldn't be a number or start with a number. This i learn by experience..
:-) i don't know where this point is documented.
+ $_SESSION[1] = wrong
+ $_SESSION[1a] = wrong

--
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List ( http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165


Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 15:25 +, Stut wrote:
 Richard Heyes wrote:
  Because it's not user data, it's server data.
  
  So? It's there - use it.
 
 So are cookies, would you stuff this into a cookie? No, because that's 
 not what cookies are there for.
 
 Because it's there is never a good reason to do something.
 
  That's entirely the wrong place to
  store something like which database API is installed.
 
  Not really. You could even wrap a function called (for example) 
  Feature() around it.
 
  Yeah, really.  Sessions are for user data. If it's the same for all 
  users then it doesn't belong in the session, it belongs in a 
  server-wide cache.
  
  
  Sessions are for whatever you choose to put in them. And why implement a 
  cache when you've got something perfectly usable (sessions) already?

Sre, sessions are for whatever you choose to put in them. That's
like saying bodies are for whatever a crazed murderer chooses to put in
them... the statement is true, but it's not optimal.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] LoadXML trouble

2007-12-11 Thread Dani Castaños



that is expected behavior.  some of the internal classes dont define
any member variables that the php language has access to.  obviously
they are storing data internally, said variables just arent accessible as
member variables of the class thats being defined.


Ok! Thank you for this info...

But then...
Why can i do this in Windows:
$xml-getElementsByTagName( 'ticketID' )-item( 0 )-nodeValue;

and not in Linux?

-- Xml example:
?xml version=1.0?
response
ticketID1197027955_8310/ticketID
statusOK/status
errCode200/errCode
errMsg/errMsg
/response

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] LoadXML trouble

2007-12-11 Thread Dani Castaños

Hi Nathan!

Thank you for all your help!
Problem has been fixed...

The thing is, when request is sent, there is a little difference in what 
i get... I get ?xml version=\1.0\ and so on...
These backslashes make the loadXML not load data properly... I've put an 
str_replace and the problem has been solved


Again... Thank you very much!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A SESSION Problem

2007-12-11 Thread GoWtHaM NaRiSiPaLli
Looks like the session Id is getting regenerated when it moves from http to
https. Check the cookie PHPSID cookie for your domain is same both the pages
and if not then you will have to carry forward the SID to every new page and
set SESSION_ID to that value and start the session.

Hope this works for you.

On Dec 11, 2007 9:10 PM, Cesar D. Rodas [EMAIL PROTECTED] wrote:

 Estrange problem.

 On 11/12/2007, tedd [EMAIL PROTECTED] wrote:
 
  Hi gang:
 
  I just had this happen and wonder what the fix is for it.
 
  I am sending session data from a script in a http to another script
  in https. However, sometimes the data gets through and sometimes it
  don't.
 
  Any ideas or fixes?
 
  Both scripts are listed below
 
 
  [1]
 
  ?php session_start();
  $x = 'zzz';
  $_SESSION['x'] = $x;
  ?
 
  form action= https://example.com/a-session2.php; method=post
  input type=submit value=Proceed to Step 2
  /form
 
 
  [2]
 
  ?php session_start();
  print_r($_SESSION);
  ?
 
  form action=http://example.com/a-session1.php; method=post
  input type=submit value=Proceed back to Step 1
  /form


 +  Are those pages in same hostname?

 +  Have you test with other browsers?

 +  The index of you $_SESSION (in this example x) is the same, the index
 couldn't be a number or start with a number. This i learn by experience..
 :-) i don't know where this point is documented.
+ $_SESSION[1] = wrong
+ $_SESSION[1a] = wrong

 --
  ---
  http://sperling.com  http://ancientstones.com  http://earthstones.com
 
  --
  PHP General Mailing List ( http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


 --
 Best Regards

 Cesar D. Rodas
 http://www.cesarodas.com
 http://www.thyphp.com
 http://www.phpajax.org
 Phone: +595-961-974165




-- 
Mark is on the way to make a Mark in your hearts

-
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=Z290aHNfMzE4OTg2NA%3D%3D


Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes

So? It's there - use it.


So are cookies, would you stuff this into a cookie? No, because that's 
not what cookies are there for.


Not because it's not what cookies are for - but because sessions are a 
more efficient and easier to use storage medium.


You could potentially be pointlessly duplicating that data hundreds or 
thousands of times depending on how busy your site is.


Well as always, if that's a concern then more thought would be required. 
But storage constraints are rarely a concern nowadays.


Also, in this 
particular example there is no need to cache that information beyond the 
request level because asking PHP for it is not an expensive operation, 
or at the very least is no more expensive than maintaining it in a session.


Granted.

One other thing to note is that putting it in the session will survive a 
rebuild of PHP to add/remove modules and a restart of the web server. 
It's probably not likely to happen but that could seriously break your 
application.


Then use the function directly.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes

Sre, sessions are for whatever you choose to put in them. That's
like saying bodies are for whatever a crazed murderer chooses to put in
them...


No it's not.

 the statement is true, but it's not optimal.

Real life is rarely optimal.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 16:31 +, Richard Heyes wrote:
  Sre, sessions are for whatever you choose to put in them. That's
  like saying bodies are for whatever a crazed murderer chooses to put in
  them...
 
 No it's not.

Yes it is. Neither is a good argument.

   the statement is true, but it's not optimal.
 
 Real life is rarely optimal.

That's not a valid excuse for taking the sloppy pig route to
development. Sloppy pig's give conscientious developers a bad name. And
when they use PHP to create their slop, they give PHP a bad name.

You would think you would lean towards conscientiousness since you use
an email address with phpguru in it. But I guess anyone can claim
whatever they want... it doesn't make it true. Maybe you could see if
phpsloppypig.org is available (it is btw).

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2007-12-11 Thread René Fournier
That makes sense, but I'm not sure I really want to do this, since  
it's fairly important that Listener continue listening without  
interruption.


I also don't think it's probably necessary, since from what I read,  
I'm not really pushing the envelope in terms of real load. Right now,  
I might have max ~250 clients connected, each sending 5-20 kb / day  
of data. It's not much data, nor many concurrent connections. If  
Jim's Listener handles 80-85k connections per day, then mine should  
be able to do 250 concurrently easily, and 2000 cumulative per day  
without a hitch.


Did I mention, I'm on Mac OS X Server 10.4.11? Shouldn't matter, but  
anyway.


On 10-Dec-07, at 5:48 PM, Jochem Maas wrote:


Jim Lucas wrote:

Tom Rogers wrote:

Hi,


...

Also, make sure you are not using an array that you are not re- 
initializing through each iteration
of the loop.  If the array keeps getting bigger, PHP might $*% on  
itself.  Always re-initialize

arrays to clean them up.


even then he may still have creeping memory ... in which it might  
be possible to have a mother process that
spawns and watchs a child process .. the child process is the  
actual deamon, the child could then keep a track
of it's own memory usage and then kill itself when it gets too  
big ... the mother in turn would automatically
spawn a new child deamon process upon seeing it's child has  
committed suicide.


does that make sense?

--
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



Re: [PHP] tidy memory corruption problem

2007-12-11 Thread Richard Lynch
Check for similar bugs here:
http://bugs.php.net

You may find that you have to upgrade something...

Just guessing, really, but PHP 5.1.x should probably be upgraded to
5.2.x anyway.

On Tue, December 11, 2007 9:13 am, Eric Wood wrote:
 My first attempt at leaning the tidy suite of functions has ran into a
 major
 snag

 I get this:

 *** glibc detected *** /usr/sbin/httpd: malloc(): memory corruption:
 0x81946e30

 whenever the tidy_parse_string() is called.

 I'm running the latest apache/php/tidy that FC6 has to offer...
 php-tidy-5.1.6-4.fc6
 libtidy-0.99.0-12.20070228.fc6.1

 Does the below code work on someone else's FC6 by chance?
 thanks,
 -eric wood




 The code is:

 html
 head
 titlePHP Tidy Test/title
 body
 ?
 $xml=EOX
 begin
 level1
 level2
 Text
 /level2
 /level1
 /begin
 EOX;
 ?
 textarea cols='80' rows='10'
 ?
 echo $xml;
 ?
 /textarea
 br/
 Becomes...
 br/
 textarea cols='80' rows='10'
 ?
 $config = array('indent' = TRUE,
'input-xml' = TRUE,
'output-xml' = TRUE,
'wrap' = 200);
 $tidy = tidy_parse_string($xml, $config, 'UTF8');
 echo $tidy;
 ?
 /textarea
 /body
 /html

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A SESSION Problem

2007-12-11 Thread Richard Lynch
On Tue, December 11, 2007 8:53 am, tedd wrote:
 Hi gang:

 I just had this happen and wonder what the fix is for it.

 I am sending session data from a script in a http to another script
 in https. However, sometimes the data gets through and sometimes it
 don't.

 Any ideas or fixes?

 Both scripts are listed below


 [1]

 ?php session_start();
 $x = 'zzz';
 $_SESSION['x'] = $x;
 ?

 form action=https://example.com/a-session2.php; method=post
 input type=submit value=Proceed to Step 2
 /form


 [2]

 ?php session_start();
 print_r($_SESSION);
 ?

 form action=http://example.com/a-session1.php; method=post
 input type=submit value=Proceed back to Step 1
 /form

Use FireFox and configure it to ALWAYS ask before accepting a cookie
and see when you are getting a new session or not.

If it happens sometimes perhaps you are running code that has or
hasn't changed the cookie parameters to allow the session ID to travel
over secure/insecure HTTP.

It's also possible that you have *another* session going in HTTPS
sometimes, so it only picks up the HTTP one when there isn't already
an active session from another application on HTTPS...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes

Real life is rarely optimal.


That's not a valid excuse for taking the sloppy pig route to
development. Sloppy pig's give conscientious developers a bad name. And
when they use PHP to create their slop, they give PHP a bad name.


Well I err towards actually doing something useful. Businesses can 
rarely wait while developers create a technically perfect application. 
Those that do are rarely successful. As always there's a balance to be 
struck between writing technically perfect code and getting the job done.



You would think you would lean towards conscientiousness since you use
an email address with phpguru in it. But I guess anyone can claim
whatever they want... it doesn't make it true. Maybe you could see if
phpsloppypig.org is available (it is btw).


Ah personal insults. Always a good argument.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Stut

Richard Heyes wrote:

Real life is rarely optimal.


That's not a valid excuse for taking the sloppy pig route to
development. Sloppy pig's give conscientious developers a bad name. And
when they use PHP to create their slop, they give PHP a bad name.


Well I err towards actually doing something useful. Businesses can 
rarely wait while developers create a technically perfect application. 
Those that do are rarely successful. As always there's a balance to be 
struck between writing technically perfect code and getting the job done.


I don't see a reason to compromise. It would take no longer to call 
extension_loaded on each page request than it will to put the variable 
in the session. You're right in saying that there's a balance to be 
struck, but in this particular case I personally see a right way and a 
wrong way and no compromise needed to do it properly.



You would think you would lean towards conscientiousness since you use
an email address with phpguru in it. But I guess anyone can claim
whatever they want... it doesn't make it true. Maybe you could see if
phpsloppypig.org is available (it is btw).


Ah personal insults. Always a good argument.


I couldn't care less what your domain name is, you're still advocating a 
poor choice IMHO.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Richard Lynch
Until today, there was a very nifty MIME Message Lint tool to check
your email message here:
http://www.apps.ietf.org/msglint.html

The homepage is now the default Apache install page though, and that
URL is 404.

I'm posting it in hopes that somebody knows a good similar tool and/or
that it will come back to life before you read this, or shortly
thereafter.

On Mon, December 10, 2007 10:33 pm, Me2resh Lists wrote:
 Dear All,

 i wrote this class below to send Mail. but when i use it. i get the
 sender
 No Body. and from the address of the server, not the From address that
 i
 specify. and the MIME Headers as text in the message itself. and the
 attachment is pasted as binary text also.
 can anyone help please ??

 here is the code :
 
 ?php

 $Mail = new MainClass();

 $Mail-Construct(Ahmed, [EMAIL PROTECTED], Test Mail,
 Hello,
 this is my first message);
 $Mail-AddTo([EMAIL PROTECTED], Ahmed);
 $Mail-AddCc([EMAIL PROTECTED], Me2resh);
 $Mail-AddBcc([EMAIL PROTECTED], hola);
 $Mail-AddAttach(favicon.ico);
 $Mail-SendMail();

 echo pre;
 print_r($Mail);

 /**
  *
  */
 class MainClass{

 /**
  *
  */

 var $To = ;
 var $Cc = ;
 var $Bcc = ;
 var $From = ;
 var $Name = ;
 var $Subject = ;
 var $Message = ;
 var $Headers = ;

 function Construct($name, $from, $subject, $message){
 //construct message
 if ($name == ){
 $name = $from;
 }
 $this-Name = $name;
 $this-From = $from;
 $this-Subject = $subject;
 $this-Message = $message;
 }//end of Construct


 function AddTo($email, $name){
 // add reciepnt to To array
 if ($name == ){
 $name = $email;
 }
 if ($this-To == ){
 $this-To .= $name.' '.$email.'';
 }else{
 $this-To .= ,.$name.' '.$email.'';
 }
 }// end of AddTo


 function AddCc($email, $name){
 // add reciepnt to Cc array
 if ($name == ){
 $name = $email;
 }
 if ($this-Cc == ){
 $this-Cc .= $name.' '.$email.'';
 }else{
 $this-Cc .= ,.$name.' '.$email.'';
 }
 }


 function AddBcc($email, $name){
 // add reciepnt to Bcc array
 if ($name == ){
 $name = $email;
 }
 if ($this-Bcc == ){
 $this-Bcc .= $name.' '.$email.'';
 }else{
 $this-Bcc .= ,.$name.' '.$email.'';
 }
 }

 function AddAttach($attach){
 //add attach to array
 //if (is_uploaded_file($attach)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($attach,'rb');
  $data = fread($file,filesize($attach));
  fclose($file);

 // Generate a boundary string
 $semi_rand = md5(time());
 $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

 // Add the headers for a file attachment
 $this-Headers .= \nMIME-Version: 1.0\n .
 Content-Type: multipart/mixed;\n .
  boundary=\{$mime_boundary}\;

 // Add a multipart boundary above the plain message
 $this-Message = This is a multi-part message in MIME
 format.\n\n .
--{$mime_boundary}\n .
Content-Type: text/plain;
 charset=\iso-8859-1\\n
 .
Content-Transfer-Encoding: 7bit\n\n .
$this-Message . \n\n;
 // Base64 encode the file data
  $data = chunk_split(base64_encode($data));
   // Add file attachment to the message
 $this-Message .= --{$mime_boundary}\n .
 Content-Type: {filetype($attach)};\n .
  name=\{$attach}\\n .
 Content-Disposition: attachment;\n .
  filename=\{$attach}\\n .
 Content-Transfer-Encoding: base64\n\n .
 $data . \n\n .
 --{$mime_boundary}--\n;
  //   }// end of if

 }// end of add attach

 function SendMail(){
 $this-Headers .= \r\n;
 $this-Headers .= 'To: '.$this-To.\r\n;
 $this-Headers .= 'From:
 '.$this-Name.''.$this-From.''.\r\n;
 $this-Headers .= 'Cc: '.$this-Cc.\r\n;
 $this-Headers .= 'Bcc: '.$this-Bcc.\r\n;
 mail($this-From, $this-Subject, $this-Message,
 $this-Headers);
 }
 }// end of class


 ?







 Here is the text in the email :

 

 MIME-Version: 1.0
 Content-Type: multipart/mixed;
  boundary===Multipart_Boundary_xd609c629ba34ecb645a7572abb61eb27x
 To: Ahmed [EMAIL PROTECTED]
 From: Ahmed[EMAIL PROTECTED]
 Cc: Me2resh [EMAIL PROTECTED]
 Bcc: hola [EMAIL PROTECTED]


 This is a 

Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Richard Heyes
I don't see a reason to compromise. It would take no longer to call 
extension_loaded on each page request than it will to put the variable 
in the session. You're right in saying that there's a balance to be 
struck, but in this particular case I personally see a right way and a 
wrong way and no compromise needed to do it properly.


I think the discussion has moved beyond extension_loaded(), but in 
that case, yes, personally I would use extension_loaded() directly. 
Probably in a factory type function which returns the appropriate type 
of object.


I couldn't care less what your domain name is, you're still advocating a 
poor choice IMHO.


Practical though. And I'm conscientious as far as business allows.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Richard Lynch
PS

GMail will not accept \r\n between header lines, only \n

I dunno if RFC822 specifies which ending but I *do* know that this
breaks the current PEAR mimePart.php code.

Editing the code to hack \r\n to just \n for the _CRLF constant works
for gmail, but may break other mail clients if \r\n is the RFC822
correct newline.

PPS
Is anybody else tired of this endless newline war between \n and \r\n?!

Can we just shoot anybody who doesn't accept either as valid?

On Mon, December 10, 2007 10:33 pm, Me2resh Lists wrote:
 Dear All,

 i wrote this class below to send Mail. but when i use it. i get the
 sender
 No Body. and from the address of the server, not the From address that
 i
 specify. and the MIME Headers as text in the message itself. and the
 attachment is pasted as binary text also.
 can anyone help please ??

 here is the code :
 
 ?php

 $Mail = new MainClass();

 $Mail-Construct(Ahmed, [EMAIL PROTECTED], Test Mail,
 Hello,
 this is my first message);
 $Mail-AddTo([EMAIL PROTECTED], Ahmed);
 $Mail-AddCc([EMAIL PROTECTED], Me2resh);
 $Mail-AddBcc([EMAIL PROTECTED], hola);
 $Mail-AddAttach(favicon.ico);
 $Mail-SendMail();

 echo pre;
 print_r($Mail);

 /**
  *
  */
 class MainClass{

 /**
  *
  */

 var $To = ;
 var $Cc = ;
 var $Bcc = ;
 var $From = ;
 var $Name = ;
 var $Subject = ;
 var $Message = ;
 var $Headers = ;

 function Construct($name, $from, $subject, $message){
 //construct message
 if ($name == ){
 $name = $from;
 }
 $this-Name = $name;
 $this-From = $from;
 $this-Subject = $subject;
 $this-Message = $message;
 }//end of Construct


 function AddTo($email, $name){
 // add reciepnt to To array
 if ($name == ){
 $name = $email;
 }
 if ($this-To == ){
 $this-To .= $name.' '.$email.'';
 }else{
 $this-To .= ,.$name.' '.$email.'';
 }
 }// end of AddTo


 function AddCc($email, $name){
 // add reciepnt to Cc array
 if ($name == ){
 $name = $email;
 }
 if ($this-Cc == ){
 $this-Cc .= $name.' '.$email.'';
 }else{
 $this-Cc .= ,.$name.' '.$email.'';
 }
 }


 function AddBcc($email, $name){
 // add reciepnt to Bcc array
 if ($name == ){
 $name = $email;
 }
 if ($this-Bcc == ){
 $this-Bcc .= $name.' '.$email.'';
 }else{
 $this-Bcc .= ,.$name.' '.$email.'';
 }
 }

 function AddAttach($attach){
 //add attach to array
 //if (is_uploaded_file($attach)) {
  // Read the file to be attached ('rb' = read binary)
  $file = fopen($attach,'rb');
  $data = fread($file,filesize($attach));
  fclose($file);

 // Generate a boundary string
 $semi_rand = md5(time());
 $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

 // Add the headers for a file attachment
 $this-Headers .= \nMIME-Version: 1.0\n .
 Content-Type: multipart/mixed;\n .
  boundary=\{$mime_boundary}\;

 // Add a multipart boundary above the plain message
 $this-Message = This is a multi-part message in MIME
 format.\n\n .
--{$mime_boundary}\n .
Content-Type: text/plain;
 charset=\iso-8859-1\\n
 .
Content-Transfer-Encoding: 7bit\n\n .
$this-Message . \n\n;
 // Base64 encode the file data
  $data = chunk_split(base64_encode($data));
   // Add file attachment to the message
 $this-Message .= --{$mime_boundary}\n .
 Content-Type: {filetype($attach)};\n .
  name=\{$attach}\\n .
 Content-Disposition: attachment;\n .
  filename=\{$attach}\\n .
 Content-Transfer-Encoding: base64\n\n .
 $data . \n\n .
 --{$mime_boundary}--\n;
  //   }// end of if

 }// end of add attach

 function SendMail(){
 $this-Headers .= \r\n;
 $this-Headers .= 'To: '.$this-To.\r\n;
 $this-Headers .= 'From:
 '.$this-Name.''.$this-From.''.\r\n;
 $this-Headers .= 'Cc: '.$this-Cc.\r\n;
 $this-Headers .= 'Bcc: '.$this-Bcc.\r\n;
 mail($this-From, $this-Subject, $this-Message,
 $this-Headers);
 }
 }// end of class


 ?







 Here is the text in the email :

 

 MIME-Version: 1.0
 Content-Type: multipart/mixed;
  boundary===Multipart_Boundary_xd609c629ba34ecb645a7572abb61eb27x
 To: Ahmed [EMAIL PROTECTED]
 

Re: [PHP] shared memory access - shmod_open

2007-12-11 Thread Rolf_

I tried the php function chmod($sem, 0644) which works fine even if it
converts the octal number too, cf. xdebug trace file:

  0.0037  50280 - chmod('/tmp/1521387531.sem', 420)
...myScripts/test.php:11
   = TRUE
  0.0039  50280 - shmop_open(2013277949, 'c', 420, 1)
...myScripts/test.php:15
   = FALSE
 
So I think there must be something else wrong with my shmop_open. I also
tried shmop_open($sem_key, c, 0644, 1) and shmop_open($sem_key, c,
420, 1), which doesn´t work either. 

Thank you for your help,
Rolf.







Peter Ford-4 wrote:
 
 Richard Lynch wrote:
 On Thu, December 6, 2007 2:44 am, Rolf_ wrote:
 I have a problem working with shmop_open() in a Solaris environment.
 The
 following cli-script works fine, except shmod_open returns a warning
 'unable
 to attach or create shared memory segment':

 ?php
 $sem = /tmp/ . rand() . .sem;
 touch ($sem);
 echo sem $sem \n;

 $sem_key = ftok($sem, 'w');
 echo sem_key $sem_key \n;

 if ($sem_key == -1) { die (ftok error); }

 $shm_id = shmop_open($sem_key, w, 0644, 1);
 echo shm_id $shm_id\n;
 ?

 I checked the $sem_key with the Solaris ipcs command. The file exists
 and
 the read/write rights are correct. I tried explictly to call
 shmop_open with
 the right key - the error message remains the same.

 Checking out different access mode like r does not succeed too. In
 the
 Xdebug output, php changes the value 0644 to 420, i.e.
 shmop_open(1258300033, 'w', 420, 1). Of course, I compiled php with
 --enable-shmop.

 Does anyone has an idea what I might also check?
 
 Perhaps the 0644 needs to be expressed in some other way?
 
 I know it works fine that way for chmod and friends, so I wouldn't
 expect it, but...
 
 Or maybe 420 *IS* the right value, and you're on a red herring.
 
 Try Googling for the error message and Solaris if you haven't done
 that yet.
 
 
 The problem is that 0644 == 420, because 0644 is parsed as 644 base 8
 (the
 zero prefix forces the number to octal...)
 So 420 (decimal) is actually the correct value. RTFM for chmod, which
 gives you
 a big hint about this...
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/shared-memory-access---shmod_open-tp14188465p14278683.html
Sent from the PHP - General mailing list archive at Nabble.com.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Per Jessen
Stut wrote:

 I couldn't care less what your domain name is, you're still advocating
 a poor choice IMHO.
 

I have been trying hard not to join this thread, but ... apart from the
principle, what's _really_ so poor about it?  Having to write
application code that needs to work with two different APIs is poor
enough, using a session variable for keeping a status won't make it
much worse.  So what if the status is server-scope, yet kept in
user-scope.  In particular if the app already uses session storage.



/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] sftp connecting to remove server via php

2007-12-11 Thread blackwater dev
I have to write a script that will connect to a remove server using sftp and
pull in specific files for processing.  Currently I can get to the server by
just using sftp [EMAIL PROTECTED]  How can I open these files via php?  Is the
only way to use fopen with the PECL sftp, ssh2 modules?

Thanks!


RE: [PHP] sftp connecting to remove server via php

2007-12-11 Thread Jay Blanchard
[snip]
I have to write a script that will connect to a remove server using sftp
and
pull in specific files for processing.  Currently I can get to the
server by
just using sftp [EMAIL PROTECTED]  How can I open these files via php?  Is
the
only way to use fopen with the PECL sftp, ssh2 modules?
[/snip]

http://www.php.net/ftp
http://www.php.net/ftp_get

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sftp connecting to remove server via php

2007-12-11 Thread Jay Blanchard
[snip]
Yes but will these handle sftp?  I have a key on the other server so don't need 
a password.
[/snip]

http://us.php.net/manual/en/function.ftp-ssl-connect.php

always reply to all so the mail gets back on the list

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sftp connecting to remove server via php

2007-12-11 Thread blackwater dev
Sorry, thanks for the info!

On Dec 11, 2007 3:26 PM, Jay Blanchard [EMAIL PROTECTED] wrote:

 [snip]
 Yes but will these handle sftp? I have a key on the other server so don't
 need a password.
 [/snip]

 http://us.php.net/manual/en/function.ftp-ssl-connect.php

 always reply to all so the mail gets back on the list



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 17:01 +, Richard Heyes wrote:
  Real life is rarely optimal.
  
  That's not a valid excuse for taking the sloppy pig route to
  development. Sloppy pig's give conscientious developers a bad name. And
  when they use PHP to create their slop, they give PHP a bad name.
 
 Well I err towards actually doing something useful. Businesses can 
 rarely wait while developers create a technically perfect application. 
 Those that do are rarely successful. As always there's a balance to be 
 struck between writing technically perfect code and getting the job done.
 
  You would think you would lean towards conscientiousness since you use
  an email address with phpguru in it. But I guess anyone can claim
  whatever they want... it doesn't make it true. Maybe you could see if
  phpsloppypig.org is available (it is btw).
 
 Ah personal insults. Always a good argument.

It was just a suggestion... if you take it as an insult perhaps it hit a
chord.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 18:14 +0100, Per Jessen wrote:
 Stut wrote:
 
  I couldn't care less what your domain name is, you're still advocating
  a poor choice IMHO.
  
 
 I have been trying hard not to join this thread, but ... apart from the
 principle, what's _really_ so poor about it?  Having to write
 application code that needs to work with two different APIs is poor
 enough, using a session variable for keeping a status won't make it
 much worse.  So what if the status is server-scope, yet kept in
 user-scope.  In particular if the app already uses session storage.

It's bad because it places data in a storage area not related to the
kind of configuration being tracked. Sessions are for managing user and
user related data. This particular value is related to the server in
general. It places a large WTF factor on the code for anyone down the
road maintaining it. It may be true that nobody else will ever manage
this code, but it's unlikely. I absolutely agree with you though, the
whole design is off. The best way to do this IMHO is to use a singleton
class that only loads the appropriate library type. Then the interface
would be generic and no extension switching would occur once the library
is loaded. Functional equivalents can be used to facilitate the same
design pattern as the singleton... such as a stub library containing one
function:

File: db.stub.php
?

function getConnection( $dbConnectionParams )
{
if( extension_loaded( 'mysqli' ) )
{
require_once( 'db.layer.mysql.php' );
}
else
if( extension_loaded( 'mysql' ) )
{
require_once( 'db.layer.mysqli.php' );
}
else
{
die( 'No appropriate database library installed' );
}
}

?

Then only the necessary code would be loaded and all db function (or
method) requests would execute only the appropriate code without
run-time switching. This is not only fairly optimal, but simpler,
cleaner, and much more maintainable.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Andrew Ballard
On Dec 11, 2007 12:20 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 PS

 GMail will not accept \r\n between header lines, only \n

 I dunno if RFC822 specifies which ending but I *do* know that this
 breaks the current PEAR mimePart.php code.

 Editing the code to hack \r\n to just \n for the _CRLF constant works
 for gmail, but may break other mail clients if \r\n is the RFC822
 correct newline.

 PPS
 Is anybody else tired of this endless newline war between \n and \r\n?!

 Can we just shoot anybody who doesn't accept either as valid?


As far as RFC822 is concerned:

 3.1.2.  STRUCTURE OF HEADER FIELDS

Once a field has been unfolded, it may be viewed as being com-
posed of a field-name followed by a colon (:), followed by a
field-body, and  terminated  by  a  carriage-return/line-feed.
The  field-name must be composed of printable ASCII characters
(i.e., characters that  have  values  between  33.  and  126.,
decimal, except colon).  The field-body may be composed of any
ASCII characters, except CR or LF.  (While CR and/or LF may be
present  in the actual text, they are removed by the action of
unfolding the field.)

and later...

 3.2.  HEADER FIELD DEFINITIONS

  These rules show a field meta-syntax, without regard for the
 particular  type  or internal syntax.  Their purpose is to permit
 detection of fields; also, they present to  higher-level  parsers
 an image of each field as fitting on one line.

 field   =  field-name : [ field-body ] CRLF


(http://www.faqs.org/rfcs/rfc822.html)

That said, I can't recall having problems with a simple \n, but I
usually stick to \r\n for mail headers.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2007-12-11 Thread Per Jessen
René Fournier wrote:

 However, the number of socket clients connecting in the past 3-4
 months has steadily increased, and this seems to have exposed (if not
 created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45
 and/or Mac OS X Server 10.4.11. (I say and/or because I am unsure
 where the problem's cause really lies.) Basically, after the script
 has been running for a day or so (processing essentially the amount
 data that used to take two weeks), the CPU usage of the machine goes
 from 30% (normal) to 80-90%. 

Have you tried stracing it to see what's really happening when the load
goes that high?


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Jochem Maas
heh Richard! long time no see, guess you had withdrawal symtoms or you
managed to bust out of whatever compound they were holding you in ;-) ...

Richard Lynch wrote:
 PS
 
 GMail will not accept \r\n between header lines, only \n
 
 I dunno if RFC822 specifies which ending but I *do* know that this
 breaks the current PEAR mimePart.php code.
 
 Editing the code to hack \r\n to just \n for the _CRLF constant works
 for gmail, but may break other mail clients if \r\n is the RFC822
 correct newline.

I've never bothered with \r\n and with the exception of opening
stuff in notepad I've never had any problem is an email context or
otherwise ... at least it's never been brought to my intention which
is good enough for me :-)

 
 PPS
 Is anybody else tired of this endless newline war between \n and \r\n?!
 
 Can we just shoot anybody who doesn't accept either as valid?
 

no, it's a waste of good ammo. use a baseball bat or something.
that's problem with kids these days no idea of the cost of things ... I wonder
if that's the reason *doze went with the extra byte \r entails?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Bug in stream_socket_server()?

2007-12-11 Thread René Fournier
If you want a high speed socket server, use the low-level sockets  
instead (socket_create/bind/listen). The stream_socket_server version  
appears to have internal fixed 8k buffers that will overflow if you  
don't keep up by reading.


This is a serious problem if you an application that reads the socket  
for messages and then, say, saves the result in a database. The delay  
while it is busy processing means you can't read the data in time  
unless you get involved in muti-threading.


With the the low-level functions, the OS quietly buffers TCP/IP  
packets so there is no problem (tested on Windows XP Professional).


( http://php.oregonstate.edu/manual/en/function.stream-socket- 
server.php#67837 )



Has anyone confirmed this? I am doing tests with a stripped-down  
multi-client socket server, wonder if this issue is causing some of  
the problems I've seen.


...Rene

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 22:11 +0100, Per Jessen wrote:
 Robert Cummings wrote:
 
  On Tue, 2007-12-11 at 18:14 +0100, Per Jessen wrote:
  I have been trying hard not to join this thread, but ... apart from
  the principle, what's _really_ so poor about it?  Having to write
  application code that needs to work with two different APIs is poor
  enough, using a session variable for keeping a status won't make it
  much worse.  So what if the status is server-scope, yet kept in
  user-scope.  In particular if the app already uses session storage.
  
  It's bad because it places data in a storage area not related to the
  kind of configuration being tracked. Sessions are for managing user
  and user related data. This particular value is related to the server
  in general. It places a large WTF factor on the code for anyone down
  the road maintaining it. 
 
 Possibly, but nothing that a single line comment won't explain.  Making
 a potentially poor decision is bad, but explaining why takes most of
 the sting out of it.
 
  It may be true that nobody else will ever 
  manage this code, but it's unlikely. I absolutely agree with you
  though, the whole design is off. The best way to do this IMHO is to
  use a singleton class that only loads the appropriate library type.
 
 I can't remember what sort of environment the OP was in, but if any sort
 of organised testing is done, the use of two different APIs will just
 about double the test-effort.  Which is why I still think the best
 option is to mandate _one_ of the APIs and choose your hoster
 accordingly.

Well if you write unit tests, having the unit tests applied to one or
the other is the same amount of work since it just requires a switch to
change between mysql and mysqli.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2007-12-11 Thread Jochem Maas
Per Jessen wrote:
 René Fournier wrote:
 
 However, the number of socket clients connecting in the past 3-4
 months has steadily increased, and this seems to have exposed (if not
 created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45
 and/or Mac OS X Server 10.4.11. (I say and/or because I am unsure
 where the problem's cause really lies.) Basically, after the script
 has been running for a day or so (processing essentially the amount
 data that used to take two weeks), the CPU usage of the machine goes
 from 30% (normal) to 80-90%. 
 
 Have you tried stracing it to see what's really happening when the load
 goes that high?

am I correct that that would be done like so?:

strace -p process id of php deamon

Im a little new to this kind of coolness, I found this page which is very 
helpful:

http://www.ibm.com/developerworks/aix/library/au-unix-strace.html

I was going to suggest using gdb to figure what the process is doing but 
figured it
wouldn't be handy to have the deamon running via gdb for 48 hours ... silly me 
didn't
grok that you can attach to an existing process (something that ibm article 
made clear
to me)

can't wait till my macbook arrives so that I can start to play with this kind of
stuff locally ... aka another excuse to justify the aluminium beast ;-)

 
 
 /Per Jessen, Zürich
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Nathan Nobbe
On Dec 11, 2007 4:11 PM, Per Jessen [EMAIL PROTECTED] wrote:

 I can't remember what sort of environment the OP was in, but if any sort
 of organised testing is done, the use of two different APIs will just
 about double the test-effort.  Which is why I still think the best
 option is to mandate _one_ of the APIs and choose your hoster
 accordingly.


ideally there should be an abstraction layer.  beneath it either mysql or
mysqli would work.  this is the nature of any respectable database layer.
it prevents a need to modify stable client code (written against the
abstraction layer) when you have to switch the underlying database client.

-nathan


Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Per Jessen
Robert Cummings wrote:

 On Tue, 2007-12-11 at 18:14 +0100, Per Jessen wrote:
 I have been trying hard not to join this thread, but ... apart from
 the principle, what's _really_ so poor about it?  Having to write
 application code that needs to work with two different APIs is poor
 enough, using a session variable for keeping a status won't make it
 much worse.  So what if the status is server-scope, yet kept in
 user-scope.  In particular if the app already uses session storage.
 
 It's bad because it places data in a storage area not related to the
 kind of configuration being tracked. Sessions are for managing user
 and user related data. This particular value is related to the server
 in general. It places a large WTF factor on the code for anyone down
 the road maintaining it. 

Possibly, but nothing that a single line comment won't explain.  Making
a potentially poor decision is bad, but explaining why takes most of
the sting out of it.

 It may be true that nobody else will ever 
 manage this code, but it's unlikely. I absolutely agree with you
 though, the whole design is off. The best way to do this IMHO is to
 use a singleton class that only loads the appropriate library type.

I can't remember what sort of environment the OP was in, but if any sort
of organised testing is done, the use of two different APIs will just
about double the test-effort.  Which is why I still think the best
option is to mandate _one_ of the APIs and choose your hoster
accordingly. 



/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] LoadXML trouble

2007-12-11 Thread Jochem Maas
Dani Castaños wrote:
 Hi Nathan!
 
 Thank you for all your help!
 Problem has been fixed...
 
 The thing is, when request is sent, there is a little difference in what
 i get... I get ?xml version=\1.0\ and so on...
 These backslashes make the loadXML not load data properly... I've put an
 str_replace and the problem has been solved

ah, that will be this:

http://php.net/manual/en/ref.info.php#ini.magic-quotes-gpc

you have just learned to carefully study the differences between dev and 
production
php.ini settings (e.g. via phpinfo()) when you run into these kind of problems 
:-)

 
 Again... Thank you very much!
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: running cmd via php

2007-12-11 Thread Dan
First off I must ask, why do you need to run windows commands when you don't 
even know how to use a PHP function.  First thing taht came to my mind was 
some kind thought, woah, I'm gona learn to hack I'm gona be a leet haxor. 
In the case I'm wrong, sorry, and also you might want to know that exec 
doesn't always work some hosts have it turned off for obvious security 
reasons, also there's other alternatives other than exec such as shell_exec 
I think that's the name, etc although that's for Linux which can do a lot of 
the stuff that Windows can also.


- Dan

adam_99 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hello!
I'm trying a lot to find how I can run the cmd (command line of windows) 
and send to the cmd commands?
Thanks. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Bug in stream_socket_server()?

2007-12-11 Thread Nathan Rixham

Would this class as a test?

?php
$socket = stream_socket_server(tcp://0.0.0.0:8000, $errno, $errstr);
if (!$socket) {
echo $errstr ($errno)br /\n;
} else {
while (is_resource($conn = stream_socket_accept($socket, 30))) {
while (is_resource($conn)  $pkt = stream_get_line($conn, 100, \n)) {
fwrite($conn, '');
sleep(10);
echo $pkt;
}
}
}
?

I then sent 2*384kb loads per second through a terminal to it without 
problems, 10 minutes since i stopped writing data to it and it's still 
echoing out 1 line every 10 secs!


Nathan

René Fournier wrote:
If you want a high speed socket server, use the low-level sockets 
instead (socket_create/bind/listen). The stream_socket_server version 
appears to have internal fixed 8k buffers that will overflow if you 
don't keep up by reading.


This is a serious problem if you an application that reads the socket 
for messages and then, say, saves the result in a database. The delay 
while it is busy processing means you can't read the data in time unless 
you get involved in muti-threading.


With the the low-level functions, the OS quietly buffers TCP/IP packets 
so there is no problem (tested on Windows XP Professional).


( 
http://php.oregonstate.edu/manual/en/function.stream-socket-server.php#67837 
)



Has anyone confirmed this? I am doing tests with a stripped-down 
multi-client socket server, wonder if this issue is causing some of the 
problems I've seen.


...Rene


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help Sending Mail

2007-12-11 Thread Daniel Brown
On Dec 11, 2007 12:20 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 I dunno if RFC822 specifies which ending but I *do* know that this
 breaks the current PEAR mimePart.php code.

RFC 822 has been obsolete since RFC 2822 was introduced in 2001.

We (that is, myself and other members of the IETF) are working on
a new BIS/Draft for a new RFC that will revise (obsolete certain parts
of) 822 and 2822.  However, it's already been mentioned that headers
should remain as standardized in 2822 (which I think will most likely
be the case).

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Daniel Brown
On Dec 11, 2007 5:10 PM, Dan [EMAIL PROTECTED] wrote:
 First off I must ask, why do you need to run windows commands when you don't
 even know how to use a PHP function.  First thing taht came to my mind was
 some kind thought, woah, I'm gona learn to hack I'm gona be a leet haxor.

That's 1337 h4x0R.

 In the case I'm wrong, sorry, and also you might want to know that exec
 doesn't always work some hosts have it turned off for obvious security
 reasons, also there's other alternatives other than exec such as shell_exec
 I think that's the name, etc although that's for Linux which can do a lot of
 the stuff that Windows can also.

 only better!  ;-P


-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: running cmd via php

2007-12-11 Thread Dan
First off I must ask, why do you need to run windows commands when you don't 
even know how to use a PHP function.  First thing taht came to my mind was 
some kind thought, woah, I'm gona learn to hack I'm gona be a leet haxor. 
In the case I'm wrong, sorry, and also you might want to know that exec 
doesn't always work some hosts have it turned off for obvious security 
reasons, also there's other alternatives other than exec such as shell_exec 
I think that's the name, etc although that's for Linux which can do a lot of 
the stuff that Windows can also.


- Dan

adam_99 [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hello!
I'm trying a lot to find how I can run the cmd (command line of windows) 
and send to the cmd commands?
Thanks. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Pushing the limits of stream_socket_server() and stream_select()

2007-12-11 Thread René Fournier
Just curious what people found the limits to be with  
stream_socket_server(), in terms of maximum concurrent connections,  
packet sizes, etc. I'm am presently stress-testing a multi-client  
socket server and am finding I can sometimes break it with as few as  
100 concurrent connections, and always break it with [precisely] 252  
connections--with a variety of errors getting thrown:


Client-side (100 connections, sometimes):
	PHP Warning:  stream_socket_client(): unable to connect to tcp:// 
192.168.0.41: (Operation timed out) in /Tuning/client.php on line 3
	PHP Notice:  fwrite(): send of 68 bytes failed with errno=32 Broken  
pipe in /Tuning/client.php on line 14


Server-side error ( 252+ connections, every time):
	PHP Warning:  stream_select(): supplied argument is not a valid  
stream resource in /Tuning/server.php on line 15


Interestingly, the above server-side error only occurs when 252  
clients are connected. At 251, it's okay. At 252, it generates the  
above PHP Warning. (Which really is strange. Anyone have any ideas?)


If anyone is interested, I will post the sample code I'm using, in  
case--perish the thought--the problem is self-inflicted. :-)


...Rene

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Chris

Dan wrote:
First off I must ask, why do you need to run windows commands when you 
don't even know how to use a PHP function.


That's a pretty extreme response - maybe the OP forgot the function name 
or didn't know it in the first place.


There is a lot of stuff in php and there's no way anyone will remember 
every part of it.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Pushing the limits of stream_socket_server() and stream_select()

2007-12-11 Thread René Fournier

On 11-Dec-07, at 4:32 PM, René Fournier wrote:

Just curious what people found the limits to be with  
stream_socket_server(), in terms of maximum concurrent connections,  
packet sizes, etc. I'm am presently stress-testing a multi-client  
socket server and am finding I can sometimes break it with as few  
as 100 concurrent connections, and always break it with [precisely]  
252 connections--with a variety of errors getting thrown:


Client-side (100 connections, sometimes):
	PHP Warning:  stream_socket_client(): unable to connect to tcp:// 
192.168.0.41: (Operation timed out) in /Tuning/client.php on  
line 3
	PHP Notice:  fwrite(): send of 68 bytes failed with errno=32  
Broken pipe in /Tuning/client.php on line 14


Server-side error ( 252+ connections, every time):
	PHP Warning:  stream_select(): supplied argument is not a valid  
stream resource in /Tuning/server.php on line 15


Interestingly, this 251 connection limit does not appear to be  
obviously system-related (I am running Mac OS X 10.4.11). I can run  
two instances of server.php and have each client.php spawn 175  
connections (350 total concurrent to the machine), with no problem.


Interestingly, the above server-side error only occurs when 252  
clients are connected. At 251, it's okay. At 252, it generates the  
above PHP Warning. (Which really is strange. Anyone have any ideas?)


If anyone is interested, I will post the sample code I'm using, in  
case--perish the thought--the problem is self-inflicted. :-)


...Rene



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Mac OS X Server limits... was [PHP] Pushing the limits of stream_socket_server() and stream_select()

2007-12-11 Thread René Fournier
OK, having done more digging, this bizarre 251-255 connections per  
socket limit seems to be an OS X thing. (Linux people, any comments?)  
At least that's I've read: http://www.macgeekery.com/tips/ 
configuration/mac_os_x_network_tuning_guide_revisited#comment-1433


So... Do any Mac OS  X gurus out there know how to increase OS X  
Server's (10.4.11) maximum connections per socket value? There seems  
to no such setting in sysctl or ulimit. Any ideas? Anyone? Anyone?


...Rene

On 11-Dec-07, at 4:55 PM, René Fournier wrote:


On 11-Dec-07, at 4:32 PM, René Fournier wrote:

Just curious what people found the limits to be with  
stream_socket_server(), in terms of maximum concurrent  
connections, packet sizes, etc. I'm am presently stress-testing a  
multi-client socket server and am finding I can sometimes break it  
with as few as 100 concurrent connections, and always break it  
with [precisely] 252 connections--with a variety of errors getting  
thrown:


Client-side (100 connections, sometimes):
	PHP Warning:  stream_socket_client(): unable to connect to tcp:// 
192.168.0.41: (Operation timed out) in /Tuning/client.php on  
line 3
	PHP Notice:  fwrite(): send of 68 bytes failed with errno=32  
Broken pipe in /Tuning/client.php on line 14


Server-side error ( 252+ connections, every time):
	PHP Warning:  stream_select(): supplied argument is not a valid  
stream resource in /Tuning/server.php on line 15


Interestingly, this 251 connection limit does not appear to be  
obviously system-related (I am running Mac OS X 10.4.11). I can run  
two instances of server.php and have each client.php spawn 175  
connections (350 total concurrent to the machine), with no problem.


Interestingly, the above server-side error only occurs when 252  
clients are connected. At 251, it's okay. At 252, it generates the  
above PHP Warning. (Which really is strange. Anyone have any ideas?)


If anyone is interested, I will post the sample code I'm using, in  
case--perish the thought--the problem is self-inflicted. :-)


...Rene



--
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



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Jochem Maas
Chris wrote:
 Dan wrote:
 First off I must ask, why do you need to run windows commands when you
 don't even know how to use a PHP function.
 
 That's a pretty extreme response - 

maybe he's an extreme programmer :-P

 maybe the OP forgot the function name
 or didn't know it in the first place.
 
 There is a lot of stuff in php and there's no way anyone will remember
 every part of it.

let's not forget the place you learned the command in the first place?!?!

manual meet the new guy, new guy meet the manual -
may you have many beautiful children together.

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Chris

Jochem Maas wrote:

Chris wrote:

Dan wrote:

First off I must ask, why do you need to run windows commands when you
don't even know how to use a PHP function.
That's a pretty extreme response - 


maybe he's an extreme programmer :-P


maybe the OP forgot the function name
or didn't know it in the first place.

There is a lot of stuff in php and there's no way anyone will remember
every part of it.


let's not forget the place you learned the command in the first place?!?!

manual meet the new guy, new guy meet the manual -
may you have many beautiful children together.


Doesn't help if you don't know what to look for in the first place :)

I'm all for rtfm type responses but if you're not sure what category to 
start looking in how does it help? Don't tell me you'd scan the 189 
categories for lack of a better term (taken from 
http://www.php.net/manual/en/funcref.php) to look for a particular fn 
that you don't know the name of let alone which area it belongs in.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Jochem Maas
Chris wrote:
 Jochem Maas wrote:
 Chris wrote:
 Dan wrote:
 First off I must ask, why do you need to run windows commands when you
 don't even know how to use a PHP function.
 That's a pretty extreme response - 

 maybe he's an extreme programmer :-P

 maybe the OP forgot the function name
 or didn't know it in the first place.

 There is a lot of stuff in php and there's no way anyone will remember
 every part of it.

 let's not forget the place you learned the command in the first place?!?!

 manual meet the new guy, new guy meet the manual -
 may you have many beautiful children together.
 
 Doesn't help if you don't know what to look for in the first place :)
 
 I'm all for rtfm type responses but if you're not sure what category to
 start looking in how does it help? Don't tell me you'd scan the 189
 categories for lack of a better term (taken from
 http://www.php.net/manual/en/funcref.php) to look for a particular fn
 that you don't know the name of let alone which area it belongs in.\

it's all moot - the OP got his answer way back when - but ...
a manual is a book. we all know how to read a book, if you have no idea how
to do anything with php shouldn't be your responsibility to read the man
front to back ... at least perusing each major section to get a feel of it.
jmho
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Stephen Johnson


On 12/11/07 6:02 PM, Chris [EMAIL PROTECTED] wrote:

 Jochem Maas wrote:
 Chris wrote:
 Dan wrote:
 First off I must ask, why do you need to run windows commands when you
 don't even know how to use a PHP function.
 That's a pretty extreme response -
 
 maybe he's an extreme programmer :-P
 
 maybe the OP forgot the function name
 or didn't know it in the first place.
 
 There is a lot of stuff in php and there's no way anyone will remember
 every part of it.
 
 let's not forget the place you learned the command in the first place?!?!
 
 manual meet the new guy, new guy meet the manual -
 may you have many beautiful children together.
 
 Doesn't help if you don't know what to look for in the first place :)
 
 I'm all for rtfm type responses but if you're not sure what category to
 start looking in how does it help? Don't tell me you'd scan the 189
 categories for lack of a better term (taken from
 http://www.php.net/manual/en/funcref.php) to look for a particular fn
 that you don't know the name of let alone which area it belongs in.

OK then how about a STFW answer...

Google : php exexcute windows commands

You can even hit the I'm feeling lucky button. ;)

-- 
Stephen Johnson
The Lone Coder

http://www.ouradoptionblog.com
*Join us on our adoption journey*

[EMAIL PROTECTED]
http://www.thelonecoder.com

*Continuing the struggle against bad code*
--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: running cmd via php

2007-12-11 Thread Chris



OK then how about a STFW answer...

Google : php exexcute windows commands


I'm not sure what that particular phrase would produce ;) (surprisingly 
- a few answers :P).


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysqli support - test or complain? [SOLVED]

2007-12-11 Thread Larry Garfield
On Tuesday 11 December 2007, Per Jessen wrote:
 Stut wrote:
  I couldn't care less what your domain name is, you're still advocating
  a poor choice IMHO.

 I have been trying hard not to join this thread, but ... apart from the
 principle, what's _really_ so poor about it?  Having to write
 application code that needs to work with two different APIs is poor
 enough, using a session variable for keeping a status won't make it
 much worse.  So what if the status is server-scope, yet kept in
 user-scope.  In particular if the app already uses session storage.

Are you saying there's something wrong with doing something non-stupid on 
principle?  Any employer that wants me to cut even small corners like that 
to do something sloppy to save the 10 seconds it would take to do it right 
can find a new programmer, thank you.  (The market is good enough that you 
can say that, if you're good enough.)  You could also make every property of 
an object public, or always use an input/output parameter to a function 
instead of a return.  They would all work.  That doesn't mean any of those 
aren't dumb.

For all those suggesting that adding an if() check is better than caching it 
to the session, you're right.  It's also still less than optimal.

You have a database config file somewhere that stores your database 
credentials.  Put which DB driver to use in there.  It's not like it's going 
to change, and you have to edit that file anyway to install the app.  It's 
part of the database configuration.  Most of the open source systems I've 
seen do that in some form or another.  And if you don't know what driver you 
have on your system, it's not like it's hard to try one, watch it die, and 
then use the other. :-)

How did this get so complicated?

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to install ISAPI version on Vista IIS 6

2007-12-11 Thread SED
Hello,

 

I'm running Vista Ultimate on my computer with IIS 6.0.

 

I'm trying to manually install PHP 5 (ISAPI) on IIS but in the Handler
mappings I get this message:

 

One or more of the modules specified for this handler does not exist in the
modules list. If you are trying to add a script map the IsapiModule or the
CgiModule is not prensent in the modules list.

 

I have Googled this but did not find any answers. Even on php.net there is
no mention on Vista.

 

Can you point me to guidance for installing PHP 5 on Vista running IIS 6.0?

 

Regards,

SED

 

 

 

 



RE: [PHP] How to install ISAPI version on Vista IIS 6

2007-12-11 Thread Andrés Robinet
 -Original Message-
 From: SED [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 12, 2007 12:25 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to install ISAPI version on Vista IIS 6
 
 Hello,
 
 
 
 I'm running Vista Ultimate on my computer with IIS 6.0.
 
 
 
 I'm trying to manually install PHP 5 (ISAPI) on IIS but in the Handler
 mappings I get this message:
 
 
 
 One or more of the modules specified for this handler does not exist
 in the
 modules list. If you are trying to add a script map the IsapiModule or
 the
 CgiModule is not prensent in the modules list.
 
 
 
 I have Googled this but did not find any answers. Even on php.net there
 is
 no mention on Vista.
 
 
 
 Can you point me to guidance for installing PHP 5 on Vista running IIS
 6.0?
 
 
 
 Regards,
 
 SED
 

Hope you don't get offended but... check http://www.apple.com/getamac/ads/
(the last one choose a vista is very instructive).
I've never had a Mac, but I've laughed a lot... and I'm every day thinking
more and more certain of not upgrading my XP. Hope you smile at least for 30
seconds. :)

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308
| TEL 954-607-4207 | FAX 954-337-2695
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
bestplace |  Web: http://www.bestplace.biz | Web: http://www.seo-diy.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to install ISAPI version on Vista IIS 6

2007-12-11 Thread SED
Hi Rob,

I'm not offended, I'm pistoff with Microsoft. Paying so much for VISTA and
so many troubles and so litle support...  I have other computers running
various others systems but I need to solve this case.

Your comment, only makes me smile, over how stupid I was to pay for Vista.

Regards,
SED

-Original Message-
From: Andrés Robinet [mailto:[EMAIL PROTECTED] 
Sent: 12. desember 2007 04:08
To: php-general@lists.php.net
Subject: RE: [PHP] How to install ISAPI version on Vista IIS 6

 -Original Message-
 From: SED [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 12, 2007 12:25 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to install ISAPI version on Vista IIS 6
 
 Hello,
 
 
 
 I'm running Vista Ultimate on my computer with IIS 6.0.
 
 
 
 I'm trying to manually install PHP 5 (ISAPI) on IIS but in the Handler
 mappings I get this message:
 
 
 
 One or more of the modules specified for this handler does not exist
 in the
 modules list. If you are trying to add a script map the IsapiModule or
 the
 CgiModule is not prensent in the modules list.
 
 
 
 I have Googled this but did not find any answers. Even on php.net there
 is
 no mention on Vista.
 
 
 
 Can you point me to guidance for installing PHP 5 on Vista running IIS
 6.0?
 
 
 
 Regards,
 
 SED
 

Hope you don't get offended but... check http://www.apple.com/getamac/ads/
(the last one choose a vista is very instructive).
I've never had a Mac, but I've laughed a lot... and I'm every day thinking
more and more certain of not upgrading my XP. Hope you smile at least for 30
seconds. :)

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308
| TEL 954-607-4207 | FAX 954-337-2695
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
bestplace |  Web: http://www.bestplace.biz | Web: http://www.seo-diy.com

-- 
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



RE: [PHP] How to install ISAPI version on Vista IIS 6

2007-12-11 Thread Andrés Robinet
I think I found a solution for you... or at least a step closer. One
correction though, you are likely running IIS 7.0 and not IIS 6.0, right?

Check this out
http://www.phpbuilder.com/board/showthread.php?t=10344435highlight=php+5.2.
3 It seems that the default installation of windows IIS 7.0 for Vista does
not include the CGI and ISAPI modules. You need to include at least the one
you'll be using for PHP, I guess ISAPI but I've read about some problems
with extensions, so... give it a try, it's a pity I don't have a Vista box
to try it and tell you.

Anyway... hope you manage to get it installed, and when you do... POST IT
BACK, there will surely be other people willing to know about it in this
list.

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308
| TEL 954-607-4207 | FAX 954-337-2695
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
bestplace |  Web: http://www.bestplace.biz | Web: http://www.seo-diy.com

 -Original Message-
 From: SED [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 12, 2007 1:44 AM
 To: 'Andrés Robinet'
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] How to install ISAPI version on Vista IIS 6
 
 Hi Rob,
 
 I'm not offended, I'm pistoff with Microsoft. Paying so much for VISTA
 and
 so many troubles and so litle support...  I have other computers
 running
 various others systems but I need to solve this case.
 
 Your comment, only makes me smile, over how stupid I was to pay for
 Vista.
 
 Regards,
 SED
 
 -Original Message-
 From: Andrés Robinet [mailto:[EMAIL PROTECTED]
 Sent: 12. desember 2007 04:08
 To: php-general@lists.php.net
 Subject: RE: [PHP] How to install ISAPI version on Vista IIS 6
 
  -Original Message-
  From: SED [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 12, 2007 12:25 AM
  To: php-general@lists.php.net
  Subject: [PHP] How to install ISAPI version on Vista IIS 6
 
  Hello,
 
 
 
  I'm running Vista Ultimate on my computer with IIS 6.0.
 
 
 
  I'm trying to manually install PHP 5 (ISAPI) on IIS but in the
 Handler
  mappings I get this message:
 
 
 
  One or more of the modules specified for this handler does not exist
  in the
  modules list. If you are trying to add a script map the IsapiModule
 or
  the
  CgiModule is not prensent in the modules list.
 
 
 
  I have Googled this but did not find any answers. Even on php.net
 there
  is
  no mention on Vista.
 
 
 
  Can you point me to guidance for installing PHP 5 on Vista running
 IIS
  6.0?
 
 
 
  Regards,
 
  SED
 
 
 Hope you don't get offended but... check
 http://www.apple.com/getamac/ads/
 (the last one choose a vista is very instructive).
 I've never had a Mac, but I've laughed a lot... and I'm every day
 thinking
 more and more certain of not upgrading my XP. Hope you smile at least
 for 30
 seconds. :)
 
 Rob
 
 
 Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL
 33308
 | TEL 954-607-4207 | FAX 954-337-2695
 Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
 bestplace |  Web: http://www.bestplace.biz | Web: http://www.seo-
 diy.com
 
 --
 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] running cmd via php

2007-12-11 Thread Tom Rogers
Hi,

Thursday, November 29, 2007, 2:17:15 AM, you wrote:
a Hello!
a I'm trying a lot to find how I can run the cmd (command line of windows) and
a send to the cmd commands?
a Thanks. 


Here is one way to do it, its from a function to check php syntax.
it opens up php then sends it the text to check and reads the answer
back.

function checkPhpSyntax($text){
$r = false;
$cwd = getcwd();
chdir(C:\\php5);
$descriptorspec = array(
  0 = array(pipe, r), // stdin is a pipe that the child will read from
  1 = array(pipe, w),
  2 = array(file, C:\\php5\\error.txt, a));
$process = proc_open(C:\\php5\\php -c C:\\php5 -l, $descriptorspec, 
$pipes);
fwrite($pipes[0], $text);
fclose($pipes[0]);
$out = '';
while(!feof($pipes[1])) {
$out .= fgets($pipes[1], 1024);
}
fclose($pipes[1]);
proc_close($process);
chdir($cwd);
if(!empty($out)){
  $res = split(\n,$out);
  if(preg_match('/No syntax errors/',$res[0])){
$r =true;
  }else{
$error = $res[1];
if(preg_match('/Parse error:/',$error)){
  $match = preg_split('/line/',$error);
  $line = intval(trim($match[1]));
  //show error here
}
  }
}
return $r;
}

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Regular expressions

2007-12-11 Thread Liz Kim
I am trying to do a password match with php..

It needs to be at least 6 characters, contains 2 alphabets and at least 1
number or a special character...

if
(!preg_match(/^.*(?=.{6,})((?=.*\d)|(?=.*[,[EMAIL 
PROTECTED]\/'+\*\?\.\[\]\^$\(\){}\|\\:;'~`#%_-]))([a-zA-Z]{2,}).*$/,
$pw1)) {error message}

is failing to pass e1w2qw as a good password although it follows the
instructions...

I cannot figure out why..

Please help!

Thank you,


Re: [PHP] Regular expressions

2007-12-11 Thread Robert Cummings
On Tue, 2007-12-11 at 22:33 -0800, Liz Kim wrote:
 I am trying to do a password match with php..
 
 It needs to be at least 6 characters, contains 2 alphabets and at least 1
 number or a special character...
 
 if
 (!preg_match(/^.*(?=.{6,})((?=.*\d)|(?=.*[,[EMAIL 
 PROTECTED]\/'+\*\?\.\[\]\^$\(\){}\|\\:;'~`#%_-]))([a-zA-Z]{2,}).*$/,
 $pw1)) {error message}
 
 is failing to pass e1w2qw as a good password although it follows the
 instructions...
 
 I cannot figure out why..

Any reason you took such a complex route?

?php

if( strlen( $pw1 )  6
||
!ereg( '[[:digit:]]', $pw1 )
||
strlen( ereg_replace( '[^[:alpha:]]', '', $pw1 ) )  2
||
strlen( ereg_replace( '[[:alnum:][:space:]]', '', $pw1 ) )  1 )
{
// error message
}

?

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php