php-general Digest 29 Dec 2007 04:46:25 -0000 Issue 5205

2007-12-28 Thread php-general-digest-help

php-general Digest 29 Dec 2007 04:46:25 - Issue 5205

Topics (messages 266322 through 266342):

Re: Unix date
266322 by: Daniel Brown
266323 by: Nathan Nobbe
266324 by: bruce
266326 by: Børge Holen
266328 by: Jochem Maas
266329 by: Al
266330 by: tedd
266333 by: Dan
266335 by: Børge Holen
266336 by: Daniel Brown

Re: fopen() for http:// sometimes working, sometimes not
266325 by: Albert Wiersch
266327 by: Wolf
266338 by: Albert Wiersch
266339 by: Dan

Re: Unix date (even more bazaar)
266331 by: tedd
266332 by: tedd
266334 by: Dan
266337 by: Daniel Brown

when does php stop php executing when user clicks stop
266340 by: Eric Wood
266341 by: Eric Wood

Re: [PHP-DEV] Sayonara PHP
266342 by: Martin Alterisio

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
On Dec 28, 2007 10:46 AM, tedd [EMAIL PROTECTED] wrote:
 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?

?
if(function_exists(date_default_timezone_set)) {
date_default_timezone_set('UTC');
}

$unix_in = 1255845600;

echo date(M d, Y h:i:s a,$unix_in).\n;
?

It requires PHP 5 = 5.1.0, hence the function_exists() condition.


-- 
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.
---End Message---
---BeginMessage---
On Dec 28, 2007 10:46 AM, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?


assuming you have the
date.timezone
php.ini directive set appropriately on each system and they are in different
timezones, the values will not be the same.  if you want to get the same
time
you can go for GMT;

$unix_in = 1255845600;
echo(gmdate(M d, Y h:i:s a,$unix_in));

-nathan
---End Message---
---BeginMessage---
i'm pretty sure you can sync/link to a ntp server to accurately track the
time...



-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Friday, December 28, 2007 7:47 AM
To: PHP
Subject: [PHP] Unix date


Hi gang:

Using:

$unix_in = 1255845600;

echo(date(M d, Y h:i:s a,$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of time-zone and
daylight-savings considerations. In other words, the function
date() looks at the server's time (whatever that is set for, right or
wrong) and uses that for the calculation.

So, what's the best method in keeping things consistent across
servers? Is there one?

Cheers,

tedd

--
---
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
---End Message---
---BeginMessage---
On Friday 28 December 2007 16:46:46 tedd wrote:
 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?

I almost took to a baseballbat, till I remembered to change php.ini to co run 
two servers. Of course doing this in severeal servers all across the world 
probably would result in some timeerror somewhere, but it did the job for me 
EASY!!



 Cheers,

 tedd

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

[PHP] Re: Asynchronous socket connection timing issue.

2007-12-28 Thread Nicolas Le Gland
Having succeeded in writing the same code using the BSD sockets extension 
without any such delay, I filled a bug concerning stream implementation.

http://bugs.php.net/?id=43695

Feel free to reply there.

-- 
Nicolas Le Gland 

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



[PHP] Re: Asynchronous socket connection timing issue.

2007-12-28 Thread Nicolas Le Gland
Having succeeded in writing the same code using the BSD sockets extension 
without any such delay, I filled a bug concerning stream implementation.

http://bugs.php.net/?id=43695

Feel free to reply there.

-- 
Nicolas Le Gland 

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



RE: [PHP] socket_read can not read the whole HTTP page?

2007-12-28 Thread ked
Wow, That's  correct answer!  Thank to Eddie Dunckley !

scheme: 
$in .= GET {$file} HTTP/1.0\r\n;  //---
$in .= Accept: text/html\r\n;
$in .= Accept-Language: zh-cn\r\n;
$in .= User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET
CLR 2.0.50727)\r\n;
$in .= Host: {$host}\r\n;
$in .= Cache-Control: no-cache\r\n;
$in .= Connection: closed\r\n\r\n;//must be closed

1.must be HTTP/1.0   : why? IE post  HTTP/1.1 .
2. must be closed : so that should be close not closed;

Both modification are required. 

Shall  anyone tell me sth. about HTTP/1.0 and HTTP/1.1 ? 
 
