php-general Digest 21 Nov 2008 02:13:06 -0000 Issue 5801
Topics (messages 283593 through 283623):
Re: store class zithin session
283593 by: Eric Butera
283602 by: Jochem Maas
283604 by: Eric Butera
283605 by: Kevin Waterson
283609 by: Stut
283610 by: Eric Butera
Re: Invalid Arguements
283594 by: Terion Miller
283595 by: Stut
283596 by: Nathan Rixham
283597 by: Nathan Rixham
283598 by: Nathan Rixham
Re: PHP Warning: HTTP request failed -- BSD resource limit reached?
283599 by: Rene Fournier
283600 by: Daniel P. Brown
283601 by: Nathan Rixham
283606 by: Rene Fournier
283607 by: Rene Fournier
283608 by: Daniel P. Brown
283615 by: Rene Fournier
283617 by: Nathan Rixham
283620 by: Rene Fournier
Re: fread() behaviour
283603 by: Jochem Maas
Model Web Site
283611 by: Stephen
283612 by: Boyd, Todd M.
283613 by: Daniel P. Brown
283614 by: Stephen
283616 by: Chris
283618 by: Yeti
283623 by: Craige Leeder
Re: in_array breaks down for 0 as value
283619 by: Ashley Sheridan
Can GD make a JPG thumbnail of a PDF?
283621 by: Brian Dunning
283622 by: Stephen Johnson
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]
----------------------------------------------------------------------
--- Begin Message ---
On Thu, Nov 20, 2008 at 8:37 AM, Yeti <[EMAIL PROTECTED]> wrote:
> If you can't load the class before calling session_start you can store
> the serialized object in a file and simple set a
> $_SESSION['path_to_file'] session variable..
>
> EXAMPLE:
> <?php
> session_start();
>
> //some code
>
> class apple_tree {
> var $apples = 17;
> }
>
> $temporary_file = 'appletree.txt';
> $file_content = serialize(new apple_tree());
>
> if ($fp = fopen($temporary_file, 'w')) {
> fwrite($fp, $file_content);
> $_SESSION['path_to_file'] = $temporary_file;
> fclose($fp);
> }
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Autoload. Why on earth would you do such a thing?
--- End Message ---
--- Begin Message ---
Eric Butera schreef:
> On Thu, Nov 20, 2008 at 8:37 AM, Yeti <[EMAIL PROTECTED]> wrote:
...
>>
>
> Autoload. Why on earth would you do such a thing?
autoload ... your neighbourhood opcode cache performance killer,
then again so is file based sessions (for ease of use I stick
my session files on /dev/shm/foo [i.e. RAM] if/when using a
file based session handler ... I figure if the box goes down and
takes /dev/shm with it the lost session data is the least of
my worries ... besides by the time the box is up current visitors
will generally have given up and left already)
... and storing a path to
a file containing a serialized object in the session is a bit nuts,
you might as well store the serialized object in the session and
save at least one file write/read. storing a serialized object,
as opposed to letting the session handler do transparent serialization
can help you get round an infrastructure problem (where you can't
load the class before starting the session) and also can improve
performance where you might not want/need to initialize the
given object on every request.
>
--- End Message ---
--- Begin Message ---
On Thu, Nov 20, 2008 at 2:07 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Eric Butera schreef:
>> On Thu, Nov 20, 2008 at 8:37 AM, Yeti <[EMAIL PROTECTED]> wrote:
>
> ...
>
>>>
>>
>> Autoload. Why on earth would you do such a thing?
>
> autoload ... your neighbourhood opcode cache performance killer,
> then again so is file based sessions (for ease of use I stick
> my session files on /dev/shm/foo [i.e. RAM] if/when using a
> file based session handler ... I figure if the box goes down and
> takes /dev/shm with it the lost session data is the least of
> my worries ... besides by the time the box is up current visitors
> will generally have given up and left already)
>
> ... and storing a path to
> a file containing a serialized object in the session is a bit nuts,
> you might as well store the serialized object in the session and
> save at least one file write/read. storing a serialized object,
> as opposed to letting the session handler do transparent serialization
> can help you get round an infrastructure problem (where you can't
> load the class before starting the session) and also can improve
> performance where you might not want/need to initialize the
> given object on every request.
>
>>
>
>
Well I wouldn't put objects into the session to begin with. I was
just talking about this specific case. Wouldn't autoload be fine if
the file was already in the opcode cache?
--- End Message ---
--- Begin Message ---
This one time, at band camp, "Alain Roger" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i have a class and i would like to store it zithin session.
> i was thinking to use serialize/unserialize but it does not work.
http://www.phpro.org/tutorials/Introduction-To-PHP-Sessions.html#8
Kevin
--- End Message ---
--- Begin Message ---
On 20 Nov 2008, at 19:35, Eric Butera wrote:
Well I wouldn't put objects into the session to begin with.
Why not? I do it all the time and it works fine.
I was
just talking about this specific case. Wouldn't autoload be fine if
the file was already in the opcode cache?
Opcode caches work during the compilation phase, so any dynamic
loading such as that provided by autoloaders cannot be optimised. This
has been discussed in the past on this list, check the archives for
more details.
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
On Thu, Nov 20, 2008 at 2:51 PM, Stut <[EMAIL PROTECTED]> wrote:
> On 20 Nov 2008, at 19:35, Eric Butera wrote:
>>
>> Well I wouldn't put objects into the session to begin with.
>
> Why not? I do it all the time and it works fine.
>
>> I was
>> just talking about this specific case. Wouldn't autoload be fine if
>> the file was already in the opcode cache?
>
> Opcode caches work during the compilation phase, so any dynamic loading such
> as that provided by autoloaders cannot be optimised. This has been discussed
> in the past on this list, check the archives for more details.
>
> -Stut
>
> --
> http://stut.net/
>
http://till.vox.com/library/post/zendframework-performance.html?_c=feed-rss-full
Item #3: Get rid off require_once, use __autoload (and the Zend_Loader)
It just lead me to believe that after autoload found a class it
somehow cached the code for it. I'll look into this when I get some
free time for testing.
--- End Message ---
--- Begin Message ---
I currently have it like this:
<select name="BannerSize">
<option value="0">Select a Banner
Size</option>
<option value="728x90">728x90 -
Leaderboard</option>
<option value="160x600">160x600 -
Skyscraper</option>
<option value="300x250">300x250 -
Square</option>
<option value="88x31-300x250">88x31 and
300x250</option>
<option value="120x240">120x240</option>
<option value="940x30">940x30 - Pencil
Ad</option>
</select>
but your saying it should be <select name="BannerSize[]">
On Wed, Nov 19, 2008 at 8:14 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> Terion Miller wrote:
>
>> Actually it did at one point have bannersize[#] # being the numbers
>> 1-however many were there
>> I've since gotten rid of that and made it a select.
>> and gotten rid of the implode all together because it wouldn't work in
>> either case and the more I read the more confused I got.
>> Terion
>>
>>
> Why don't you show us a snippet of code that is the form page for this.
>
> Let us see what you are trying to describe to us.
>
> Even if you switched it to a <SELECT ...></SELECT> the name attribute still
> needs to contain the brackets if you expect to pass more then one <SELECT>
> field in the same form.
>
> --
> Jim Lucas
>
> "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
>
>
--- End Message ---
--- Begin Message ---
On 20 Nov 2008, at 14:37, Terion Miller wrote:
I currently have it like this:
<select name="BannerSize">
<option value="0">Select a Banner
Size</option>
<option value="728x90">728x90 -
Leaderboard</option>
<option value="160x600">160x600 -
Skyscraper</option>
<option value="300x250">300x250 -
Square</option>
<option value="88x31-300x250">88x31 and
300x250</option>
<option value="120x240">120x240</
option>
<option value="940x30">940x30 - Pencil
Ad</option>
</select>
but your saying it should be <select name="BannerSize[]">
That's a single select field, why are you trying to implode it??
-Stut
--
http://stut.net/
On Wed, Nov 19, 2008 at 8:14 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
Terion Miller wrote:
Actually it did at one point have bannersize[#] # being the numbers
1-however many were there
I've since gotten rid of that and made it a select.
and gotten rid of the implode all together because it wouldn't
work in
either case and the more I read the more confused I got.
Terion
Why don't you show us a snippet of code that is the form page for
this.
Let us see what you are trying to describe to us.
Even if you switched it to a <SELECT ...></SELECT> the name
attribute still
needs to contain the brackets if you expect to pass more then one
<SELECT>
field in the same form.
--
Jim Lucas
"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
--- End Message ---
--- Begin Message ---
On 20 Nov 2008, at 14:37, Terion Miller wrote:
I currently have it like this:
<select name="BannerSize">
if you've got it working don't change it :)
but to explain:
it is possible to send through an array of data from a form, to do this
you place multiple elements with the same name followed by [] in the form..
so
<select name="BannerSize[]"> .. (our first select)
<select name="BannerSize[]"> ... (our second select)
when you do this php will recieve the BannerSize as an array.. so in the
above scenario
$_POST['BannerSize'] will contain an array as such:
array(
0 => "300x250", #whatever was chosen in the first select
0 => "88x31-300x250" #whatever was chosen in the second select
);
now in the script you originally posted, php was using
implode($_POST['BannerSize'] , ',' );
this function was basically taking the array values and combining them
together as a single string.
the problem was that if you're form had <select name="BannerSize"> (no
brackets) then php didn't receive and array of info in
$_POST['BannerSize'] - and thus when it tried to implode the array, it
broke, as there wasn't an array within :)
now, most got confused because most people write implode with the
parameters the other way around, and they thought that was the error, so
kind of confused things. [and because you posted it about 5 times under
different names which didn't help ;)]
in short:
if you were using <select name="BannerSize[]"> 's then you'd be wanting
to implode the data as it's an array you're recieving
if you're using <select name="BannerSize"> as you currently are, then
you can forget about all the implode etc.
the ideal fix would have been to make the php code accept either and
detect if it was an array or not being passed by replacing the original
code:
if (isset($_POST['BannerSize'])){$BannerSize =
implode($_POST['BannerSize'],',');} else {$BannerSize = "";}
with this new code:
if (isset($_POST['BannerSize'])) {
if(is_array($_POST['BannerSize']) ) {
$BannerSize = implode(',', $_POST['BannerSize']); //in right order..
} else {
$BannerSize = $_POST['BannerSize'];
}
} else {
$BannerSize = "";
}
which first checks if banner size has been sent at all,
if it has is it an array? [if yes implode it, if not just pick up the
value sent]
hope that helps!
--- End Message ---
--- Begin Message ---
On 20 Nov 2008, at 14:37, Terion Miller wrote:
I currently have it like this:
<select name="BannerSize">
if you've got it working don't change it :)
but to explain:
it is possible to send through an array of data from a form, to do this
you place multiple elements with the same name followed by [] in the form..
so
<select name="BannerSize[]"> .. (our first select)
<select name="BannerSize[]"> ... (our second select)
when you do this php will recieve the BannerSize as an array.. so in the
above scenario
$_POST['BannerSize'] will contain an array as such:
array(
0 => "300x250", #whatever was chosen in the first select
0 => "88x31-300x250" #whatever was chosen in the second select
);
now in the script you originally posted, php was using
implode($_POST['BannerSize'] , ',' );
this function was basically taking the array values and combining them
together as a single string.
the problem was that if you're form had <select name="BannerSize"> (no
brackets) then php didn't receive and array of info in
$_POST['BannerSize'] - and thus when it tried to implode the array, it
broke, as there wasn't an array within :)
now, most got confused because most people write implode with the
parameters the other way around, and they thought that was the error, so
kind of confused things. [and because you posted it about 5 times under
different names which didn't help ;)]
in short:
if you were using <select name="BannerSize[]"> 's then you'd be wanting
to implode the data as it's an array you're recieving
if you're using <select name="BannerSize"> as you currently are, then
you can forget about all the implode etc.
the ideal fix would have been to make the php code accept either and
detect if it was an array or not being passed by replacing the original
code:
if (isset($_POST['BannerSize'])){$BannerSize =
implode($_POST['BannerSize'],',');} else {$BannerSize = "";}
with this new code:
if (isset($_POST['BannerSize'])) {
if(is_array($_POST['BannerSize']) ) {
$BannerSize = implode(',', $_POST['BannerSize']); //in right order..
} else {
$BannerSize = $_POST['BannerSize'];
}
} else {
$BannerSize = "";
}
which first checks if banner size has been sent at all,
if it has is it an array? [if yes implode it, if not just pick up the
value sent]
hope that helps!
--- End Message ---
--- Begin Message ---
Terion Miller wrote:
Nathan, thank you thank you thank you
now I get it! your the bomb!!
terion
joy, glad to hear it
--- End Message ---
--- Begin Message ---
On 20-Nov-08, at 2:59 AM, Nathan Rixham wrote:
Rene Fournier wrote:
On 19-Nov-08, at 12:52 PM, Nathan Rixham wrote:
Rene Fournier wrote:
Hi,
I have four identical command-line PHP scripts running, and each
will frequently fetch some data from another server via
file_get_contents(). By frequently, I mean on average, every
second.
Periodically, one of the processes (command-line PHP scripts),
will fail on file_get_contents(), with the error message:
first thing that springs to mind is some form of hardware
limitation, quite sure it's not php - could be a firewall with
flood protection (or even your own isp's anti malware set-up)
to combat it try binding the outgoing request to a random ip each
time (if you have multiple ip's on the box) [context: socket ->
bindto]
That could explain it, except that all the traffic is on the same
LAN. There's no firewall between Server A and Servers B and C.
next up (very unlikely) but possibly outgoing port conflict where
the previous local port is still closing whilst trying to be re-
opened.
That's interesting. I will look into that.
to get an ideal fix though you'll want to move away from
file_get_contents() as you're not doing things
Yes, I've also read that CURL is preferred to file_get_contents for
reasons of performance and security. I'm going to try that too.
the most efficient way; HTTP/1.1 allows you to keep a port open
and make multiple requests through the same socket/connection,
simply keep the socket open and don't send a connection: close
header after the request. (i say simply but you'll be needing to
make you're own, or find a good, http handler that allows you to
write raw requests and decode the raw http responses that come back)
best of luck; feel free to post your code incase anything jumps
out as obvious.
I will let you know how it goes. Thanks for the advice!
...Rene
had another thought, it could be the web server you're requesting
that is locking up, not enough worker threads, running cpu high etc
etc - worth checking
Don't think that can be it, since (a) the other processes are not
being denied their http requests and (b) requests are going to two
servers.
--- End Message ---
--- Begin Message ---
On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier <[EMAIL PROTECTED]> wrote:
>
> Don't think that can be it, since (a) the other processes are not being
> denied their http requests and (b) requests are going to two servers.
Have you checked your firewall settings? It may be configured to
deny requests temporarily on hosts it thinks may be attempting an HTTP
DDoS, or perhaps something similar. Nathan mentioned the same, but is
it possible that you're only considering a hardware firewall? Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).
--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
--- End Message ---
--- Begin Message ---
Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier <[EMAIL PROTECTED]> wrote:
Don't think that can be it, since (a) the other processes are not being
denied their http requests and (b) requests are going to two servers.
Have you checked your firewall settings? It may be configured to
deny requests temporarily on hosts it thinks may be attempting an HTTP
DDoS, or perhaps something similar. Nathan mentioned the same, but is
it possible that you're only considering a hardware firewall? Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).
Rene, are you forking the command line script for each request by any
chance? if you are remember to do an exit() after each one is finished
otherwise the new forked process will stay open until cleaned up by the
system (or until the thread that forked is finished) which could be
creating you're problem.
apologies if way off the mark, just attempting some lateral thinking on
this one!
--- End Message ---
--- Begin Message ---
On 20-Nov-08, at 9:56 AM, Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier
<[EMAIL PROTECTED]> wrote:
Don't think that can be it, since (a) the other processes are not
being
denied their http requests and (b) requests are going to two servers.
Have you checked your firewall settings? It may be configured to
deny requests temporarily on hosts it thinks may be attempting an HTTP
DDoS, or perhaps something similar. Nathan mentioned the same, but is
it possible that you're only considering a hardware firewall? Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).
There is no firewall between any of the servers -- they are all on the
same LAN.
...Rene
--- End Message ---
--- Begin Message ---
On 20-Nov-08, at 10:46 AM, Nathan Rixham wrote:
Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier
<[EMAIL PROTECTED]> wrote:
Don't think that can be it, since (a) the other processes are not
being
denied their http requests and (b) requests are going to two
servers.
Have you checked your firewall settings? It may be configured to
deny requests temporarily on hosts it thinks may be attempting an
HTTP
DDoS, or perhaps something similar. Nathan mentioned the same, but
is
it possible that you're only considering a hardware firewall? Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).
Rene, are you forking the command line script for each request by
any chance? if you are remember to do an exit() after each one is
finished otherwise the new forked process will stay open until
cleaned up by the system (or until the thread that forked is
finished) which could be creating you're problem.
apologies if way off the mark, just attempting some lateral thinking
on this one!
No apologies necessary -- I really appreciate the feedback.
But no, I'm not forking anything. Each script (process) runs in a
loop, and during each iteration it will call file_get_contents(Server
A/B) one or more times.
--- End Message ---
--- Begin Message ---
On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier <[EMAIL PROTECTED]> wrote:
>
> There is no firewall between any of the servers -- they are all on the same
> LAN.
I read when you said that, but I must not have explained myself
well enough before. Sorry.
Linux, by default, has firewalls installed with the OS. It
doesn't matter whether you're on a LAN, WAN, or all by your lonesome.
--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
--- End Message ---
--- Begin Message ---
On 20-Nov-08, at 12:44 PM, Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier <[EMAIL PROTECTED]>
wrote:
There is no firewall between any of the servers -- they are all on
the same
LAN.
I read when you said that, but I must not have explained myself
well enough before. Sorry.
Linux, by default, has firewalls installed with the OS. It
doesn't matter whether you're on a LAN, WAN, or all by your lonesome.
That's a good point, but I don't believe it can explain the failures,
since even though one process repeatedly fails at an HTTP request to
Server A, several other processes on the same box are successfully
executing HTTP requests (file_get_contents()).
It seems to me that I'm periodically maxing-out a certain per-process
resource limit. For example, number of open files or something
similar... (Assuming file_get_contents() counts as that)... After
10-60 seconds, previous open files/connections for that particular
process close, allowing it to again open HTTP requests to Server A. I
I guess my next question is, what resource does file_get_contents()
use upon execution?
...Rene
--- End Message ---
--- Begin Message ---
Rene Fournier wrote:
On 20-Nov-08, at 12:44 PM, Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier <[EMAIL PROTECTED]>
wrote:
There is no firewall between any of the servers -- they are all on
the same
LAN.
I read when you said that, but I must not have explained myself
well enough before. Sorry.
Linux, by default, has firewalls installed with the OS. It
doesn't matter whether you're on a LAN, WAN, or all by your lonesome.
That's a good point, but I don't believe it can explain the failures,
since even though one process repeatedly fails at an HTTP request to
Server A, several other processes on the same box are successfully
executing HTTP requests (file_get_contents()).
It seems to me that I'm periodically maxing-out a certain per-process
resource limit. For example, number of open files or something
similar... (Assuming file_get_contents() counts as that)... After
10-60 seconds, previous open files/connections for that particular
process close, allowing it to again open HTTP requests to Server A. I
I guess my next question is, what resource does file_get_contents()
use upon execution?
...Rene
is it an https(ssl) address you're calling, and more specifically IIS
servers? if so they don't close the connection properly meaning the
connections will be left open until they time out andthus cause you're
problem.
--- End Message ---
--- Begin Message ---
On 20-Nov-08, at 3:57 PM, Nathan Rixham wrote:
Rene Fournier wrote:
On 20-Nov-08, at 12:44 PM, Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier
<[EMAIL PROTECTED]> wrote:
There is no firewall between any of the servers -- they are all
on the same
LAN.
I read when you said that, but I must not have explained myself
well enough before. Sorry.
Linux, by default, has firewalls installed with the OS. It
doesn't matter whether you're on a LAN, WAN, or all by your
lonesome.
That's a good point, but I don't believe it can explain the
failures, since even though one process repeatedly fails at an HTTP
request to Server A, several other processes on the same box are
successfully executing HTTP requests (file_get_contents()).
It seems to me that I'm periodically maxing-out a certain per-
process resource limit. For example, number of open files or
something similar... (Assuming file_get_contents() counts as
that)... After 10-60 seconds, previous open files/connections for
that particular process close, allowing it to again open HTTP
requests to Server A. I
I guess my next question is, what resource does file_get_contents()
use upon execution?
...Rene
is it an https(ssl) address you're calling, and more specifically
IIS servers? if so they don't close the connection properly meaning
the connections will be left open until they time out andthus cause
you're problem.
Nope, it's just http, port 80, and not to IIS. To be clear, PHP
scripts/processes on Server A (Mac OS X Server 10.4.11, PHP 5.2.4) are
issuing these http requests (file_get_contents) to Servers B (Centos
5.2) and itself (Server A).
The failures occur on attempts to Server B and A (itself), but only in
one process at a time. (Server A is running several identical scripts/
processes -- even while one fails for a while, the others work -- that
is, Servers B and A respond fine.)
...Rene
--- End Message ---
--- Begin Message ---
Stut schreef:
> On 20 Nov 2008, at 01:29, Rene Fournier wrote:
>> I'm trying to understand something about fread(). I'm using fread() on
>> an incoming socket stream that will send, for example, 26630 characters:
>>
>> while ( ($buf=fread($read[$i], 8192)) != '' ) {
>> $sock_data .= $buf;
>> usleep(1000);
>> echo ".";
>> }
>> echo ",";
>>
>>
>> As soon as the socket client sends the data, immediately the server
>> will echo:
>>
>> ................................................................................................................................................
>>
>>
>> Then wait nearly a minute, and echo:
>>
>> ,
>>
>> So my question is, why does fread wait if there is nothing more to
>> read? Shouldn't it return immediately? (That's what I want.) And as
>> for the delay, it's there so that if the incoming data is a little
>> slow, it has time to catch up with fread. Thanks.
>
> As Craige already mentioned, fread will read bytes until it meets an EOF
> so unless the other side sends one or closes the socket fread will wait
> for the number of characters you've asked for (8192) or a timeout (which
> is the delay you're seeing). In other words it's not detecting the end
> of the data, it's just timing out waiting for more.
>
> You ideally want to have the other side tell you how many bytes it's
> going to send. If you can't do that then hopefully the data you're
> receiving has some sort of structure so you can check the incoming data
> for some terminating string. If not then you've got a problem that can't
> be reliably solved. You could mess around with the timeout and/or make
> use of functions like socket_select to check for waiting data, but what
> you'll end up with will be problematic on slow connections and generally
> unreliable.
good stuff from Stut & Craige ... I just wondered, Im pretty sure that the
usleep(1000) is completely superfluous. fread() will read to the buffer length
or EOF regardless of how slow the stream trickles in (obviously it may timeout
if nothing trickles in for ages but that's a different issue and not solved
with a usleep() AFAICT).
>
> -Stut
>
--- End Message ---
--- Begin Message ---
My prime hobby is photography and the next is web site building.
So now I have a young model (18+) asking me about getting a web site.
The idea is members can see content, that will include, photos, her blog
and a discussion forum.
I like the idea of building it, but it includes a lot of things I have
no experience in.
Can someone point me to documentation/tutorials/scripts or anything that
might help.
I don't want a turnkey solution. I want to learn how to do this.
Thank you!
Stephen
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Stephen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 20, 2008 4:17 PM
> To: PHP-General
> Subject: [PHP] Model Web Site
>
> My prime hobby is photography and the next is web site building.
>
> So now I have a young model (18+) asking me about getting a web site.
>
> The idea is members can see content, that will include, photos, her
> blog
> and a discussion forum.
>
> I like the idea of building it, but it includes a lot of things I have
> no experience in.
>
> Can someone point me to documentation/tutorials/scripts or anything
> that
> might help.
>
> I don't want a turnkey solution. I want to learn how to do this.
http://www.w3schools.com/html
http://www.w3schools.com/xhtml
http://www.w3schools.com/css
http://www.w3schools.com/js
http://www.w3schools.com/php
http://www.w3schools.com/sql
http://www.php.net
http://www.mysql.com
most important link:
http://www.google.com
Get comfortable with programming; with algorithms; with data structures;
with databases; with client-server relationships.
HTH,
// Todd
--- End Message ---
--- Begin Message ---
On Thu, Nov 20, 2008 at 5:16 PM, Stephen <[EMAIL PROTECTED]> wrote:
>
> Can someone point me to documentation/tutorials/scripts or anything that
> might help.
Stephen,
The whole thing could be built pretty quickly using existing open
source systems such as phpBB3[1] and Gallery[2] as a core. Then it's
a matter of putting up smaller additional scripts to link your other
things together.
1: http://www.phpbb.com/
2: http://www.nukedgallery.net/
Just some examples, of course. There are literally thousands of
options, including building your own or hiring someone to do it. You
should have no problem jumping right in.
--
</Daniel P. Brown>
http://www.parasane.net/
[EMAIL PROTECTED] || [EMAIL PROTECTED]
1 LEFT: $149/mo. $0 Setup - Dual-Core/320GB HDD/1GB RAM/3TB
100Mbps/cPanel - SAME-DAY SETUP! Contact me to buy.
--- End Message ---
--- Begin Message ---
Boyd, Todd M. wrote:
http://www.w3schools.com/html
http://www.w3schools.com/xhtml
http://www.w3schools.com/css
http://www.w3schools.com/js
http://www.w3schools.com/php
http://www.w3schools.com/sql
http://www.php.net
http://www.mysql.com
most important link:
http://www.google.com
Get comfortable with programming; with algorithms; with data structures;
with databases; with client-server relationships.
HTH,
Thanks ..... but ... ouch!
I have been doing HTML sites for 5 years. CSS for four and PHP/MySQL for
three.
What is new to me is controlling access based on being a member. And
making it tough for hackers.
Stephen
--- End Message ---
--- Begin Message ---
Stephen wrote:
Boyd, Todd M. wrote:
http://www.w3schools.com/html
http://www.w3schools.com/xhtml
http://www.w3schools.com/css
http://www.w3schools.com/js http://www.w3schools.com/php
http://www.w3schools.com/sql
http://www.php.net
http://www.mysql.com
most important link:
http://www.google.com
Get comfortable with programming; with algorithms; with data structures;
with databases; with client-server relationships.
HTH,
Thanks ..... but ... ouch!
I have been doing HTML sites for 5 years. CSS for four and PHP/MySQL for
three.
..none of which was originally mentioned.
What is new to me is controlling access based on being a member. And
making it tough for hackers.
Look for a tutorial on building a login system and go from there.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
>> What is new to me is controlling access based on being a member. And
>> making it tough for hackers.
>
> Look for a tutorial on building a login system and go from there.
Since you mentioned security I would recommend HTTPS.
http://en.wikipedia.org/wiki/HTTPS
--- End Message ---
--- Begin Message ---
As Daniel mentioned, I would recomed building it upon an existing
system. I've seen whole sites custom built around PHPBB.
This might be something you want to look into. Google for PHPBB
programming tutorials; it's pretty well documented. I think it's your
best bet if you don't want to spend forever building it from the ground-up.
PHPNuke might be a good option too, but I never liked it myself. It's
all provided out of the box though.
- Craige
--- End Message ---
--- Begin Message ---
On Thu, 2008-11-20 at 09:25 +0000, Stut wrote:
> On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote:
> > I wanted to use in_array to verify the results of a form submission
> > for a checkbox and found an interesting
> > behaviour.
> >
> > $ php -v
> > PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37)
> > $
> >
> > $ cat in_array2.php
> > <?php
> > $node_review_types = array(
> > 'page' => 'page',
> > 'story' => 'story',
> > 'nodereview' => 'abc',
> > );
> >
> > if (in_array('page', $node_review_types)) {
> > print "page found in node_review_types\n";
> > }
> > if (in_array('nodereview', $node_review_types)) {
> > print "nodereview found in node_review_types\n";
> > }
> >
> > ?>
> > $ php in_array2.php
> > page found in node_review_types
> > $
> >
> > This works fine. but if i change the value of the key 'nodereview' to
> > 0 it breaks down.
> >
> > $ diff in_array2.php in_array3.php
> > 6c6
> > < 'nodereview' => 'abc',
> > ---
> >> 'nodereview' => 0,
> > $
> >
> > $ php in_array3.php
> > page found in node_review_types
> > nodereview found in node_review_types
> > $
> >
> > Any reason why in_array is returning TRUE when one has a 0 value on
> > the array ?
>
> That's weird, 5.2.6 does the same thing. There's actually a comment
> about this on the in_array manual page from james dot ellis at gmail
> dot com...
>
> <quote>
>
> Be aware of oddities when dealing with 0 (zero) values in an array...
>
> This script:
> <?php
> $array = array('testing',0,'name');
> var_dump($array);
> //this will return true
> var_dump(in_array('foo', $array));
> //this will return false
> var_dump(in_array('foo', $array, TRUE));
> ?>
>
> It seems in non strict mode, the 0 value in the array is evaluating to
> boolean FALSE and in_array returns TRUE. Use strict mode to work
> around this peculiarity.
> This only seems to occur when there is an integer 0 in the array. A
> string '0' will return FALSE for the first test above (at least in
> 5.2.6).
>
> </quote>
>
> So use strict mode and this problem will go away. Oh, and please read
> the manual before asking a question in future.
>
> -Stut
>
> --
> http://stut.net/
>
What about using the === and !== comparisons to compare and make sure
that 0 is not giving a false false.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Well can it?
--- End Message ---
--- Begin Message ---
No but you can use imagemagicks convert to convert the pdf to an image and
then make a thumbnail of it.
On 11/20/08 4:39 PM, "Brian Dunning" <[EMAIL PROTECTED]> wrote:
> Well can it?
--
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*
--
--- End Message ---