best regards!
ked


 -Original Message-
 From: Eddie Dunckley [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 28, 2007 3:50 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] socket_read can not read the whole HTTP page?
 
 On Fri 28 Dec 07, ked wrote:
  I wrote those script  to get HTTP url content, and it  
 works , but it 
  can't read the whole content of the page.
  Blocked on while ($out = socket_read($socket, 1024)) .
  $in .= GET {$file} HTTP/1.1\r\n;
 try to change this to $in .= GET {$file} HTTP/1.0\r\n;
 
  $in .= Connection: Keep-Alive\r\n\r\n;
 and change this to
 $in .= Connection: closed\r\n\r\n;
 
 --
 Eddie Dunckley - [EMAIL PROTECTED] - Realtime Travel 
 Connections IBE Development, www.rttc.co.za, cell 
 083-379-6891, fax 086-617-7831 Where 33deg53'37.23S 
 18deg37'57.87E Cape Town Bellville Oakdale ZA
Chaos, panic, and disorder - my work here is done.
 
 --
 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] Unix date

2007-12-28 Thread tedd

Hi gang:

Using:

$unix_in = 1255845600;

echo(date(M d, Y h:i:s a,$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of time-zone and 
daylight-savings considerations. In other words, the function 
date() looks at the server's time (whatever that is set for, right or 
wrong) and uses that for the calculation.


So, what's the best method in keeping things consistent across 
servers? Is there one?


Cheers,

tedd

--
---
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] Unix date

2007-12-28 Thread Daniel Brown
On Dec 28, 2007 10:46 AM, tedd [EMAIL PROTECTED] wrote:
 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?

?
if(function_exists(date_default_timezone_set)) {
date_default_timezone_set('UTC');
}

$unix_in = 1255845600;

echo date(M d, Y h:i:s a,$unix_in).\n;
?

It requires PHP 5 = 5.1.0, hence the function_exists() condition.


-- 
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] Unix date

2007-12-28 Thread Nathan Nobbe
On Dec 28, 2007 10:46 AM, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?


assuming you have the
date.timezone
php.ini directive set appropriately on each system and they are in different
timezones, the values will not be the same.  if you want to get the same
time
you can go for GMT;

$unix_in = 1255845600;
echo(gmdate(M d, Y h:i:s a,$unix_in));

-nathan


RE: [PHP] Unix date

2007-12-28 Thread bruce
i'm pretty sure you can sync/link to a ntp server to accurately track the
time...



-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Friday, December 28, 2007 7:47 AM
To: PHP
Subject: [PHP] Unix date


Hi gang:

Using:

$unix_in = 1255845600;

echo(date(M d, Y h:i:s a,$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of time-zone and
daylight-savings considerations. In other words, the function
date() looks at the server's time (whatever that is set for, right or
wrong) and uses that for the calculation.

So, what's the best method in keeping things consistent across
servers? Is there one?

Cheers,

tedd

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

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



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch
I'm now using PHP 5.2.5.

Well, it seems to still be happening. This describes the problem but I 
haven't found a solution that works for me yet:
http://bugs.php.net/bug.php?id=11058

Is it a PHP problem or DNS? It works sometimes but not other times.. 
something strange is going on.

Example messages:
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen() [a href='function.fopen'function.fopen/a]: 
php_network_getaddresses: getaddrinfo failed: Name or service not known
[Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
fopen(http://www.lantanalinks.com) [a 
href='function.fopen'function.fopen/a]: failed to open stream: Success

I suppose I could adjust the script to try again if it fails the first time, 
but I shouldn't have to.

Some additional info, when it fails with this problem, it fails very quickly 
(in less than half a second)... its like it doesn't even try to look up the 
name.

-- 
Albert Wiersch
Fix your website: http://onlinewebcheck.com


Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
 often) failing to open some URLs that users have entered. fopen() returns 
 false very quickly, but when tried again with the same URL, sometimes it 
 works. What would cause this behavior? Why does fopen() occasionally fail 
 to open valid http addresses but works at other times?

 -- 
 Albert Wiersch 

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



Re: [PHP] Unix date

2007-12-28 Thread Børge Holen
On Friday 28 December 2007 16:46:46 tedd wrote:
 Hi gang:

 Using:

 $unix_in = 1255845600;

 echo(date(M d, Y h:i:s a,$unix_in));

 On one sever, produces: Oct 18, 2009 02:00:00 am

 But on another sever, produces: Oct 18, 2009 12:00:00 am

 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function
 date() looks at the server's time (whatever that is set for, right or
 wrong) and uses that for the calculation.

 So, what's the best method in keeping things consistent across
 servers? Is there one?

I almost took to a baseballbat, till I remembered to change php.ini to co run 
two servers. Of course doing this in severeal servers all across the world 
probably would result in some timeerror somewhere, but it did the job for me 
EASY!!



 Cheers,

 tedd

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



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Wolf
DNS issues

Albert Wiersch wrote:
 I'm now using PHP 5.2.5.
 
 Well, it seems to still be happening. This describes the problem but I 
 haven't found a solution that works for me yet:
 http://bugs.php.net/bug.php?id=11058
 
 Is it a PHP problem or DNS? It works sometimes but not other times.. 
 something strange is going on.
 
 Example messages:
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
 fopen() [a href='function.fopen'function.fopen/a]: 
 php_network_getaddresses: getaddrinfo failed: Name or service not known
 [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: 
 fopen(http://www.lantanalinks.com) [a 
 href='function.fopen'function.fopen/a]: failed to open stream: Success
 
 I suppose I could adjust the script to try again if it fails the first time, 
 but I shouldn't have to.
 
 Some additional info, when it fails with this problem, it fails very quickly 
 (in less than half a second)... its like it doesn't even try to look up the 
 name.
 

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



Re: [PHP] Unix date

2007-12-28 Thread Jochem Maas
tedd schreef:
 Hi gang:
 
 Using:
 
 $unix_in = 1255845600;
 
 echo(date(M d, Y h:i:s a,$unix_in));
 
 On one sever, produces: Oct 18, 2009 02:00:00 am
 
 But on another sever, produces: Oct 18, 2009 12:00:00 am
 
 This difference appears to be a combination of time-zone and
 daylight-savings considerations. In other words, the function date()
 looks at the server's time (whatever that is set for, right or wrong)
 and uses that for the calculation.
 
 So, what's the best method in keeping things consistent across servers?
 Is there one?

not sure exactly what your requirements are (and I can easily lose days
f'ing around with these kinds of dates issues) but have you checked out
gmdate() and it's friends (gm = GMT)?

http://php.net/manual/en/function.gmdate.php

 
 Cheers,
 
 tedd
 

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



[PHP] Re: Unix date

2007-12-28 Thread Al

date_default_timezone_set ( string $timezone_identifier )


tedd wrote:

Hi gang:

Using:

$unix_in = 1255845600;

echo(date(M d, Y h:i:s a,$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of time-zone and 
daylight-savings considerations. In other words, the function date() 
looks at the server's time (whatever that is set for, right or wrong) 
and uses that for the calculation.


So, what's the best method in keeping things consistent across servers? 
Is there one?


Cheers,

tedd



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



Re: [PHP] Unix date

2007-12-28 Thread tedd

At 7:45 PM +0100 12/28/07, Børge Holen wrote:

On Friday 28 December 2007 16:46:46 tedd wrote:
  So, what's the best method in keeping things consistent across

 servers? Is there one?


I almost took to a baseballbat, till I remembered to change php.ini to co run
two servers. Of course doing this in severeal servers all across the world
probably would result in some timeerror somewhere, but it did the job for me
EASY!!


Well, I'm glad it was easy for you, but this has 
been, and remains, confusing and frustrating for 
me.


Here's the problem if anyone cares to stress themselves.

Here is the code and demo:

http://webbytedd.com/c/unix-time1/index.php

It works for me on my server.

However, when I use the exact same function for a 
client on his server and enter:


10-18-2009 00:00:00

The function changes the date to:

10-18-2009 12:00:00

What's going on here?

Cheers,

tedd

PS: I have no control over the php.in file.

--
---
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] Unix date (even more bazaar)

2007-12-28 Thread tedd

Hi gang:

This really bazaar

Here's the code and demo:

http://webbytedd.com/c/unix-time1/index.php

If I cut/paste the following string as-is into the Input Date 
portion of the form:


10-18-2009 00:00:00

It works and returns a UNIX timestamp of 1255885200

However, if I cut/paste the following string as-is into the Input 
Date portion of the form:


10-18-2009 00:00:00

It doesn't work and returns a UNIX timestamp of .

Am I going mad? What the hell is the difference between these two stings?

Arr  I knew this day would come.

tedd

--
---
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] Unix date (even more bazaar)

2007-12-28 Thread tedd

At 6:01 PM -0500 12/28/07, tedd wrote:

Hi gang:

This really bazaar

Here's the code and demo:

http://webbytedd.com/c/unix-time1/index.php

If I cut/paste the following string as-is into the Input Date 
portion of the form:


10-18-2009 00:00:00

It works and returns a UNIX timestamp of 1255885200

However, if I cut/paste the following string as-is into the Input 
Date portion of the form:


10-18-2009 00:00:00

It doesn't work and returns a UNIX timestamp of .

Am I going mad? What the hell is the difference between these two stings?

Arr  I knew this day would come.

tedd



As I feared, the email translation made both strings identical -- so 
this won't work for those trying it.


BUT, I do have two strings that look identical but aren't.

I hate it when things like this happen.

Cheers,

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



[PHP] Re: Unix date

2007-12-28 Thread Dan
The problem is indeed time zones, daylight savings time, etc.  Unless your 
two servers are in the same place you can't really make the times the same 
without making them wrong in one place.  The best thing I can think of to do 
is specify a timezone, and daylight savings time value, that way you will 
know what to expect.


You can use the function gmstrtime 
http://us.php.net/manual/en/function.gmstrftime.php to go from time(assumed 
GMT) - unix


Then when you want to get the time of day use gmdate(), it works like date() 
but gives you the time in GMT, which is what you stored it in so you never 
have to worry about the local time options.


- Dan

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

Hi gang:

Using:

$unix_in = 1255845600;

echo(date(M d, Y h:i:s a,$unix_in));

On one sever, produces: Oct 18, 2009 02:00:00 am

But on another sever, produces: Oct 18, 2009 12:00:00 am

This difference appears to be a combination of time-zone and 
daylight-savings considerations. In other words, the function date() 
looks at the server's time (whatever that is set for, right or wrong) and 
uses that for the calculation.


So, what's the best method in keeping things consistent across servers? Is 
there one?


Cheers,

tedd

--
---
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] Unix date (even more bazaar)

2007-12-28 Thread Dan
tedd [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hi gang:

This really bazaar

Here's the code and demo:

http://webbytedd.com/c/unix-time1/index.php

If I cut/paste the following string as-is into the Input Date portion 
of the form:


10-18-2009 00:00:00

It works and returns a UNIX timestamp of 1255885200

However, if I cut/paste the following string as-is into the Input Date 
portion of the form:


10-18-2009 00:00:00

It doesn't work and returns a UNIX timestamp of .

Am I going mad? What the hell is the difference between these two stings?

Arr  I knew this day would come.

tedd


Hi Tedd, next time you could just reply to your origional thread, you can 
change the subject without making  new thread, it's just harder for other 
people to follow.  Anyway, check out my response about storing and reading 
using GMT, it might help you.


- Dan 


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



Re: [PHP] Unix date

2007-12-28 Thread Børge Holen
On Friday 28 December 2007 23:48:21 tedd wrote:
 At 7:45 PM +0100 12/28/07, Børge Holen wrote:
 On Friday 28 December 2007 16:46:46 tedd wrote:
So, what's the best method in keeping things consistent across
 
   servers? Is there one?
 
 I almost took to a baseballbat, till I remembered to change php.ini to co
  run two servers. Of course doing this in severeal servers all across the
  world probably would result in some timeerror somewhere, but it did the
  job for me EASY!!

 Well, I'm glad it was easy for you, but this has
 been, and remains, confusing and frustrating for
 me.

Shouldn't be... two different servers where the timezone in php.ini is set 
different.
It does not do anything useful, EXCEPT giving you the possability to offset/ 
skew the time in php. 

Short version and a hand on explanation:
Say I maintain a machine in seattle and my own here in norway. 9 hours time 
difference. 
These two is handling a site together and the database timestamp has to be the 
same, on a date not yet arrived on the other.
I can now offset one of the machines 9 hour forth or back to fit my need.

of course this only work if you handle one domain (or more in one country). If 
not... you must use the solution presented by the others here.



 Here's the problem if anyone cares to stress themselves.

 Here is the code and demo:

 http://webbytedd.com/c/unix-time1/index.php

 It works for me on my server.

 However, when I use the exact same function for a
 client on his server and enter:

 10-18-2009 00:00:00

 The function changes the date to:

 10-18-2009 12:00:00

 What's going on here?

That was my problem to, till I found the bugger in the ini file:
[Date]
; Defines the default timezone used by the date functions
date.timezone = 0

that is the line you are looking for... or would if you had access to it.
with the lines the other nice ppl provided, you do exactly the same, just not 
system wide.


 Cheers,

 tedd

 PS: I have no control over the php.in file.

shoot the administrator..
or add a code to offset the time


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



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] Unix date

2007-12-28 Thread Daniel Brown
On Dec 28, 2007 5:48 PM, tedd [EMAIL PROTECTED] wrote:
[snip!]
 Here is the code and demo:

 http://webbytedd.com/c/unix-time1/index.php

 It works for me on my server.
[snip!]

Well, if you don't want to change the timezone at runtime like I
suggested this morning, you could do something with the date(O);
switch to see the difference.

THIS IS UNTESTED, AND BEING TYPED BY AN EXHAUSTED GEEK WHO'S READY
FOR NEW YEARS' VACATION

?php  // == functions =--

function dateToUnix($datetime)// in the form of 12-25-2007 00:00:00
  {

  $parts = explode(' ', $datetime);  // separate 12-25-2007 from 00:00:00
  if (count($parts) != 2)
{
return;
}

  $date_parts = explode('-', $parts[0]);  // separate 12-25-2007
  if (count($date_parts) != 3)
{
return;
}

  $time_parts = explode(':', $parts[1]);  // separate 00:00:00
  if (count($time_parts) != 3 )
{
return;
}

  $my_timezone = +0500; // To denote EST (GMT -0500) - Change to
whatever you want.

  if(date(O)  $my_timezone)
{
  substr($my_timezone,0,1) == -  substr(date(O),0,1) == -
? $time_parts[0] = (($time_parts[0] + date(O)) - $my_timezone)
: null;
  substr($my_timezone,0,1) == -  substr(date(O),0,1) == +
?  $time_parts[0] = (($time_parts[0] - date(O)) - $my_timezone)
: null;
  substr($my_timezone,0,1) == +  substr(date(O),0,1) == +
? $time_parts[0] = (($time_parts[0] - date(O)) + $my_timezone)
: null;
  substr($my_timezone,0,1) == +  substr(date(O),0,1) == -
? $time_parts[0] = (($time_parts[0] + date(O)) + $my_timezone)
: null;
}

  return mktime($time_parts[0], $time_parts[1], $time_parts[2],
  $date_parts[0], $date_parts[1], $date_parts[2],-1);

  }

echo date(m/d/Y H:i:s,dateToUnix(12-28-2007 18:30:46)).\n;

?

-- 
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] Unix date (even more bazaar)

2007-12-28 Thread Daniel Brown
Yeah, and to what bazaar are you going, old man?

Look, I'm so loopy right now, I'm top-posting.  How bizarre

HAPPY NEW YEAR TO ALL, AND TO ALL SHUT THE HELL UP!

Be safe, happy, and healthy into 2008!

/Dan



On Dec 28, 2007 6:16 PM, Dan [EMAIL PROTECTED] wrote:
 tedd [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi gang:
 
  This really bazaar
 
  Here's the code and demo:
 
  http://webbytedd.com/c/unix-time1/index.php
 
  If I cut/paste the following string as-is into the Input Date portion
  of the form:
 
  10-18-2009 00:00:00
 
  It works and returns a UNIX timestamp of 1255885200
 
  However, if I cut/paste the following string as-is into the Input Date
  portion of the form:
 
  10-18-2009 00:00:00
 
  It doesn't work and returns a UNIX timestamp of .
 
  Am I going mad? What the hell is the difference between these two stings?
 
  Arr  I knew this day would come.
 
  tedd

 Hi Tedd, next time you could just reply to your origional thread, you can
 change the subject without making  new thread, it's just harder for other
 people to follow.  Anyway, check out my response about storing and reading
 using GMT, it might help you.

 - Dan


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





-- 
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: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Albert Wiersch

Wolf [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 DNS issues

I think I've solved this. I found a problem with resolv.conf that contained 
some outdated DNS servers. After changing that and rebooting the server it 
seems to be working. It didn't seem to work after just changing the file and 
restarting apache though, it seems like the reboot was necessary. I don't 
know why but so far do good.

The root.hints file was also updated. I'm not sure if that had anything to 
do with it but it was updated in the process of trying to fix the problem.

Albert 

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



[PHP] Re: fopen() for http:// sometimes working, sometimes not

2007-12-28 Thread Dan
Albert Wiersch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


I noticed my script at http://onlinewebcheck.com was sometimes (fairly 
often) failing to open some URLs that users have entered. fopen() returns 
false very quickly, but when tried again with the same URL, sometimes it 
works. What would cause this behavior? Why does fopen() occasionally fail 
to open valid http addresses but works at other times?


--
Albert Wiersch


You really need to filter your input more, have a list of what is acceptable 
not what is unacceptable.  That being, make it a requirement that the url 
input has a TDL(.com, .net, .org, etc.) or is a valid IP(ping it), only 
allow alphanumerics for the name, etc.  When you don't validate your site 
can get hacked, I know it's not really insecure but it's just an example of 
input you may not expect, if you try to validate http://localhost it goes 
ahead and validates your server's html.


- Dan 


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



[PHP] when does php stop php executing when user clicks stop

2007-12-28 Thread Eric Wood
If database operations are underway when a user accesses a web page,
then user clicks stop on the browser, does the php stop immediately too?

I'd rather the php continue behind the scenes to fullfill all the
actions I need it do to whether the user wants to see if happen or not.

Overall I wonder how modphp keeps the code executing even if the browser
drops the connection via stop.

Any insight is greatly appreciated.

thanks,
-eric wood

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



Re: [PHP] when does php stop php executing when user clicks stop

2007-12-28 Thread Eric Wood
Eric Wood wrote:
 If database operations are underway when a user accesses a web page,
 then user clicks stop on the browser, does the php stop immediately too?

 I'd rather the php continue behind the scenes to fullfill all the
 actions I need it do to whether the user wants to see if happen or not.

 Overall I wonder how modphp keeps the code executing even if the browser
 drops the connection via stop.

 Any insight is greatly appreciated.

 thanks,
 -eric wood

   
I pretty much found my answers over at:
http://us2.php.net/manual/en/features.connection-handling.php

thanks anyway,
-eric wood

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



Re: [PHP] Re: [PHP-DEV] Sayonara PHP

2007-12-28 Thread Martin Alterisio
2007/12/26, Colin Guthrie [EMAIL PROTECTED]:

 Hi,

 While I'll admit I've not fully read your mail due to it's relatively
 in-depth and technical nature that I'm not really up-to-speed with
 regarding the internals of PHP, it did strike me when skimming the mail,
 that you've not really covered your personal standpoint now.

 You state some interesting technical about how namespaces and such
 will/could work in 5.3 (something which I would personally welcome with
 open arms (especially as I've coded around the autoloading issue with
 other techniques involving regexps of class names and other such
 slightly nasty things (although acceptable if you used good prefixes on
 all your class/interface names)).

 But you also say you're leaving PHP (if not for good, at least for now)
 and you don't really say why, other than referring to the hard initial
 entry to the internals community.

 If you would be so kind, I think it would be interesting to say why you
 have decided to move away from using PHP (and what you are now intending
 to use!). I think it would help the PHP community grow stronger with
 this kind of information as much as the technical information you've
 already given.


Well, it was my intent not to say that in particular because is rather
personal. I just wanted to pass on all the things that may be of some use to
another developer.

If you must know, there are three reasons why I'm distancing myself from
PHP.

1) I'm tired of web development as a whole. Too many clients which do not
understand what the web is. Too many opiniologists who should know what the
web is but talk about a second web, which is nothing more than the old web
with logos on shiny floor. It feels like the bubble all over again (luckily
I was too young to be affected when the first happened, now I cannot say I
won't be affected).

2) I started in the business of software development with a dream that I was
told afterwards it was childish and immature. Now I've learned enough to
know that my dream, being a game developer, it's neither childish nor
immature, totally the opposite, it's probably the most serious and important
job in the whole software development industry. I wanna give it a try
chasing that rainbow.

3) I'm not so sure anymore if PHP is profitable as a language choice for web
development. The small and medium projects market is becoming infested with
developers who I cannot compete anymore in terms of cost, and software
quality is something this market did not yet got a grasp on. Big projects
market has scalability requirements that aren't easily met on PHP grounds,
and if it does, the cost is code quality or performance, two things that
this market doesn't easily overlook.

Right now, the future of web development is mostly uncertain, too many
things are happening too fast. If I had to I would bet on Java for server
technology and Flash for client technology. The performance of Java6 have
left PHP and the many other scripting languages panting for air way way
behind. And its scripting API has engulfed all the good things about
scripting languages into its domain. And yet the most important thing about
Java is its scalability. Let's be honest, how can anyone expect to beat Sun
in its own turf (networking)? Anyway, PHP developers, remember this word:
Quercus.

And the Flash guys pulled a rabbit out of the hat and called it Flash 9.
They broke every compatibility known to developers, but finally developing
for Flash doesn't suck. And also, they are going with the open-source
approach as the Sun guys did (I pity the poor graphic designer, he still has
to get a commercial license to author some content for the flash
environment). And we have now many tools to apply the AJAX technique and
DHTML easily, but I would still beat the crap out of anyone who thinks that
building a thick client on HTML DOM and javascript is a good idea.

On the other hand, there hasn't happened anything important on the PHP
frontier, except for the PHP4 EOL and the Zend Framework (IMHO the first
real framework for PHP). And the most annoying thing is this stupid marriage
PHP/MySQL that keeps on going. The moment was appropriate for PHP to end
this relationship and PDO was a good step towards this. You'll probably have
heard or will soon hear about mysqlnd, and many will think yay! mysql
functions are again part of the core!!! and they're faster!!! and I would
be thinking damn! open source php projects will be tightly tied to MySQL,
AGAIN!.

Anyway that was much of a rant. The short version is I liked the php
development market because it was safe, but now I doubt its safety.

That's all. I don't think that rant may be of use to anyone, but at least it
felt nice to let go of some steam.

Best Regards and Happy New Year,

Martin Alterisio


Re: [PHP] Sayonara PHP

2007-12-28 Thread Martin Alterisio
2007/12/26, Andrés Robinet [EMAIL PROTECTED]:

 Well, my fellow countryman... one of my classmates at college had a
 saying:
 el hombre es un animal de costumbres (translate it you gringos :) - no
 offense). And I guess it's most of the time like that... we learn
 something,
 we are never willing to unlearn it. But the truth is, there are at least
 as
 many habits and learnt behaviors as people are there walking in the
 streets.
 So, sometimes, we should be a bit more tolerant to foreign habits
 (unless
 we are Micro$oft.. but even so...).

 If my intuition is right you must come from the Java/C++ world (my bet is
 java 80/20). Maybe you have evaluated the hassles of implementing
 namespaces
 into PHP... and you have concluded it's not possible. Or maybe, that it
 will
 be a buggy implementation in the end; like PHP 4 OOP (which doesn't look
 like OOP at all). Maybe some old-seasoned gurus in the internals community
 have set you apart, or have treated your opinions with contempt (this is
 just my assumption, like most of this email's contents). So, you are now
 assuming that you won't need PHP, and that it will 'die(alone)' like
 some
 poem of your authorship stated in one of its verses. Yes, after all
 developers find out the hassles of namespaces and type hinting in PHP,
 they
 will give up... won't they? (just reading your mind... forgive my
 arrogance
 and continue).


Well, it's been years since I've done anything important in Java or C++.
I've been doing mostly scripting languages in all sorts of flavors.

I don't really care that my opinion felt to /dev/null or something else, I
just kept trying, and when I understood that I had to get my hands really
dirty to be taken into consideration, that's what I did. The short time I
had been dwelling through php source code, I finally understood why the core
developers have such a short temper. To be fair with the core developers,
the php community should issue a thank you for keeping php running email
each week.

The poem! That was fun! =D
It's not an assumption that I won't need PHP, it's just that I wanna try
doing something that's far away from web development and php. It would have
been a waste to leave everything I wrote in the first mail in the garbage
bin. That's why I wrote it, so if there's someone who sees that something is
sensible or useful in there, he can just take it. That was my only
intention.

I don't expect developers to just give up. I expect them to (a) accept them
and continue doing as always (b) ignore them (c) complain (d) use them
wrongly. I'll go for (d) if you wanna bet.

You know... I think I'm about your age (judging for the picture of yours at
 phpclasses.org, if that's your picture). Maybe a bit younger, or a bit
 older... but just a bit. And the thing is, I heard about two years ago or
 so, a big buzz around a PHP replacement. It was something about trains
 (that's the farthest understanding I reached on it... something about
 trains). I think it was called, railroad, or railway, or diamond on a
 train... ... nope, now I remember, it's ruby on rails (if you have a
 sarcasm detector, use it now). Last time I checked, it was still alive...
 arguably in a much more evolved fashion, and some (may I say few?)
 hosting
 companies support it now. I don't know much about current statistics, but
 I'm tempted to say that:
 - There are many more Books on PHP than on RoR
 - There are many more PHP hosting offers than RoR's counterpart (even if
 we
 reduce the stats to PHP 5 - just a guess)
 - There are many many more websites built on top of PHP than the RoR's
 counterpart
 - There are many many more extensions, APIs and Frameworks for PHP than
 for
 RoR (actually, RoR IS a framework itself)
 - There are many many more PHP developers than RoR developers
 In the shared market niche, PHP has beaten java, coldfusion, asp, and
 perl,
 which already existed. PHP has survived .Net rumbling, despite the Vb, C#,
 J# or C++ flavors and the awesome Vi$ual $tudio IDE. And despite all the
 predictions and prophecies about PHP's doom... it is still here, and will
 be
 here and in the top 5 for at least 10 years. By the time PHP is replaced
 by
 RoR or anything else, I will probably be selling RoR T-Shirts, or be
 retired, or be dead (maybe of lung cancer, or cirrhosis, or just because
 no-one can live past 120's)...


Please, don't let me get started on the Freaks on Rails.

RoR is a stillborn baby. It wasn't just bad enough that the RoR developer
failed while doing the first video presentation of RoR. People still kept
boarding that train. And it become worst, people from PHP started to think
that RoR was actually a good idea to be copied.

There are two major faults with RoR:
1) The MVC design pattern is not applied correctly
2) The whole application is designed around the (faulty) MVC design pattern

The MVC design pattern has one purpose and one purpose only, user interface
implementation. RoR forces you to put code that's not pertinent to 

[PHP] php.ini in php5.2.1

2007-12-28 Thread jekillen

Hello;
I have not had the necessity to deal with php.ini files for some time.
Now, because I switch from Sendmail to Postfix on one system I
need to adjust the sendmail path variable. I cannot find a php.ini file
in the specified location. That is not a problem because I can use
ini_set(). What is puzzling is that my system,
I built and installed from source on a number of different systems and
seem to remember that the process creates a php.ini file. Maybe I have
it wrong but in the past I seem to remember being able to find one to
make sure register variables was set to off. (or maybe I ignored it 
because
that is the default now). So, is the fact that this file is missing 
something

I should be concerned about?
PS; I have subscribed to the php-install list and get not responses to
my posts, or e-mails my ISP says contain viruses, possibly from a user
who requested I contact him (of her) off list.
Thanks
Jeff K

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



Re: [PHP] php.ini in php5.2.1

2007-12-28 Thread Jochem Maas
jekillen schreef:
 Hello;
 I have not had the necessity to deal with php.ini files for some time.
 Now, because I switch from Sendmail to Postfix on one system I
 need to adjust the sendmail path variable. 

are you sure you need to change it? doesn't postfix come with some kind of
compatibility wrapper [script] that takes the place of sendmail itself ...
IIRC most MTAs are sendmail compatible in that way.

 I cannot find a php.ini file
 in the specified location. That is not a problem because I can use
 ini_set(). What is puzzling is that my system,
 I built and installed from source on a number of different systems and
 seem to remember that the process creates a php.ini file. Maybe I have
 it wrong but in the past I seem to remember being able to find one to
 make sure register variables was set to off. (or maybe I ignored it because
 that is the default now). So, is the fact that this file is missing
 something
 I should be concerned about?

php uses it's defaults if it can't load an .ini file - the only concern
is whether this bothers you.

note that you can also set .ini settings via webserver configurations files
(e.g. in apache's httpd.conf or .htaccess files)

 PS; I have subscribed to the php-install list and get not responses to
 my posts, or e-mails my ISP says contain viruses, possibly from a user
 who requested I contact him (of her) off list.
 Thanks
 Jeff K
 

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