[PHP] Re: [PHP-DEV] How expensive are function_exists() calls?

2009-03-04 Thread mike
On Wed, Mar 4, 2009 at 4:01 AM, Jochem Maas joc...@iamjochem.com wrote:
 ..not an internals question me thinks ... redirecting to generals mailing list

Actually, I do think it is somewhat internals related.

I want to know from the internals/experts angle if this is a good
function to be relying on, or if it is one of those things like the
@ operator which I've been told is expensive and to me is one of
those things to stay away from.

Now if this breaks opcode caches like APC, I will have to find another way.

Also - I write procedural, not OOP. So that won't help here.

Would creating functions such as

output_foo_html()
output_foo_rss()
output_foo_json()

Then depending on the output, using something like this? Would this be
breaking opcode caches as well then?

if(function_exists('output_foo_'.$format)) {
call_user_func('output_foo_'.$format);
} else {
output_foo_html();
}

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



Re: [PHP] Re: [PHP-DEV] How expensive are function_exists() calls?

2009-03-04 Thread Robert Cummings
On Wed, 2009-03-04 at 11:45 -0800, mike wrote:
 On Wed, Mar 4, 2009 at 4:01 AM, Jochem Maas joc...@iamjochem.com wrote:
  ..not an internals question me thinks ... redirecting to generals mailing 
  list
 
 Actually, I do think it is somewhat internals related.
 
 I want to know from the internals/experts angle if this is a good
 function to be relying on, or if it is one of those things like the
 @ operator which I've been told is expensive and to me is one of
 those things to stay away from.
 
 Now if this breaks opcode caches like APC, I will have to find another way.
 
 Also - I write procedural, not OOP. So that won't help here.
 
 Would creating functions such as
 
 output_foo_html()
 output_foo_rss()
 output_foo_json()
 
 Then depending on the output, using something like this? Would this be
 breaking opcode caches as well then?
 
 if(function_exists('output_foo_'.$format)) {
 call_user_func('output_foo_'.$format);
 } else {
 output_foo_html();
 }

Perfectly fine. Shouldn't break an opcode cache. the opcode cache will
store the opcodes to do what you've done above and also will store
opcodes for the function wherever it was declared. Then when it runs off
it will go. For what it's worth... functions have global scope... all
functions are store in some kind of lookup table. Associative arrays
have O( lg n ) lookup time. Let's imagine you had 1 million defined
functions... We're talking at most 19 node traversals on a balanced
binary tree (yes I know it's a hashing algorithm). A billion declared
functions 29 steps. Is it fast? Yes.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] Re: [PHP-DEV] How expensive are function_exists() calls?

2009-03-04 Thread Jochem Maas
mike schreef:
 On Wed, Mar 4, 2009 at 4:01 AM, Jochem Maas joc...@iamjochem.com wrote:
 ..not an internals question me thinks ... redirecting to generals mailing 
 list
 
 Actually, I do think it is somewhat internals related.

internals is about engine development. always ask on the generals list
first, you can always escalate the question if no-one there can offer
any help.

 
 I want to know from the internals/experts angle if this is a good
 function to be relying on, or if it is one of those things like the
 @ operator which I've been told is expensive and to me is one of
 those things to stay away from.
 
 Now if this breaks opcode caches like APC, I will have to find another way.
 
 Also - I write procedural, not OOP. So that won't help here.

whatever. sounds like a limited way of looking at things, nonetheless
it's perfectly feasable to write the registry pattern using
functions a/some global var(s).

 Would creating functions such as
 
 output_foo_html()
 output_foo_rss()
 output_foo_json()
 
 Then depending on the output, using something like this? Would this be
 breaking opcode caches as well then?

no, the thing that breaks the opcode cache is when you declare a function
conditionally because the function declaration has to be deferred until
runtime. there are plenty of detailed posts on the internals list
about this (try searching for 'APC' will likely turn up quite alot).

 if(function_exists('output_foo_'.$format)) {
 call_user_func('output_foo_'.$format);
 } else {
 output_foo_html();
 }

you don't need call_user_func() here (which is very handy but also slow):

$func = 'output_foo_'.$format;
if (function_exists($func))
$func();
else
output_foo_html();



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



[PHP] Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Terion Miller
On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

 ---

well I looked it up in my book and tried this example but still get the same
thing, the first record

$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;
//print a return for neatness sake
echo \n;


Re: [PHP] Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 11:08 -0600, Terion Miller wrote:
 On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:
 
  Terion Miller wrote:
   I have two queries one pulls out which users to use and the second pulls
   those users orders
   Looks something like this but is only pulling the first record:
  
  
   $query =  SELECT `UserName`, `AdminID` FROM admin
 WHERE   Key1 =  'YES' ;
  
   $result = mysql_query ($query) ;
   $row = mysql_fetch_assoc($result);
  
   //Reveal Variables for Debugging
   // include(VariableReveal2.php);
echo (Hello br);
   //echo $row['AdminID'];
   echo ($row['UserName']);
  
  
  
  
   if ($row['Key1'] == NO) {
   header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
   not have access to that page.);
   }
  
   if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
   'WorkOrderID DESC';}
   if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
  
   $PerPage = 30;
   $StartPage = ($Page - 1) * $PerPage;
  
   second query here is using the $row from the first (and yes I
  know
   not to use *, just did so here to keep post shorter)
  
$sql= SELECT * FROM workorders WHERE AdminID =
   '.$row['AdminID'].' ;
 // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
 $result = mysql_query ($sql);
 $row2 = mysql_fetch_assoc($result);
 $Total = ceil(mysql_num_rows($result)/$PerPage);
  
  
   So this works but only half way as it only displays the first record
  in
   the table.
  
  
  
  
   Thanks
   Terion
  
   Happy Freecycling
   Free the List !!
   www.freecycle.org
   Over Moderation of Freecycle List Prevents Post Timeliness.
   
   Twitter?
   http://twitter.com/terionmiller
   
   Facebook:
   a href=http://www.facebook.com/people/Terion-Miller/1542024891;
   title=Terion Miller's Facebook profile target=_TOPimg src=
   http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
   alt=Terion Miller's Facebook profile/a
   Groucho Marx  - I have had a perfectly wonderful evening, but this
  wasn't
   it.
  
 
  You need to lookup the mysql_fetch_assoc() function.  It only returns
  one row from a result set that may contain multiple rows.  You need
  something like:
 
  while($row = mysql_fetch_assoc($result)) {
   // do something with $row
  }
 
  ---
 
 well I looked it up in my book and tried this example but still get the same
 thing, the first record
 
 $result = mysql_query ($query) ;
 //$row = mysql_fetch_array($result);
 while ($row = mysql_fetch_row($result)){
 for ($i=0; $imysql_num_fields($result); $i++)
 echo $row[$i] .  ;
 //print a return for neatness sake
 echo \n;
What happens if you just change your while loop to this:

while($row = mysql_fetch_array($result))
{
print_r($row);
}


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: [PHP-DB] How important is your Express or Web Edition database? Please weigh in--

2009-03-02 Thread Waynn Lue
Yeah, that's definitely true. I've just been bitten too many times by
a design that ended up being not flexible enough. :)

Waynn

On 2/28/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
 On Sat, 2009-02-28 at 16:08 -0800, Waynn Lue wrote:
 Plus, last time I checked, adding an enum required a full rebuild of
 the table, while having an auxiliary table allows it to happen much
 more quickly.

 Waynn

 On 2/28/09, Andrew Ballard aball...@gmail.com wrote:
  On Sat, Feb 28, 2009 at 5:13 AM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  On Sat, 2009-02-28 at 01:04 -0500, Andrew Ballard wrote:
  On Fri, Feb 27, 2009 at 7:32 PM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  I absolutely love enum datatypes; they allow you to use string values
  but internally stores them as numbers, and prevents the wrong data from
  being inserted. Much simpler than joining extra tables of values onto
  it.
 
  Oh, I know why programmers love them. I like them for a lot of the
  same reasons, but I'm enough of a DBA that I'm still not sure they are
  a very good idea in a SQL database. Granted, indexes on an ENUM column
  will be more useful than on SET columns, but what do you do when you
  need to add a value to the list? You have to have permission to modify
  the database, and you are limited to about 64 values. In some projects
  that's an acceptable constraint. I tend to like auxilliary tables
  better because I can easily add an admin interface to an app to allow
  users with sufficient permission to add their own values as needed
  without granting them access to muck around with the actual table
  structure, I'm NOT limited to 64 values, and indexes work even in 1:m
  (SET) cases in addition to 1:1 (ENUM) relationships.
 
  You can't add extra fields to an ENUM to track when a value was added
  to the list, whether it is no longer a valid value for new records
  (since it probably can't be deleted because of referential integrity),
  or any other information that might be relevant to the value. I know
  these aren't needed in every case, but I generally like to plan for
  extensibility if it doesn't require very much additional effort.
 
 
  Andrew
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 I'm not saying it is a replacement for auxiliary tables, but in a lot of
 cases, an enum works far better. Consider a column called display_status
 for a set of content pages. Having an enum type for 'live' and 'draft'
 is perfect, and likely not to change in the future. Using an external
 table is overkill, and reducing it to a number value that you then have
 to remember throughout your code doesn't make sense when the enum type
 makes it more logical. At the end of the day, it is down to personal
 taste, but I find a lot of good uses for enum, especially in CMS
 development.


 Ash
 www.ashleysheridan.co.uk



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



[PHP] Re: [PHP-DB] How important is your Express or Web Edition database? Please weigh in--

2009-02-28 Thread Waynn Lue
Plus, last time I checked, adding an enum required a full rebuild of
the table, while having an auxiliary table allows it to happen much
more quickly.

Waynn

On 2/28/09, Andrew Ballard aball...@gmail.com wrote:
 On Sat, Feb 28, 2009 at 5:13 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 On Sat, 2009-02-28 at 01:04 -0500, Andrew Ballard wrote:
 On Fri, Feb 27, 2009 at 7:32 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 I absolutely love enum datatypes; they allow you to use string values
 but internally stores them as numbers, and prevents the wrong data from
 being inserted. Much simpler than joining extra tables of values onto
 it.

 Oh, I know why programmers love them. I like them for a lot of the
 same reasons, but I'm enough of a DBA that I'm still not sure they are
 a very good idea in a SQL database. Granted, indexes on an ENUM column
 will be more useful than on SET columns, but what do you do when you
 need to add a value to the list? You have to have permission to modify
 the database, and you are limited to about 64 values. In some projects
 that's an acceptable constraint. I tend to like auxilliary tables
 better because I can easily add an admin interface to an app to allow
 users with sufficient permission to add their own values as needed
 without granting them access to muck around with the actual table
 structure, I'm NOT limited to 64 values, and indexes work even in 1:m
 (SET) cases in addition to 1:1 (ENUM) relationships.

 You can't add extra fields to an ENUM to track when a value was added
 to the list, whether it is no longer a valid value for new records
 (since it probably can't be deleted because of referential integrity),
 or any other information that might be relevant to the value. I know
 these aren't needed in every case, but I generally like to plan for
 extensibility if it doesn't require very much additional effort.


 Andrew

 --
 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: [PHP-DB] How important is your Express or Web Edition database? Please weigh in--

2009-02-28 Thread Ashley Sheridan
On Sat, 2009-02-28 at 16:08 -0800, Waynn Lue wrote:
 Plus, last time I checked, adding an enum required a full rebuild of
 the table, while having an auxiliary table allows it to happen much
 more quickly.
 
 Waynn
 
 On 2/28/09, Andrew Ballard aball...@gmail.com wrote:
  On Sat, Feb 28, 2009 at 5:13 AM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  On Sat, 2009-02-28 at 01:04 -0500, Andrew Ballard wrote:
  On Fri, Feb 27, 2009 at 7:32 PM, Ashley Sheridan
  a...@ashleysheridan.co.uk wrote:
  I absolutely love enum datatypes; they allow you to use string values
  but internally stores them as numbers, and prevents the wrong data from
  being inserted. Much simpler than joining extra tables of values onto
  it.
 
  Oh, I know why programmers love them. I like them for a lot of the
  same reasons, but I'm enough of a DBA that I'm still not sure they are
  a very good idea in a SQL database. Granted, indexes on an ENUM column
  will be more useful than on SET columns, but what do you do when you
  need to add a value to the list? You have to have permission to modify
  the database, and you are limited to about 64 values. In some projects
  that's an acceptable constraint. I tend to like auxilliary tables
  better because I can easily add an admin interface to an app to allow
  users with sufficient permission to add their own values as needed
  without granting them access to muck around with the actual table
  structure, I'm NOT limited to 64 values, and indexes work even in 1:m
  (SET) cases in addition to 1:1 (ENUM) relationships.
 
  You can't add extra fields to an ENUM to track when a value was added
  to the list, whether it is no longer a valid value for new records
  (since it probably can't be deleted because of referential integrity),
  or any other information that might be relevant to the value. I know
  these aren't needed in every case, but I generally like to plan for
  extensibility if it doesn't require very much additional effort.
 
 
  Andrew
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
I'm not saying it is a replacement for auxiliary tables, but in a lot of
cases, an enum works far better. Consider a column called display_status
for a set of content pages. Having an enum type for 'live' and 'draft'
is perfect, and likely not to change in the future. Using an external
table is overkill, and reducing it to a number value that you then have
to remember throughout your code doesn't make sense when the enum type
makes it more logical. At the end of the day, it is down to personal
taste, but I find a lot of good uses for enum, especially in CMS
development.


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: ?php=

2009-02-16 Thread Colin Guthrie

'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:

...


Sorry, should've mentioned, I'm talking about PHP6.


Not heard about it but I'd like it. Short tags are evil but the ?= 
thing is pretty handy so having a ?php= option would suit me quite nicely.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: ?php=

2009-02-16 Thread Eric Butera
On Mon, Feb 16, 2009 at 2:58 PM, Colin Guthrie gm...@colin.guthr.ie wrote:
 'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:

Those reply lines are funny.  =)

-- 
http://www.voom.me | EFnet: #voom

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



[PHP] Re: ?php=

2009-02-16 Thread Colin Guthrie

'Twas brillig, and Eric Butera at 16/02/09 20:01 did gyre and gimble:

On Mon, Feb 16, 2009 at 2:58 PM, Colin Guthrie gm...@colin.guthr.ie wrote:

'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:


Those reply lines are funny.  =)


Can't take credit as I saw someone else with it and *ahem* liberated it. 
I remember reading the source of it at school so it brought a smile... 
Still one of my favourite poems :)


Col

PS: for those who don't know, it's the Jabberwocky by Lewis Carroll:
http://www.jabberwocky.com/carroll/jabber/jabberwocky.html

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



RE: [PHP] Re: ?php=

2009-02-16 Thread Hans Zaunere
  Sorry, should've mentioned, I'm talking about PHP6.
 
 Not heard about it but I'd like it. Short tags are evil but the ?=
 thing is pretty handy so having a ?php= option would suit me quite
 nicely.

Agree - while the short tags can be annoying, we need some way to shorthand 
string output and I think good fit.  Has this been listed as coming at the same 
time as short tags go away (or preferably, before...)?

---
Hans Zaunere / Managing Member / New York PHP
  www.nyphp.org  /  www.nyphp.com





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



RE: [PHP] Re: ?php=

2009-02-16 Thread Mike Roberts
Please folks, honor my request and remove me from the list. Yes I signed up 
intentionally, and yes I tried (3 times) to de-list myself but I still get the 
emails. You guys seem like nice folks, so I don't want to lodge a complaint 
somewhere... I just one somebody to take responsibility and delete me from the 
list. 



 Michael Roberts
 Senior Recruitment Strategist
 Corporate Staffing Services
 150 Monument Road, Suite 510
 Bala Cynwyd, PA 19004
 P 610-771-1084
 F 610-771-0390
 E mrobe...@jobscss.com


-Original Message-
From: news [mailto:n...@ger.gmane.org] On Behalf Of Colin Guthrie
Sent: Monday, February 16, 2009 3:14 PM
To: php-general@lists.php.net
Subject: [PHP] Re: ?php=

'Twas brillig, and Eric Butera at 16/02/09 20:01 did gyre and gimble:
 On Mon, Feb 16, 2009 at 2:58 PM, Colin Guthrie gm...@colin.guthr.ie wrote:
 'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:
 
 Those reply lines are funny.  =)

Can't take credit as I saw someone else with it and *ahem* liberated it. 
I remember reading the source of it at school so it brought a smile... 
Still one of my favourite poems :)

Col

PS: for those who don't know, it's the Jabberwocky by Lewis Carroll:
http://www.jabberwocky.com/carroll/jabber/jabberwocky.html

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: ?php=

2009-02-16 Thread Stuart
2009/2/16 Mike Roberts mrobe...@jobscss.com:
 Please folks, honor my request and remove me from the list. Yes I signed up 
 intentionally, and yes I tried (3 times) to de-list myself but I still get 
 the emails. You guys seem like nice folks, so I don't want to lodge a 
 complaint somewhere... I just one somebody to take responsibility and delete 
 me from the list.

What exactly have you done three times?

Send an email to php-general-unsubscr...@lists.php.net then follow the
instructions in the automated email you receive, usually a few minutes
later. If this is what you've done already then there may be a problem
with the system, but please make sure you've fully read, understood
and actioned the instructions in the email you get back.

-Stuart

-- 
http://stut.net/

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



[PHP] Re: ?php=

2009-02-16 Thread tedd

At 7:58 PM + 2/16/09, Colin Guthrie wrote:

'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:

...


Sorry, should've mentioned, I'm talking about PHP6.


Not heard about it but I'd like it. Short tags are evil but the ?= 
thing is pretty handy so having a ?php= option would suit me quite 
nicely.


Col


Any time I see that short tag, I want to change it -- I'm almost 
obsessive about it.


My vote would be to never use the short tag every again.

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] Re: ?php=

2009-02-16 Thread Eric Butera
On Mon, Feb 16, 2009 at 6:32 PM, tedd tedd.sperl...@gmail.com wrote:
 At 7:58 PM + 2/16/09, Colin Guthrie wrote:

 'Twas brillig, and Richard Heyes at 16/02/09 15:04 did gyre and gimble:

 ...

 Sorry, should've mentioned, I'm talking about PHP6.

 Not heard about it but I'd like it. Short tags are evil but the ?= thing
 is pretty handy so having a ?php= option would suit me quite nicely.

 Col

 Any time I see that short tag, I want to change it -- I'm almost obsessive
 about it.

 My vote would be to never use the short tag every again.

 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



As long as we're taking votes... Most of my template code looks like this:
?php echo $this-escape($this-var) ?

I'd be happy to never see any variation of ?= again as it is not the
bottleneck of my productivity.

-- 
http://www.voom.me | EFnet: #voom

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



RE: [PHP] Re: ?php=

2009-02-16 Thread Hans Zaunere
 As long as we're taking votes... Most of my template code looks like
 this:
 ?php echo $this-escape($this-var) ?
 
 I'd be happy to never see any variation of ?= again as it is not the
 bottleneck of my productivity.

I can appreciate that, but PHP *is* a templating language that is meant to 
embed dynamic strings into static strings.

Therefore, I strongly agree that there should be a shorthand for this type of 
thing.  When considering correct separation of code and templates, this output 
of dynamic strings should be optimized in all ways possible - both performance 
wise and syntactically.

And yes, all of my template code uses short tags for direct string output and 
the short tags do cause problems so I'm looking forward to a better way.  Even 
in PHP 5 :)

H




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



[PHP] Re: PHP OOP

2009-02-10 Thread Ondrej Kulaty
I don't think that PHP is good language for teaching OOP as many folks above 
said. I have never programmed in OOP style but i plan to learn it. I started 
in PHP but i was little confused and i am used to program in procedural way 
in PHP, so i've decided to learn some pure OOP language. I am reading a book 
OOP Demystified, there are examples in both C++ and Java. And imo Java code 
is much more readable and understandable. So i think that Java is the best 
for learning OOP. I am also considering learning C#, if you dont mind that 
it's closely related to windows, it might be also a good choice.
-- 

tedd t...@sperling.com píse v diskusním príspevku 
news:p0624080dc5b5fff1c...@[192.168.1.101]...
 Hi gang:

 At the college where I teach, they are considering teaching OOP, but they 
 don't want to settle on a specific language.

 My thoughts are it's difficult to teach OOP without a language -- 
 while the general concepts of OOP are interesting, people need to see how 
 concepts are applied to understand how they work -- thus I think a 
 specific language is required

 I lean toward C++ because I wrote in it for a few years AND C++ appears to 
 be the most common, widespread, and popular OOP language.

 However, while I don't know PHP OOP, I am open to considering it because 
 of the proliferation of web based applications. My personal opinion is 
 that's where all programming is headed anyway, but that's just my opinion.

 With that said, what's the differences and advantages/disadvantages 
 between C++ and PHP OOP?

 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: php get rss tag using DOM

2009-02-09 Thread Rob Richards

Morris wrote:

I know rss_php, but it doesn't fit my solution.

Is anyone able to help me with my question?

thx

2009/2/8 Nathan Rixham nrix...@gmail.com


 Morris wrote:


Hi,

I am trying to write a programme to read a rss xml file.

...
media:content url=*exampe.jpg* ...
...

   scan anyone tell me how to get the url attribute? I wrote some codes
similar:


 $doc = new DOMDocument;
 $doc-load($myFlickrRss);

 $r = $doc-getElementsByTagName('media:content');
 for($i=0;$i=$r-length;$i++)  {

 // help here

 }



use http://rssphp.net/ you can view the source online and it's all done
using DOMDocuments :)





First off, you should be using getElementsByTagNameNS since you are 
working with a namespaced document. I am assuming its a Yahoo Media RSS 
feed, so you would get the elements via:
$r = $doc-getElementsByTagNameNS(http://search.yahoo.com/mrss/;, 
content);


Then to output the url attribute value:

foreach ($r AS $elem) {
   echo $elem-getAttribute(url) . \n;
}

Rob

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



[PHP] Re: php get rss tag using DOM

2009-02-08 Thread Nathan Rixham

Morris wrote:

Hi,

I am trying to write a programme to read a rss xml file.

...
media:content url=*exampe.jpg* ...
...

scan anyone tell me how to get the url attribute? I wrote some codes
similar:


 $doc = new DOMDocument;
 $doc-load($myFlickrRss);

 $r = $doc-getElementsByTagName('media:content');
 for($i=0;$i=$r-length;$i++)  {

  // help here

 }



use http://rssphp.net/ you can view the source online and it's all done 
using DOMDocuments :)


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



[PHP] Re: php get rss tag using DOM

2009-02-08 Thread Morris
I know rss_php, but it doesn't fit my solution.

Is anyone able to help me with my question?

thx

2009/2/8 Nathan Rixham nrix...@gmail.com

  Morris wrote:

 Hi,

 I am trying to write a programme to read a rss xml file.

 ...
 media:content url=*exampe.jpg* ...
 ...

scan anyone tell me how to get the url attribute? I wrote some codes
 similar:


  $doc = new DOMDocument;
  $doc-load($myFlickrRss);

  $r = $doc-getElementsByTagName('media:content');
  for($i=0;$i=$r-length;$i++)  {

  // help here

  }


 use http://rssphp.net/ you can view the source online and it's all done
 using DOMDocuments :)



[PHP] Re: PHP pop-up windows

2009-02-06 Thread Clancy
On Thu, 05 Feb 2009 01:47:28 +, nrix...@gmail.com (Nathan Rixham) wrote:

Clancy wrote:
 I'm working on a website editor, primarily for my own use. Normally it will 
 be used on my
 own computer, and much of what I wish to achieve could arguably be better 
 done in either C
 or JavaScript, but both of these have a similar programming syntax to PHP, 
 but with subtle
 differences, and I don't think my brain could cope with trying to work in 
 two similar but
 different languages simultaneously.
...

 Is this a feasible mode of operation, and if so would anyone like to suggest 
 ways to
 implement it, and/or traps to be avoided?

if ever somebody needed flex, it's you

Thanks. But what is flex?

1. Flex electrical cable: I've got plenty of that out in the shed, but it 
doesn't seem to
be relevant here (unless I decide that it is all too much, and decide to hang 
myself with
it!)

2. Single tasking operating system for the Motorola 6800: I once programmed in 
6800
assembler, but I rather doubt if you can buy it, or them, these days.

3. Bodybuilding magazine: too late for that!

4. Adobe application builder - widely criticised for being inflexible: not what 
I'm
looking for.

Perhaps I ought to just give up, and get somebody else to do the job for me, 
but then I
would get the solution to somebody else's problem.  

Also, although my mental agility is less than it used to be, so that I can't 
really handle
working in multiple environments, I still enjoy programming, and it does keep 
my brain
from going rusty!

I have had what seems to me to be a bright idea, and I wondered if anybody had 
tried
anything similar, and could cast any light either on how to go about it, or on 
problems
that I might encounter. 

Just telling me to use something else, without explaining what it is or why it 
is better,
is not really being helpful.

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



[PHP] Re: PHP pop-up windows

2009-02-04 Thread Nathan Rixham

Clancy wrote:

I'm working on a website editor, primarily for my own use. Normally it will be 
used on my
own computer, and much of what I wish to achieve could arguably be better done 
in either C
or JavaScript, but both of these have a similar programming syntax to PHP, but 
with subtle
differences, and I don't think my brain could cope with trying to work in two 
similar but
different languages simultaneously.

 An example of what I would like to achieve is:

The primary instance of the program opens a text input window for the user to 
enter, say,
one or more addresses from the contact list. It then pops up a second window, 
which could
be another instance of the same program. In this window the user can search the 
contacts
for the names he wants, and highlight them. When he is satisfied he clicks the 
submit
button on the second window.

When he does this the second window closes, and the primary window detects the 
response,
processes it, and inserts it into the entry area.

I gather that it would be possible for the first program to spawn a child 
process when the
user clicks the button, and this could then open the second window. I think 
that the child
can share session variables with the parent, so the parent could redraw its 
window, then
wait for some flag to be set in the session window, indicating the second 
window was
closing. The parent would then redraw its page incorporating the new 
information.

Is this a feasible mode of operation, and if so would anyone like to suggest 
ways to
implement it, and/or traps to be avoided?




if ever somebody needed flex, it's you

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



Re: [PHP] Re: PHP webhosting - USA - conclusion

2009-02-04 Thread Thodoris


I should have said in the beginning it's a small website and I am not 
looking for a dedicated server.


Howewer, I decided to move to Lypha.com

Thanks for all your fruitful* comments :)
Martin


PS: PHP mailgroup rulz

*) that was in dictionary



You could check ICDsoft

http://www.icdsoft.com/

--
Thodoris


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



[PHP] Re: [PHP-QA] problem code

2009-02-01 Thread Daniel Brown
Top-posting.

Chris, you're on the wrong list.  Please send messages like this
to php-general@lists.php.net, and subscribe[1] to that list to follow
along.  This QA list is for the PHP Quality-Assurance Team.

1: http://php.net/mailinglists - or - php-general-subscr...@lists.php.net



On Sun, Feb 1, 2009 at 14:08, Chris Ives ch...@ives.bz wrote:

 What is wrong with this code?



 $x_Message = $x_fname. .$x_lname. .$_practice. just registered for
 .$x_nevent.Method of payment .$x_payment. Email address is.$x_email.
 Telephone number.$x_tele. Question is .$x_qanda.;



 $message =  $x_Message;

 $from = $x_email;

 $to = nci...@gmail.com;

 $subject = Panorama Registration;

 $headers = From: $from;

 /* Now we are ready to send the email so we call php's mail() function

 with the appropriate variables from above included in the brackets */

 mail($to,$subject,$message,$headers);



 --
 PHP Quality Assurance Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

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



RE: [PHP] Re: [PHP-QA] problem code

2009-02-01 Thread David Swenson
~CODE~~~
 $x_Message = $x_fname. .$x_lname. .$_practice. just registered 
 for .$x_nevent.Method of payment .$x_payment. Email address 
 is.$x_email. Telephone number.$x_tele. Question is .$x_qanda.;
~/CODE~~

Recheck your code for syntax error.  Appears you have one to few/many
quotes ().

Good Luck
David

On Sun, Feb 1, 2009 at 14:08, Chris Ives ch...@ives.bz wrote:

 What is wrong with this code?



 $x_Message = $x_fname. .$x_lname. .$_practice. just registered 
 for .$x_nevent.Method of payment .$x_payment. Email address 
 is.$x_email. Telephone number.$x_tele. Question is .$x_qanda.;



 $message =  $x_Message;

 $from = $x_email;

 $to = nci...@gmail.com;

 $subject = Panorama Registration;

 $headers = From: $from;

 /* Now we are ready to send the email so we call php's mail() function

 with the appropriate variables from above included in the brackets */

 mail($to,$subject,$message,$headers);



 --
 PHP Quality Assurance Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/
|| http://www.pilotpig.net/ Unadvertised dedicated server deals, too low
to print - email me to find out!

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


No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.552 / Virus Database: 270.10.16/1928 - Release Date:
1/31/2009 8:03 PM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.552 / Virus Database: 270.10.16/1928 - Release Date:
1/31/2009 8:03 PM
 


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



[PHP] Re: PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-30 Thread Carlos Medina

Nitsan Bin-Nun schrieb:

I was just wondering whether people enclosing their PHP tags declarations,
I don't close these ?php tags just because the interpreter doesn't really
needs them,
and for the second reason - if a space/tab/new line/etc will beneath them it
will cause
problems with output buffering and session handling.

Do you close your PHP ?php tags?

(at least I closed them here :P look down)

No,
is not needed

Regards

Carlos

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



Re: [PHP] Re: PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-30 Thread Bastien Koert
On Fri, Jan 30, 2009 at 2:18 PM, Carlos Medina i...@simply-networks.dewrote:

 Nitsan Bin-Nun schrieb:

 I was just wondering whether people enclosing their PHP tags declarations,
 I don't close these ?php tags just because the interpreter doesn't really
 needs them,
 and for the second reason - if a space/tab/new line/etc will beneath them
 it
 will cause
 problems with output buffering and session handling.

 Do you close your PHP ?php tags?

 (at least I closed them here :P look down)

 No,
 is not needed

 Regards

 Carlos

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

 I usually do, only because I grew up using ASP with requires it...just
another bad habit


-- 

Bastien

Cat, the other other white meat


[PHP] Re: Php error

2009-01-24 Thread Carlos Medina

mattias schrieb:

ERR_DB_NO_DB_PASS
What will this meen?



The Database is a foreign DB without passport

Carlos

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



[PHP] Re: PHP webhosting - USA

2009-01-24 Thread Tony Marston
I have been using www.lypha.com for 5 years without experiencing any of 
those problems.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

Martin Zvarík mzva...@gmail.com wrote in message 
news:ed.1b.55096.ccd2b...@pb1.pair.com...
 Hi,

 I currently host my site by Powweb, and I am WANT to change it - can you 
 guys recommend me something good?

 Powweb's website looks awesome and it's the best marketing I think I had 
 saw! After a minute it makes you think there is NO better hosting - and 
 it's a LIE.

 What happened to me?

 - database connection were exceeded, I read many people had problems with 
 their phorums not working etc., the solution: I put a message to the 
 visitor that he has to wait (it was not frequent so I didn't care much)

 - my client stopped receiving orders, he called me after a week something 
 is wrong. I found out that Powweb changed a MySQL settings, which nobody 
 informed me about - they restricted a JOIN limit max to 3, the mysql_query 
 SQL thus did not work and orders were not storing for 7 days!

 - the suport is HORRIBLE - they don't give you email, but they have this 
 ONLINE support, meaning: you wait 10-20 minutes on queue, and then they 
 talk to you like a robots and usually tell you something you already know.

 - now they automatically changed all my passwords so they can keep me 
 secure! what's cool is that I cannot change it back to what I have! Hey, 
 the chance of getting me hit by bus is higher than someone cracking my 15 
 letter password with numbers! Thank you powweb for keeping me secure.

 Thanks for reading my story,
 now, does someone know a better hosting alternative?

 Martin 



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



[PHP] Re: PHP webhosting - USA - conclusion

2009-01-24 Thread Martin Zvarík
I should have said in the beginning it's a small website and I am not 
looking for a dedicated server.


Howewer, I decided to move to Lypha.com

Thanks for all your fruitful* comments :)
Martin


PS: PHP mailgroup rulz

*) that was in dictionary

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



[PHP] Re: php spawing/forking issues

2009-01-22 Thread Nathan Rixham

bruce wrote:

Hi...

Playing around with a test app to spawn external child processes.

I'd like to be able to spawn/fork/run am external child process, that:
 -allows the child processes to run as separate independent processes (pid)
 -allows the child process(es) to be terminated via cmdline (kill -9 pid)


i've got a dynamic situation, where i'm reading from an array, and for each
item in the array, i want to spawn/fork the child process. i'd like to be
able to have 10 copies of the spawned child process running at the same
time.

the only way i've been able to get my test working, is to spawn a group of
processes, and then to iterate through the group, using an array of pids,
and doing a wait for each pid in the array. however, this doesn't satisfy me
wanting to have a certain number of simultaneous processes running at the
same time..

thoughts/comments/pointers to articles that might demonstrate this would be
useful.

thanks...

i can easily post the sample chunk of code i'm playing with if someone wants
to look at it!





yep send the code; done it a few times in the past but need to see the 
method you've taken so far


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



[PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Daniel Brown
On Mon, Jan 19, 2009 at 18:57, Nathan Rixham nrix...@gmail.com wrote:
[snip!]

 the idea wouldn't be a framework or another php classes, more of a repo full
 of common classes to save us all some time
[snip!]

Maybe you could call it PEAR.  ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

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



Re: [PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Kyle Terry
On Mon, Jan 19, 2009 at 4:28 PM, Daniel Brown danbr...@php.net wrote:

 On Mon, Jan 19, 2009 at 18:57, Nathan Rixham nrix...@gmail.com wrote:
 [snip!]
 
  the idea wouldn't be a framework or another php classes, more of a repo
 full
  of common classes to save us all some time
 [snip!]

Maybe you could call it PEAR.  ;-P

 --
 /Daniel P. Brown
 daniel.br...@parasane.net || danbr...@php.net
 http://www.parasane.net/ || http://www.pilotpig.net/
 Unadvertised dedicated server deals, too low to print - email me to find
 out!

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

 Oh now come on. That isn't fair!


-- 
Kyle Terry | www.kyleterry.com


[PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Daniel Brown
On Mon, Jan 19, 2009 at 19:28, Daniel Brown danbr...@php.net wrote:

Maybe you could call it PEAR.  ;-P

(Sent too quickly.  Meant to include this, too:)

A good place to start is by showing how this would benefit from
things like PEAR and PECL.  Also note that phpclasses.org isn't an
official or endorsed PHP project, it's a completely third-party site
and project operated by non-PHP-Group folks (in case you meant to
insinuate that it was a part of the PHP project).

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

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



[PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Nathan Rixham

Daniel Brown wrote:

On Mon, Jan 19, 2009 at 19:28, Daniel Brown danbr...@php.net wrote:

   Maybe you could call it PEAR.  ;-P


(Sent too quickly.  Meant to include this, too:)

A good place to start is by showing how this would benefit from
things like PEAR and PECL. 


care to contrib that info / thoughts dan? :-) good idea.

or counter: maybe completely out with pear/pecl/php scope; just some 
devs sharing some work then open sourcing it for anybody who wants. 
wouldn't want people assuming it was linked to php official/endorsed 
(like you just noted with phpclasses)



Also note that phpclasses.org isn't an
official or endorsed PHP project, it's a completely third-party site
and project operated by non-PHP-Group folks (in case you meant to
insinuate that it was a part of the PHP project).


lol noted, tis just master lemos ad filled site of other peoples work 
ya? (he does have some good classes of his own, no down talking meant lol)




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



Re: [PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Kyle Terry
On Mon, Jan 19, 2009 at 4:38 PM, Nathan Rixham nrix...@gmail.com wrote:

 Daniel Brown wrote:

 On Mon, Jan 19, 2009 at 19:28, Daniel Brown danbr...@php.net wrote:

   Maybe you could call it PEAR.  ;-P


(Sent too quickly.  Meant to include this, too:)

A good place to start is by showing how this would benefit from
 things like PEAR and PECL.


 care to contrib that info / thoughts dan? :-) good idea.

 or counter: maybe completely out with pear/pecl/php scope; just some devs
 sharing some work then open sourcing it for anybody who wants. wouldn't want
 people assuming it was linked to php official/endorsed (like you just noted
 with phpclasses)

  Also note that phpclasses.org isn't an
 official or endorsed PHP project, it's a completely third-party site
 and project operated by non-PHP-Group folks (in case you meant to
 insinuate that it was a part of the PHP project).


 lol noted, tis just master lemos ad filled site of other peoples work ya?
 (he does have some good classes of his own, no down talking meant lol)




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


I think this is a good idea. It's almost like building and sharing a data
type validation system with developers from all over the world.

-- 
Kyle Terry | www.kyleterry.com


[PHP] Re: [PHP-DEV] maybe we could all?

2009-01-19 Thread Daniel Brown
On Mon, Jan 19, 2009 at 19:38, Nathan Rixham nrix...@gmail.com wrote:
 Daniel Brown wrote:

A good place to start is by showing how this would benefit from
 things like PEAR and PECL.

 care to contrib that info / thoughts dan? :-) good idea.

No, I'm just typing and multitasking with too many things
simultaneously.  Just str_replace('benefit','be different',$message);.

 or counter: maybe completely out with pear/pecl/php scope; just some devs
 sharing some work then open sourcing it for anybody who wants. wouldn't want
 people assuming it was linked to php official/endorsed (like you just noted
 with phpclasses)

Right, I'm pickin' up what you're layin' down, my man.

 lol noted, tis just master lemos ad filled site of other peoples work ya?
 (he does have some good classes of his own, no down talking meant lol)

Correct.  Centralized catalog of PHP classes, but separate from
the PHP project.  That's all.

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

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



[PHP] Re: Php and CSS where to put it

2009-01-13 Thread Al



Terion Miller wrote:

I have this code and the css seems to not work in IE at all, do I need to
put it somewhere different on the page maybe?

link rel=stylesheet type=text/css href=inc/styles.css
?php  include 'inc/dbconnOpen.php' ;

ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);

 $sql = SELECT * FROM `textads` WHERE `expos`  xCount ORDER BY RAND()
LIMIT 3;
$result = mysql_query($sql);

echo 
table class=jobfont width=728 height=90 border=0 align=center
cellpadding=10 bordercolor=#66 background= 'inc/bg.gif' bgcolor=#CC
tr
td
table width=690 height=50 border=0 align=center cellpadding=5
tr;

while ($row = mysql_fetch_array($result)) {
echo 
td  class=col align=center
width=33%{$row['title']}br{$row['blurb']}br
A HREF='{$row['href']}'{$row['href']}/a/td;
//Add to exposure count
$views = $row['xCount'] + 1;
mysql_query(UPDATE `textads` SET `xCount` = '{$views}' WHERE `ID` =
'{$row['ID']}');
}

echo  /tr
/table/td/tr/table;

?



Terion: Install Firefox and the HTML Validator extension. It is a perfect tool 
for you. It will clearly identify all the HTML errors and warnings, AND point 
you to how to fix them. It uses Tidy, which classifies many errors as warnings.


However, you should fix them. Your page has 21 serious warnings many of which 
are errors that will affect rendering. After you've fixed the warnings and 
errors it finds, run the W3C HTML Validator.


Also, install the Firefox extension Validate CSS. Run it on your page. It has 
8 bad errors.


These tools are great learning aids.

Incidentally, I'm not a fan of frames, often causes problems.

Al.

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



[PHP] Re: php session GC error

2009-01-13 Thread Shawn McKenzie
Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following
 
 session.gc_probability = 1
 session.gc_divisor = 1
 
 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30
 
 I am now getting this error
 
 PHP Notice: session_start() [function.session-start]: ps_files_cleanup_dir: 
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in 
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2
 
 What do I have to do to make this work right?
 
 Frank 
 
 

Does C:\WINDOWS\TEMP\ exist?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank



 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does 
it matter to PHP? 



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



[PHP] Re: php session GC error

2009-01-13 Thread Nathan Rixham

Frank Stanovcak wrote:
Shawn McKenzie nos...@mckenzies.net wrote in message 
news:f8.ef.24097.e510d...@pb1.pair.com...

Frank Stanovcak wrote:

I'm trying to make sure that my sessions are timed out by my server.
I'm running it on winxp, and my php.ini contains the following

session.gc_probability = 1
session.gc_divisor = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 30

I am now getting this error

PHP Notice: session_start() [function.session-start]: 
ps_files_cleanup_dir:

opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

What do I have to do to make this work right?

Frank



Does C:\WINDOWS\TEMP\ exist?

--
Thanks!
-Shawn
http://www.spidean.com
Yes it does, well C:\Windows\Temp does, but win isn't case sensitive...does 
it matter to PHP? 





try changing it to the correct case then come back and tell us if case 
matters? :)


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



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Nathan Rixham nrix...@gmail.com wrote in message 
news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' 
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case 
 sensitive...does it matter to PHP?

 try changing it to the correct case then come back and tell us if case 
 matters? :)
ok...let me try it like this.

how do I explicitly tell PHP in the ini what directory to use for session 
storage and cleanup.  I've been googling for about an hour now, and am just 
getting more frustrated.  :(

The server is a single purpose server, and it will remain that way, so I 
don't want to have to code ini settings into each page.  :)

Frank 



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



[PHP] Re: php session GC error

2009-01-13 Thread Shawn McKenzie
Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message 
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' 
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]: 
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case 
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case 
 matters? :)
 ok...let me try it like this.
 
 how do I explicitly tell PHP in the ini what directory to use for session 
 storage and cleanup.  I've been googling for about an hour now, and am just 
 getting more frustrated.  :(
 
 The server is a single purpose server, and it will remain that way, so I 
 don't want to have to code ini settings into each page.  :)
 
 Frank 
 
 
Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak

Shawn McKenzie nos...@mckenzies.net wrote in message 
news:e3.00.25553.8560d...@pb1.pair.com...
 Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage'
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]:
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case
 matters? :)
 ok...let me try it like this.

 how do I explicitly tell PHP in the ini what directory to use for session
 storage and cleanup.  I've been googling for about an hour now, and am 
 just
 getting more frustrated.  :(

 The server is a single purpose server, and it will remain that way, so I
 don't want to have to code ini settings into each page.  :)

 Frank


 Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com

So if my ini looks like the following I should be able to get rid of any 
session data after a preset timelimit?

session.save_path = C:\temp

; Whether to use cookies.
session.use_cookies = 1

;session.cookie_secure =

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Whether or not to add the httpOnly flag to the cookie, which makes it 
inaccessible to browser scripting languages such as JavaScript.
session.cookie_httponly =

; Handler used to serialize data.  php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 30 



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



[PHP] Re: php session GC error

2009-01-13 Thread Frank Stanovcak
So from everything I've read there is no real way to assure a session 
timeout with out timestamping it myself and dealing with it in code by doing 
a time compare.

bummer.


Frank Stanovcak blindspot...@comcast.net wrote in message 
news:57.31.25553.de80d...@pb1.pair.com...

 Shawn McKenzie nos...@mckenzies.net wrote in message 
 news:e3.00.25553.8560d...@pb1.pair.com...
 Frank Stanovcak wrote:
 Nathan Rixham nrix...@gmail.com wrote in message
 news:496d03d3.2060...@gmail.com...
 Frank Stanovcak wrote:
 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:f8.ef.24097.e510d...@pb1.pair.com...
 Frank Stanovcak wrote:
 I'm trying to make sure that my sessions are timed out by my server.
 I'm running it on winxp, and my php.ini contains the following

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 
 'garbage'
 and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30

 I am now getting this error

 PHP Notice: session_start() [function.session-start]:
 ps_files_cleanup_dir:
 opendir(C:\WINDOWS\TEMP\) failed: No such file or directory (2) in
 C:\Inetpub\wwwroot\Envelope1\edit\EditMain.php on line 2

 What do I have to do to make this work right?

 Frank


 Does C:\WINDOWS\TEMP\ exist?

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 Yes it does, well C:\Windows\Temp does, but win isn't case
 sensitive...does it matter to PHP?
 try changing it to the correct case then come back and tell us if case
 matters? :)
 ok...let me try it like this.

 how do I explicitly tell PHP in the ini what directory to use for 
 session
 storage and cleanup.  I've been googling for about an hour now, and am 
 just
 getting more frustrated.  :(

 The server is a single purpose server, and it will remain that way, so I
 don't want to have to code ini settings into each page.  :)

 Frank


 Should be session.save_path, but check phpinfo() to see what it's using.
 Should be the path in the error.

 -- 
 Thanks!
 -Shawn
 http://www.spidean.com

 So if my ini looks like the following I should be able to get rid of any 
 session data after a preset timelimit?

 session.save_path = C:\temp

 ; Whether to use cookies.
 session.use_cookies = 1

 ;session.cookie_secure =

 ; This option enables administrators to make their users invulnerable to
 ; attacks which involve passing session ids in URLs; defaults to 0.
 ; session.use_only_cookies = 1

 ; Name of the session (used as cookie name).
 session.name = PHPSESSID

 ; Initialize session on request startup.
 session.auto_start = 0

 ; Lifetime in seconds of cookie or, if 0, until browser is restarted.
 session.cookie_lifetime = 0

 ; The path for which the cookie is valid.
 session.cookie_path = /

 ; The domain for which the cookie is valid.
 session.cookie_domain =

 ; Whether or not to add the httpOnly flag to the cookie, which makes it 
 inaccessible to browser scripting languages such as JavaScript.
 session.cookie_httponly =

 ; Handler used to serialize data.  php is the standard serializer of PHP.
 session.serialize_handler = php

 ; Define the probability that the 'garbage collection' process is started
 ; on every session initialization.
 ; The probability is calculated by using gc_probability/gc_divisor,
 ; e.g. 1/100 means there is a 1% chance that the GC process starts
 ; on each request.

 session.gc_probability = 1
 session.gc_divisor = 1

 ; After this number of seconds, stored data will be seen as 'garbage' and
 ; cleaned up by the garbage collection process.
 session.gc_maxlifetime = 30
 



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



[PHP] Re: php session GC error

2009-01-13 Thread Nathan Rixham

Frank Stanovcak wrote:
So from everything I've read there is no real way to assure a session 
timeout with out timestamping it myself and dealing with it in code by 
doing a time compare.


bummer.


you're probably storing the session in a session cookie (which is 
default) so session.cookie_lifetime will come in to play; you've got it 
set to 0 so no session will timeout until the browser controlling the 
session is closed and restarted.. try changing it to 30 as well then you 
should find all sessions time out after 30 seconds of in activity


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



Re: [PHP] Re: php session GC error

2009-01-13 Thread Andrew Ballard
On Tue, Jan 13, 2009 at 5:08 PM, Nathan Rixham nrix...@gmail.com wrote:
 Frank Stanovcak wrote:

 So from everything I've read there is no real way to assure a session
 timeout with out timestamping it myself and dealing with it in code by doing
 a time compare.

 bummer.

 you're probably storing the session in a session cookie (which is default)
 so session.cookie_lifetime will come in to play; you've got it set to 0 so
 no session will timeout until the browser controlling the session is closed
 and restarted.. try changing it to 30 as well then you should find all
 sessions time out after 30 seconds of in activity


I was under the impression that setting session.cookie_lifetime to
something greater than 0 had a few repercussions:

1) The session cookie is written to disk rather than being stored only
in memory.
2) Because the cookie now has a lifetime, it is still valid even if
the browser closes and reopens within the cookie_lifetime.

Neither of these are something I want. Because of that (and the
occasional need to persist sessions on clustered web servers) I
usually write my own session save handler.

Andrew

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



[PHP] Re: Php and CSS where to put it

2009-01-12 Thread Michelle Konzack
Hello Terion,

Am 2009-01-12 10:42:10, schrieb Terion Miller:
 I have this code and the css seems to not work in IE at all, do I need to
 put it somewhere different on the page maybe?

The CSS must be in the HTML Header like

html
head
  titleCSS Example/title
  link rel=stylesheet type=text/css href=inc/styles.css
  style type=text/css
#body { background-color: magenta; }
  /style
/head
body

...rest of the page

 link rel=stylesheet type=text/css href=inc/styles.css
 ?php  include 'inc/dbconnOpen.php' ;
 
 ini_set('error_reporting', E_ALL);
 ini_set('display_errors', true);
 
  $sql = SELECT * FROM `textads` WHERE `expos`  xCount ORDER BY RAND()
 LIMIT 3;
 $result = mysql_query($sql);
 
 echo 
 table class=jobfont width=728 height=90 border=0 align=center
 cellpadding=10 bordercolor=#66 background= 'inc/bg.gif' bgcolor=#CC

according to W3C any values must be quoted like:

echo 
table class=\jobfont\ width=\728\ height=\90\ border=\0\ 
align=\center\
cellpadding=\10\ bordercolor=\#66\ background= \inc/bg.gif\ 
bgcolor=\#CC\

Do not forget to ESCAPE!  And of course, I would put the stuff into  the
CSS definition and not into the TABLE tag.

 tr
 td
 table width=690 height=50 border=0 align=center cellpadding=5

QUOT the values!

 tr;
 
 while ($row = mysql_fetch_array($result)) {
 echo 
 td  class=col align=center
 width=33%{$row['title']}br{$row['blurb']}br
 A HREF='{$row['href']}'{$row['href']}/a/td;
 //Add to exposure count
 $views = $row['xCount'] + 1;
 mysql_query(UPDATE `textads` SET `xCount` = '{$views}' WHERE `ID` =
 '{$row['ID']}');
 }
 
 echo  /tr
 /table/td/tr/table;
 
 ?

Your HTML page has to be closed with:

/body
/html

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
http://www.tamay-dogan.net/   http://www.can4linux.org/
Michelle Konzack   Apt. 917  ICQ #328449886
+49/177/935194750, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] Re: Php and CSS where to put it

2009-01-12 Thread Terion Miller
Resolved! Thanks!

On Mon, Jan 12, 2009 at 12:38 PM, Michelle Konzack 
linux4miche...@tamay-dogan.net wrote:

 Hello Terion,

 Am 2009-01-12 10:42:10, schrieb Terion Miller:
  I have this code and the css seems to not work in IE at all, do I need to
  put it somewhere different on the page maybe?

 The CSS must be in the HTML Header like

 html
 head
  titleCSS Example/title
   link rel=stylesheet type=text/css href=inc/styles.css
   style type=text/css
#body { background-color: magenta; }
  /style
 /head
 body

 ...rest of the page

  link rel=stylesheet type=text/css href=inc/styles.css
  ?php  include 'inc/dbconnOpen.php' ;
 
  ini_set('error_reporting', E_ALL);
  ini_set('display_errors', true);
 
   $sql = SELECT * FROM `textads` WHERE `expos`  xCount ORDER BY RAND()
  LIMIT 3;
  $result = mysql_query($sql);
 
  echo 
  table class=jobfont width=728 height=90 border=0 align=center
  cellpadding=10 bordercolor=#66 background= 'inc/bg.gif'
 bgcolor=#CC

 according to W3C any values must be quoted like:

 echo 
 table class=\jobfont\ width=\728\ height=\90\ border=\0\
 align=\center\
 cellpadding=\10\ bordercolor=\#66\ background= \inc/bg.gif\
 bgcolor=\#CC\

 Do not forget to ESCAPE!  And of course, I would put the stuff into  the
 CSS definition and not into the TABLE tag.

  tr
  td
  table width=690 height=50 border=0 align=center cellpadding=5

 QUOT the values!

  tr;
 
  while ($row = mysql_fetch_array($result)) {
  echo 
  td  class=col align=center
  width=33%{$row['title']}br{$row['blurb']}br
  A HREF='{$row['href']}'{$row['href']}/a/td;
  //Add to exposure count
  $views = $row['xCount'] + 1;
  mysql_query(UPDATE `textads` SET `xCount` = '{$views}' WHERE `ID` =
  '{$row['ID']}');
  }
 
  echo  /tr
  /table/td/tr/table;
 
  ?

 Your HTML page has to be closed with:

 /body
 /html

 Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant


 --
 Linux-User #280138 with the Linux Counter, http://counter.li.org/
 # Debian GNU/Linux Consultant #
 http://www.tamay-dogan.net/   http://www.can4linux.org/
 Michelle Konzack   Apt. 917  ICQ #328449886
 +49/177/935194750, rue de Soultz MSN LinuxMichi
 +33/6/61925193 67100 Strasbourg/France   IRC #Debian (irc.icq.com)



[PHP] Re: Php and CSS where to put it

2009-01-12 Thread tedd

At 7:38 PM +0100 1/12/09, Michelle Konzack wrote:

Hello Terion,

Am 2009-01-12 10:42:10, schrieb Terion Miller:
  I have this code and the css seems to not work in IE at all, do I need to
  put it somewhere different on the page maybe?

The CSS must be in the HTML Header like

html
head
  titleCSS Example/title
  link rel=stylesheet type=text/css href=inc/styles.css
  style type=text/css
#body { background-color: magenta; }
  /style
/head
body

...rest of the page


Today must be my Arrr day.

Don't embed css in document -- just put what you want in your css file.

If IE has a problem with it, then deal with IE within the css file. 
There are css hacks if you can't find a way around the problem.


But embedding css style rules is a real no-no in my book -- there's 
no reason to do it.


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] Re: Php and CSS where to put it

2009-01-12 Thread Robert Cummings
On Mon, 2009-01-12 at 16:27 -0500, tedd wrote:
 At 7:38 PM +0100 1/12/09, Michelle Konzack wrote:
 Hello Terion,
 
 Am 2009-01-12 10:42:10, schrieb Terion Miller:
I have this code and the css seems to not work in IE at all, do I need to
put it somewhere different on the page maybe?
 
 The CSS must be in the HTML Header like
 
 html
 head
titleCSS Example/title
link rel=stylesheet type=text/css href=inc/styles.css
style type=text/css
  #body { background-color: magenta; }
/style
 /head
 body
 
 ...rest of the page
 
 Today must be my Arrr day.
 
 Don't embed css in document -- just put what you want in your css file.
 
 If IE has a problem with it, then deal with IE within the css file. 
 There are css hacks if you can't find a way around the problem.
 
 But embedding css style rules is a real no-no in my book -- there's 
 no reason to do it.

On my dev sites I embed the CSS, on production it gets exported to an
external version-named file as part of the build process.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: Php and CSS where to put it

2009-01-12 Thread Ashley Sheridan
On Mon, 2009-01-12 at 16:27 -0500, tedd wrote:

 At 7:38 PM +0100 1/12/09, Michelle Konzack wrote:
 Hello Terion,
 
 Am 2009-01-12 10:42:10, schrieb Terion Miller:
I have this code and the css seems to not work in IE at all, do I need to
put it somewhere different on the page maybe?
 
 The CSS must be in the HTML Header like
 
 html
 head
titleCSS Example/title
link rel=stylesheet type=text/css href=inc/styles.css
style type=text/css
  #body { background-color: magenta; }
/style
 /head
 body
 
 ...rest of the page
 
 Today must be my Arrr day.
 
 Don't embed css in document -- just put what you want in your css file.
 
 If IE has a problem with it, then deal with IE within the css file. 
 There are css hacks if you can't find a way around the problem.
 
 But embedding css style rules is a real no-no in my book -- there's 
 no reason to do it.
 
 Cheers,
 
 tedd
 
 
 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 

Here's something for fixing IE with hacks:

http://www.ashleysheridan.co.uk/coding_html_comments.php

basically it lets you add in extra IE-only stylesheets using comment
code only recognised by IE, and you can use !important to stress your IE
styles. Best thing though is it validates through the W3C because it is
just an HTML comment.


Ash
www.ashleysheridan.co.uk


Re: [PHP] Re: Php and CSS where to put it

2009-01-12 Thread Paul M Foster
On Mon, Jan 12, 2009 at 09:56:00PM +, Ashley Sheridan wrote:

snip

 
 Here's something for fixing IE with hacks:
 
 http://www.ashleysheridan.co.uk/coding_html_comments.php
 
 basically it lets you add in extra IE-only stylesheets using comment
 code only recognised by IE, and you can use !important to stress your IE
 styles. Best thing though is it validates through the W3C because it is
 just an HTML comment.

Don't move that page; I've bookmarked it. ;-}

Paul

-- 
Paul M. Foster

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



[PHP] Re: [PHP-DB] data from db to a page and then to another page

2009-01-07 Thread Dan Shirah
On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi mika.jaa...@gmail.com wrote:

 I already can get the data from database to a page. Now I want to make link
 from that data to next page and on that new page it should show all the
 data
 that is related.

 example:

 data from database
 --
 page1 where listed:

 band1 (a href)
 band2 (a href)
 band3 (a href)
 ...

 and when clicking for example band3
 --
 page2 where listed band info:

 bandname
 bandhistory
 bandmembers
 ...

 So, how should I do this? Should I somehow use $_POST method to
 send/deliver
 band_id to the next page?


You could do several things.

1) Use javascript to make a link using the band3 value within the Javascript
to pass the ID to the next page.

Example:

Have a Javascript function -

script language=JavaScript
!--
function openWin(band_id) {
 var link
 link = my/directory/display.php?band_id=' + band_id;
 MyWin = window.open(link,OpenPage);
 MyWin.focus();
}
//--
/script

And then call that function when you click on the band you want.

a href=javascript:openWin('?php echo $band_id; ?')?php echo $band;
?/a

2) You could use form objects (radio buttons/check boxes/dropdown box etc)
to pass the band_id value via POST

Then on your second page all you would have to do is get the value.

Example:
input type=radio tabindex=1 name=band value=?php echo $band_id;
?
input type=radio tabindex=2 name=band value=?php echo $band_id;
?
input type=radio tabindex=3 name=band value=?php echo $band_id;
?

On the second page you would simply check the posted value of you band
radio input:

$band_id = $_POST['band'];

Hope that helps.

Dan


[PHP] Re: [PHP-DB] data from db to a page and then to another page

2009-01-07 Thread Shawn McKenzie
Dan Shirah wrote:
 On Wed, Jan 7, 2009 at 4:54 AM, Mika Jaaksi mika.jaa...@gmail.com wrote:
 
 I already can get the data from database to a page. Now I want to make link
 from that data to next page and on that new page it should show all the
 data
 that is related.

 example:

 data from database
 --
 page1 where listed:

 band1 (a href)
 band2 (a href)
 band3 (a href)
 ...

 and when clicking for example band3
 --
 page2 where listed band info:

 bandname
 bandhistory
 bandmembers
 ...

 So, how should I do this? Should I somehow use $_POST method to
 send/deliver
 band_id to the next page?

 
 You could do several things.
 
 1) Use javascript to make a link using the band3 value within the Javascript
 to pass the ID to the next page.
 
 Example:
 
 Have a Javascript function -
 
 script language=JavaScript
 !--
 function openWin(band_id) {
  var link
  link = my/directory/display.php?band_id=' + band_id;
  MyWin = window.open(link,OpenPage);
  MyWin.focus();
 }
 //--
 /script
 
 And then call that function when you click on the band you want.
 
 a href=javascript:openWin('?php echo $band_id; ?')?php echo $band;
 ?/a
 
 2) You could use form objects (radio buttons/check boxes/dropdown box etc)
 to pass the band_id value via POST
 
 Then on your second page all you would have to do is get the value.
 
 Example:
 input type=radio tabindex=1 name=band value=?php echo $band_id;
 ?
 input type=radio tabindex=2 name=band value=?php echo $band_id;
 ?
 input type=radio tabindex=3 name=band value=?php echo $band_id;
 ?
 
 On the second page you would simply check the posted value of you band
 radio input:
 
 $band_id = $_POST['band'];
 
 Hope that helps.
 
 Dan
 

Maybe too simple, but just use a get var in the link of page1:

a href=page2.php?band=1Band1/a
a href=page2.php?band=2Band2/a

Then in page2 use $_GET['band'] and do your query. (of course checked
and sanitized, yadayada...)

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: [PHP-DB] Re: data from db to a page and then to another page

2009-01-07 Thread Dan Shirah

 Thanks for the aswers, but there is still some problems.

 I tested this code(below) and it works but when I add it to the rest of my
 code it stops working.

 Here's the working code:

 page1:

 ?php
 $bandname = Someband;
 ?
 form name=goto_info action=band_info.php method=post
 input type=hidden name=bandname value=?php echo $bandname; ?
 a href=band_info.php?bandname=$bandname onclick=goto_info.submit();
 return false;?php echo $bandname; ?/a
 /form

 and page2:

 Bandname is ?php echo $_POST[bandname]; ?!

 _

 Now, here's the one I've been fighting with:

 ?
 include(XXX.inc.php);
 mysql_connect($host,$username,$password);
 @mysql_select_db($database) or die( Unable to select database);
 $query=SELECT * FROM band;
 $result=mysql_query($query);

 $num=mysql_numrows($result);

 mysql_close();

 echo bcenterBands/center/bbrbr;

 ?
 table border=0 cellspacing=2 cellpadding=2
 tr
 thfont face=Arial, Helvetica, sans-serifbandname/font/th
 /tr

 ?
 $i=0;
 while ($i  $num) {
 $bandname=mysql_result($result,$i,bandname);
 ?
 tr
 form name=goto_info action=band_info.php method=post
 input type=hidden name=bandname value=?php echo $bandname; ?
 a href=band_info.php?bandname=$bandname onclick=goto_info.submit();
 return false;?php echo $bandname; ?/a
 /form
 /tr
 ?
 ++$i;
 }
 echo /table;
 ?

 For some reason this doesn't post bandname to band_info page...

Your while () { } loop looks strange to me. You are doing a SELECT * from
your database and basically want to output each result with an assigned
$bandname, right?

If you're selecting all records, that you shouldn't need to do a row count
or use the $i counter.

You could simply do this:

script language=JavaScript
!--
function submitForm(bandname) {
 document.goto_info.bandname.value=bandname;
 document.goto_info.submit();
}
//--
/script
?
include(XXX.inc.php);
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( Unable to select database);
$query=SELECT * FROM band;
$result=mysql_query($query);
mysql_close();
?
bcenterBands/center/bbrbr
form name=goto_info action=band_info.php method=post
input type=hidden name=bandname value=
table border=0 cellspacing=2 cellpadding=2
tr
thfont face=Arial, Helvetica, sans-serifbandname/font/th
/tr
?
while ($row = mysql_fetch_row($result)) {
 $bandname=$row['bandname'];
?
tr
a href=javascript:submitForm('?php echo $bandname; ?')?php echo
$bandname; ?/a
/tr
?
}
?
/table
/form


[PHP] Re: [PHP-DB] Re: data from db to a page and then to another page

2009-01-07 Thread Dan Shirah
On Wed, Jan 7, 2009 at 3:01 PM, Mika Jaaksi mika.jaa...@gmail.com wrote:

 Thanks! I got it working...

Excellent, happy to help.


[PHP] Re: PHP (under httpd) reading a file outside DocumentRoot?

2008-12-27 Thread Jeff Weinberger

On Dec 26, 2008, at 1:52 PM, Nathan Rixham wrote:


Jeff Weinberger wrote:
I don't know if this is an Apache (httpd) or a PHP issue (I suspect  
PHP, but I may be doing something wrong with mod_suexec), so I hope  
this is the right place to ask. I certainly appreciate any help  
anyone can offer!
I am trying to get a PHP script to read a file that's outside the  
DocumentRoot of a VirtualHost, in fact well outside the parent  
directory of all of my virtual hosts.
I have successfully managed to get Apache httpd to run the script  
as the correct user and group (matching the target file's  
ownership) using SuexecUserGroup. I tested this by having the  
script create/write a test file, which had owner and group set  
correctly.
However, when I run the script, at the file(/path/to/target/file)  
command, PHP tells me it can't open the file - permission is denied.

In php.ini safe_mode is off and open_basedir is not set.
I am not sure where else to look for a solution - any help is very  
much appreciated!
FYI: PHP 5.2.6, Apache httpd 2.2.11, mod_ssl/2.2.11, OpenSSL/0.9.7l  
on Mac OS/X 10.5.5. I'm reaching the script over an SSL (https)  
connection if that matters).

Thanks!


do what it takes to make it work (ie chmod 777 or similar) then put  
things back to how they presently are one by one to find the cause  
of the error. :)


Nathan: Thanks for your suggestion - a good debugging step - but the  
permissions on the file I want the script to read have been -rw-rw-rw-  
the entire time.


This leads me to suspect that the issue is not the permissions  
themselves, but rather something about my PHP configuration or script  
(or, possibly, as I noted, my Apache httpd configuration) that is  
causing PHP to report a permission error on reading the file.


I don't know where else to look for this issue, so I hope that someone  
has at least some pointers or suggestions on what might be happening  
here.


Thank you very much for any help!

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



[PHP] Re: PHP (under httpd) reading a file outside DocumentRoot?

2008-12-26 Thread Nathan Rixham

Jeff Weinberger wrote:
I don't know if this is an Apache (httpd) or a PHP issue (I suspect PHP, 
but I may be doing something wrong with mod_suexec), so I hope this is 
the right place to ask. I certainly appreciate any help anyone can offer!


I am trying to get a PHP script to read a file that's outside the 
DocumentRoot of a VirtualHost, in fact well outside the parent directory 
of all of my virtual hosts.


I have successfully managed to get Apache httpd to run the script as the 
correct user and group (matching the target file's ownership) using 
SuexecUserGroup. I tested this by having the script create/write a test 
file, which had owner and group set correctly.


However, when I run the script, at the file(/path/to/target/file) 
command, PHP tells me it can't open the file - permission is denied.


In php.ini safe_mode is off and open_basedir is not set.

I am not sure where else to look for a solution - any help is very much 
appreciated!


FYI: PHP 5.2.6, Apache httpd 2.2.11, mod_ssl/2.2.11, OpenSSL/0.9.7l on 
Mac OS/X 10.5.5. I'm reaching the script over an SSL (https) connection 
if that matters).


Thanks!


do what it takes to make it work (ie chmod 777 or similar) then put 
things back to how they presently are one by one to find the cause of 
the error. :)


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



[PHP] Re: PHP Form email w/attachment

2008-12-18 Thread Carlos Medina

jeffery harris schrieb:
I need to create a php form and mail it to a recipient (that I can do). My 
question is how do I create an area for a file (.doc, or .pdf) to be 
attached emailed along with other form data as well?


-Jeff 




Hi Jeffery,
you need to upload the File with the Form inputfield
form action=input_file.htm method=post enctype=multipart/form-data
input name=Datei type=file size=50 maxlength=10 
accept=text/*
When the upload is ready, use is_uploaded_file() function to check and 
others to validate the File (important) then move the file with move_ 
uploaded_ file() to the Directory where you want or attach to the mail 
you want.


Kind Regards

Carlos Medina

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



[PHP] RE: Php question from Newsgroup

2008-12-18 Thread Boyd, Todd M.
Mike -- I've bottom posted my reply, as is the convention for this list (and 
most others). Scroll down.



From: Mike Peloso [mailto:mpel...@princeton.edu] 
Sent: Thursday, December 18, 2008 9:56 AM
To: Boyd, Todd M.
Subject: Php question from Newsgroup

Todd,
I have attached a few jpgs to show the problems I am having (With both of my 
recent posts)
Any questions you can call me.
The first one shows the value of the php file I am trying to parse.( I cant set 
any of those directives,) I can't set php.ini per dir
The second shows what your REGEX looks like as its being sent to: 
preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
As you can see there is a whole lot of escaping going on here.
Thanks
Mike 

Heres all the code:
?php
process_uploaded_file('letter');
function process_uploaded_file($fname) {
    // Assumes set of $_POST variables in the form: name, name_fname, 
name_size, name_type
    $_POST[$fname.'_fname'] = $_FILES[$fname]['name'];
    $_POST[$fname.'_size'] = $_FILES[$fname]['size'];
    $_POST[$fname.'_type'] = $_FILES[$fname]['type'];
    $_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],' 
%*;:{}[]|\,/()%...@!',''); //fix special chars in 
name
    $_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],',_);
    $fileHandle = fopen($_FILES[$fname]['tmp_name'], r);
    $_POST[$fname] =stripslashes(fread($fileHandle, $_POST[$fname.'_size']));
    $test=$_POST[$fname];
    $test3=stripslashes($test);
    //$regex='/function [a-z]* *([$a-zA-Z]*)/';
    //$regex='/function [a-z]* *(?$[a-z]*)?/';
    $regex = '/function\s+[-_a-z0-9]+\s*\((\s*$\?[-_a-z0-9]+\s*,?)*\s*\)/i';

    $functions=do_reg($regex,$test);
}

  function do_reg($regex,$test)
{   $test2=preg_quote($test);
    preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
    return $result = $result[0];
}
?



Mike,

You are using preg_quote(). This will add slashes to every special RegEx 
character in your pattern (i.e., parentheses and dollar signs, etc.). Try 
performing your RegEx search without using preg_quote() and let me know if it 
does any better. Also--try to keep your replies on the PHP List, as the 
information in them can be used by others on their own projects.

// Todd 


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



[PHP] Re: Php question from Newsgroup

2008-12-18 Thread MikeP

Boyd, Todd M. tmbo...@ccis.edu wrote in message 
news:33bde0b2c17eef46acbe00537cf2a190037b7...@exchcluster.ccis.edu...
Mike -- I've bottom posted my reply, as is the convention for this list 
(and most others). Scroll down.



From: Mike Peloso [mailto:mpel...@princeton.edu]
Sent: Thursday, December 18, 2008 9:56 AM
To: Boyd, Todd M.
Subject: Php question from Newsgroup

Todd,
I have attached a few jpgs to show the problems I am having (With both of my 
recent posts)
Any questions you can call me.
The first one shows the value of the php file I am trying to parse.( I cant 
set any of those directives,) I can't set php.ini per dir
The second shows what your REGEX looks like as its being sent to: 
preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
As you can see there is a whole lot of escaping going on here.
Thanks
Mike

Heres all the code:
?php
process_uploaded_file('letter');
function process_uploaded_file($fname) {
// Assumes set of $_POST variables in the form: name, name_fname, name_size, 
name_type
$_POST[$fname.'_fname'] = $_FILES[$fname]['name'];
$_POST[$fname.'_size'] = $_FILES[$fname]['size'];
$_POST[$fname.'_type'] = $_FILES[$fname]['type'];
$_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],' 
%*;:{}[]|\,/()%...@!',''); //fix special chars in 
name
$_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],',_);
$fileHandle = fopen($_FILES[$fname]['tmp_name'], r);
$_POST[$fname] =stripslashes(fread($fileHandle, $_POST[$fname.'_size']));
$test=$_POST[$fname];
$test3=stripslashes($test);
//$regex='/function [a-z]* *([$a-zA-Z]*)/';
//$regex='/function [a-z]* *(?$[a-z]*)?/';
$regex = '/function\s+[-_a-z0-9]+\s*\((\s*$\?[-_a-z0-9]+\s*,?)*\s*\)/i';

$functions=do_reg($regex,$test);
}

function do_reg($regex,$test)
{ $test2=preg_quote($test);
preg_match_all($regex, $test2, $result, PREG_PATTERN_ORDER);
return $result = $result[0];
}
?



Mike,

You are using preg_quote(). This will add slashes to every special RegEx 
character in your pattern (i.e., parentheses and dollar signs, etc.). Try 
performing your RegEx search without using preg_quote() and let me know if 
it does any better. Also--try to keep your replies on the PHP List, as the 
information in them can be used by others on their own projects.

// Todd
Were getting there
The only fuction i get is one without any parameters.
I'll play with it, but if you see an error in your regex let me know.
Thanks
Mike 



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



[PHP] Re: [PHP-INSTALL] PHP on Windows without Apache

2008-12-14 Thread Daniel Brown
On Sun, Dec 14, 2008 at 13:19, Jeffery Harris
jhar...@harris4interactive.com wrote:
 Thanks Daniel. Any recommendations on a good php learning book.

My pleasure, Jeff.

I've honestly never read any of the PHP books out there, so I
wouldn't be able to give you a definite recommendation on that.  What
I *will* highly recommend, though, is subscribing to the PHP General
mailing list.  You'll not only get a lot of good information and
insight from that list, but it's a decent, friendly group of
highly-skilled people there, too.

When you subscribe to the list, your introductory post could be
asking about a good PHP book, and I'll bet that you get some good
answers.

-- 
/Daniel P. Brown
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

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



[PHP] Re: [PHP-QA] Re: [PHP] Quick question regarding $_SESSION and header()

2008-12-11 Thread Daniel Brown
(Forwarding back to PHP General for the archives.)

On Thu, Dec 11, 2008 at 14:31, Ólafur Waage olaf...@gmail.com wrote:
 Its fixed, thanks guys :)

 On Thu, Dec 11, 2008 at 7:16 PM, Daniel Brown danbr...@php.net wrote:
 On Thu, Dec 11, 2008 at 14:01, Ólafur Waage olaf...@gmail.com wrote:
 I should be able to set a session var and then do a header redirect
 right? Small bug regarding that and i just need to be sure.

This isn't a bug in PHP, it's actually in adherance with HTTP
 standards (and current browser standards).  Prior to doing a header()
 redirect, you have to force the cookie to be written with
 session_write_close().

 --
 /Daniel P. Brown
 http://www.parasane.net/
 daniel.br...@parasane.net || danbr...@php.net
 50% Off Hosting! http://www.pilotpig.net/specials.php


 --
 PHP Quality Assurance Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
/Daniel P. Brown
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

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



[PHP] Re: [PHP-QA] Re: [PHP] Quick question regarding $_SESSION and header()

2008-12-11 Thread Ólafur Waage
Whoops, sent the thanks to the wrong list :P

On Thu, Dec 11, 2008 at 7:33 PM, Daniel Brown danbr...@php.net wrote:
 (Forwarding back to PHP General for the archives.)

 On Thu, Dec 11, 2008 at 14:31, Ólafur Waage olaf...@gmail.com wrote:
 Its fixed, thanks guys :)

 On Thu, Dec 11, 2008 at 7:16 PM, Daniel Brown danbr...@php.net wrote:
 On Thu, Dec 11, 2008 at 14:01, Ólafur Waage olaf...@gmail.com wrote:
 I should be able to set a session var and then do a header redirect
 right? Small bug regarding that and i just need to be sure.

This isn't a bug in PHP, it's actually in adherance with HTTP
 standards (and current browser standards).  Prior to doing a header()
 redirect, you have to force the cookie to be written with
 session_write_close().

 --
 /Daniel P. Brown
 http://www.parasane.net/
 daniel.br...@parasane.net || danbr...@php.net
 50% Off Hosting! http://www.pilotpig.net/specials.php


 --
 PHP Quality Assurance Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php





 --
 /Daniel P. Brown
 http://www.parasane.net/
 daniel.br...@parasane.net || danbr...@php.net
 50% Off Hosting! http://www.pilotpig.net/specials.php


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



[PHP] Re: [PHP-DEV] Re: PHP 5.3.0alpha3

2008-12-08 Thread Pierre Joye
hi!

On Mon, Dec 8, 2008 at 12:50 PM, Rodrigo Saboya
[EMAIL PROTECTED] wrote:

 All links at http://windows.php.net/qa/ are 404.

Fixed, the files were there but a change I made in the scripts was
setting the wrong directory. Thanks for the head up!

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

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



[PHP] Re: PHP 5.3.0alpha3

2008-12-08 Thread Rodrigo Saboya

Lukas Kahwe Smith wrote:

Hello!

Johannes has packaged PHP 5.3.0alpha3, which you can find here:
http://downloads.php.net/johannes/

Windows binaries thanks to Pierre, which are available here:
http://windows.php.net/qa/

Please test it carefully, and report any bugs in the bug system, but 
only if you have a short reproducable test case.


It seems unlikely that we will be able to release a beta this year. 
However we currently do not plan another alpha release unless we find 
larger issues in the namespace changes. Please also note that the 
documentation for namespaces has been updated already:

http://php.net/namespace

regards,
Johannes and Lukas


All links at http://windows.php.net/qa/ are 404.

--
Rodrigo Saboya

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



[PHP] Re: [PHP-DEV] PHP 5.3.0alpha3

2008-12-04 Thread Hannes Magnusson
On Thu, Dec 4, 2008 at 22:17, Lukas Kahwe Smith [EMAIL PROTECTED] wrote:
 in the namespace changes. Please also note that the documentation for
 namespaces has been updated already:
 http://php.net/namespace

Not 100% true. The example are missing the separator due to wrong
syntax highlighting.
This has been fixed in CVS and will be updated tomorrow.

Until then, please use the special docs mirror: http://docs.php.net/namespaces

-Hannes

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



[PHP] Re: PHP friendly web software?

2008-11-25 Thread Chris Jiang
I'd say it's not a really good idea to mix code and layout together. Try 
using some of the template systems, or maybe XML/XSL instead. I honestly 
don't know, and doesn't think if there is, or will ever be any page 
editor does it well as you've demanded.




Can anyone recommend a wysiwyg web development software which is php
friendly, i.e. you can design the page in wysiwyg and insert php code into
the html without destroying the screen image preview. I've been using
Frontpage to compose the page then dev-php to insert the php code. This has
worked well but if layout changes need to be made Frontpage displays stuff
all over the place. Just trying MS Expression but this shows blank page when
any php code is present. Any ideas?




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



Re: [PHP] Re: PHP causing Script: '/usr/www/...' in httpd-error.log?

2008-11-24 Thread Jochem Maas
robert arnesson schreef:
 A. There is no more to the log
 B. There are no calls to error_log()
 
 PHP is installed as CGI, I will check the ScriptLog dir (good tip!).
 
 I forgot to mention that this occurres on a few php-files only.. the rest is
 working fine. And there are no major differences between the files that show
 up in the log compared to the ones that don't. I have checked the files them
 selfs over and over.. they are working as expected.

check the contents of those few scripts for a line that looks something like:

error_log(__FILE__);

ie the log messages are done on purpose for tracing purposes... mostly likely
just some debug cruft left in the code by mistake.

hth

 
 /Robert
 
 On Sun, Nov 23, 2008 at 7:07 PM, Nathan Rixham [EMAIL PROTECTED] wrote:
 
 robert arnesson wrote:

 What is causing these errors?

 further thought.. is PHP installed as CGI or SAPI? if CGI have you checked
 the apache settings to see if the ScriptLog directive is on any where?


 


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



Re: [PHP] Re: PHP causing Script: '/usr/www/...' in httpd-error.log?

2008-11-24 Thread robert arnesson
There are no calls to error_log in the files, however, I took care of some
notices in the code (with error_reporting to E_ALL - there where only
notices - no errors or warnings) and suddenly the number of entries in the
error log dropped. Getting rid of all notices will probably solve the
problem. But i still dont get how this can be happening. error_reporting is
set to 0 in php.ini, and no changes or calls to error functions are made in
the code. It's also kind of strange that other files in the same framework,
files that uses the same functions, includes the same files, etc, dont
generate these kind of errors in the log at all.

/Robert

On Mon, Nov 24, 2008 at 4:08 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 robert arnesson schreef:
  A. There is no more to the log
  B. There are no calls to error_log()
 
  PHP is installed as CGI, I will check the ScriptLog dir (good tip!).
 
  I forgot to mention that this occurres on a few php-files only.. the rest
 is
  working fine. And there are no major differences between the files that
 show
  up in the log compared to the ones that don't. I have checked the files
 them
  selfs over and over.. they are working as expected.

 check the contents of those few scripts for a line that looks something
 like:

 error_log(__FILE__);

 ie the log messages are done on purpose for tracing purposes... mostly
 likely
 just some debug cruft left in the code by mistake.

 hth

 
  /Robert
 
  On Sun, Nov 23, 2008 at 7:07 PM, Nathan Rixham [EMAIL PROTECTED]
 wrote:
 
  robert arnesson wrote:
 
  What is causing these errors?
 
  further thought.. is PHP installed as CGI or SAPI? if CGI have you
 checked
  the apache settings to see if the ScriptLog directive is on any where?
 
 
 




-- 
Vänliga hälsningar/Best regards

Robert Arnesson
Ventio AB

E-mail: [EMAIL PROTECTED]
Phone: +46(0)736 41 61 14
Web: www.ventio.se
Address: Holländargatan 27
SE-113 59 Stockholm
Sweden


[PHP] Re: PHP causing Script: '/usr/www/...' in httpd-error.log?

2008-11-23 Thread Nathan Rixham

robert arnesson wrote:

Hello all,

I get plenty of error messages (100 000+ / day) in my Apache httpd-error.log
like the ones shown here

[Sun Nov 23 11:34:42 2008]  Script:  '/usr/www/example/core/js/wall.php'
[Sun Nov 23 11:35:35 2008]  Script:  '/usr/www/example/core/js/wall.php'
[Sun Nov 23 11:36:07 2008]  Script:  '/usr/www/example/core/inc/out.php'
[Sun Nov 23 11:36:32 2008]  Script:  '/usr/www/example/core/inc/out.php'

I have been trying to figure out what is causing this for a long period of
time now but without any luck.
The files mentioned are real files and are used a lot by all ligit users
visiting the site. They are functioning properly and generates no php errors
etc.
The error loglevel in Apache is set to error, PHP errors are turned off.

What is causing these errors?

Any help is appreciated! Thanks.




a: no more to the error messages? like on line.. etc?
b: have you checked all the code for any calls to error_log()?

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



[PHP] Re: PHP causing Script: '/usr/www/...' in httpd-error.log?

2008-11-23 Thread Nathan Rixham

robert arnesson wrote:

What is causing these errors?


further thought.. is PHP installed as CGI or SAPI? if CGI have you 
checked the apache settings to see if the ScriptLog directive is on any 
where?



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



[PHP] Re: PHP causing Script: '/usr/www/...' in httpd-error.log?

2008-11-23 Thread robert arnesson
A. There is no more to the log
B. There are no calls to error_log()

PHP is installed as CGI, I will check the ScriptLog dir (good tip!).

I forgot to mention that this occurres on a few php-files only.. the rest is
working fine. And there are no major differences between the files that show
up in the log compared to the ones that don't. I have checked the files them
selfs over and over.. they are working as expected.

/Robert

On Sun, Nov 23, 2008 at 7:07 PM, Nathan Rixham [EMAIL PROTECTED] wrote:

 robert arnesson wrote:

 What is causing these errors?


 further thought.. is PHP installed as CGI or SAPI? if CGI have you checked
 the apache settings to see if the ScriptLog directive is on any where?




Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Nathan Rixham

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


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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


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.



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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Daniel P. Brown
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.

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Nathan Rixham

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!


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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


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

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


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.


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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Daniel P. Brown
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.

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


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

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Nathan Rixham

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.


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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


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



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



[PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-19 Thread Nathan Rixham

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:


PHP Warning: file_get_contents(http://.../): failed to open stream: 
HTTP request failed!


Sometimes it's a single failure, other times, it fails repeatedly for 
30-60 seconds, then starts working again. Strange, no?


At first, I thought maybe I've maxed out the server in question, but I'm 
not. This problem happens on both servers that the scripts fetch data 
from. And more significantly, while one process may fail at 
file_get_contents(), the other processes (running identical code) on the 
same box continue to execute the function (against the same servers) 
without incident.


My question is, is there some resource in Mac OS X Server 10.4 (or PHP 
5.2.4) that would limit a continuously running PHP script from executing 
file_get_contents()? And to be clear, the failure doesn't kill the 
script, and after the failure, it will start working again.


...Rene


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]


next up (very unlikely) but possibly outgoing port conflict where the 
previous local port is still closing whilst trying to be re-opened.


to get an ideal fix though you'll want to move away from 
file_get_contents() as you're not doing things 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.



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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-19 Thread Rene Fournier

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


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



[PHP] Re: PHP performance profiling

2008-11-18 Thread Nathan Rixham

Gryffyn wrote:
I did a search and didn't find anything really astounding sounding, so I 
wanted to ask for some live recommendations from the crowd here.


I was wondering if anyone had used FirePHP with Firebug or could recommend a 
good profiling method for figuring out where the slow parts of your PHP 
code are.


I'm curious about solutions that don't require installing something on the 
server side, since that's not usually an option with shared web hosting and 
all.


I used to love Zend Studio's server component along with the IDE, but it 
doesn't help so much with shared web hosts where you can't install the 
server component.


Ideally, I'd love to see what segments of the code are running slow, but at 
the very minimum, I want to see if it's the PHP code or the MySQL calls 
that are slow.   I know I can just add my own statements in the code, but I 
was hoping there was a more comprehensive solution available.


Thanks in advance.

-TG


manually with a home grown script or pear benchmark
apd on windows
or zend platform

don't really know of anything else tbh but would like a nice profiler 
for php myself (easier if php was precompiled I guess)


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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Jochem Maas
please don't post this kind of question to internals. use [EMAIL PROTECTED]

Christopher Vogt schreef:
 Hej,
 
 I use PHP 5.2.6. I am refactoring some code to use more
 object-orientation. I encounter a problem, where the new object-oriented
 version results in a fatal error, where the old array-oriented version
 didn't.
 
 I fetch records a database. Sometime it happens that a record does not
 exist anymore. Let's assume it's a user, then $user will be NULL.
 
 echo $user['fullname']; // no error at all, $user['fullname'] === NULL
 
 Shouldn't this at least trigger a Notice?
 
 echo $user-get_fullname(); // Fatal error
 
 I agree this should trigger an error, but a Fatal error is a little
 too much, I think. It terminates the script leaving the html-document
 incomplete. I would prefer a Warning and NULL instead.

either go back to using arrays or fix your code. your asking for something
to change when you have little idea of why or what it is in the first place.

 
 Is there any reason against it?

plenty, I suggest taking the time to get a better understanding of OO, the php
implementation and the various related tools it offers (instanceof, 
method-chaining,
exceptions, etc, etc).

calling a method on an object that doesn't exist is tantamount to calling a 
function
which doesn't exist ... both are a fatal error.

 
 Best regards
 
 Christopher
 


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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Christopher Vogt
Hej Jochem,

I understand there are many PHP beginners flooding the wrong lists with
the wrong questions, so I don't mind your harsh response. But I am not
one of them.

 please don't post this kind of question to internals. use [EMAIL PROTECTED]

This was/is a question if something is worth a change request. This
concerns the development of PHP and in my eyes belongs on internals. Am
I mistaken here?

 plenty, I suggest taking the time to get a better understanding of OO,
 the php implementation and the various related tools it offers
 (instanceof, method-chaining, exceptions, etc, etc).

I have a good understanding of OOP. This is not a start for me. I am
just refactoring existing PHP code to be object-oriented. You say there
are plenty of reasons for a Fatal error, so please tell me a few, so I
understand the reasons.

 calling a method on an object that doesn't exist is tantamount to calling a 
 function
 which doesn't exist ... both are a fatal error.

Yes and maybe that is wrong two. But besides that, there is a difference
between the two. It hardly happens that a bug results in a call to a
non-existing function. But a bug can easily lead to an uninitialized
variable which is then treated as an object.

The problem with Fatal errors is that there is no way for me to handle
them. I use an error_handler in the production system. When an error or
unhandled exception occurs it displays an end-user-friendly error
message and then sends an email to our team's mailbox. Working with
arrays I can handle all sensible run-time errors using this methods.
Working with objects, I apparently cannot, because Fatal Error aren't
handled by the error_handler.

That's a serious problem because it completely hides a likely group of
errors from the notification system. I hopes this motivates the question
a little better.

But the question remains. Are there reasons to have a Fatal error here?

For comparison: Python throws an exception in a comparable case,
allowing me to handle the error.

Best regards

Christopher

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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Jochem Maas
Christopher Vogt schreef:
 Hej Jochem,
 
 I understand there are many PHP beginners flooding the wrong lists with
 the wrong questions, so I don't mind your harsh response. But I am not
 one of them.

I disagree. this kind of thing belongs on php-general (and lets keep it on list
please), if you have a serious proposal/rfc and/or one develops from a 
discussion
there then likely some of the old-hats will likely recommend escalating to
internals.

 please don't post this kind of question to internals. use [EMAIL PROTECTED]
 
 This was/is a question if something is worth a change request. This
 concerns the development of PHP and in my eyes belongs on internals. Am
 I mistaken here?
 
 plenty, I suggest taking the time to get a better understanding of OO,
 the php implementation and the various related tools it offers
 (instanceof, method-chaining, exceptions, etc, etc).
 
 I have a good understanding of OOP. This is not a start for me. I am
 just refactoring existing PHP code to be object-oriented. You say there
 are plenty of reasons for a Fatal error, so please tell me a few, so I
 understand the reasons.

fine, so your not an OO noob. nonetheless your going have to get accustomed
and intimate with php's implementation which is what it is, it works, it's 
consistent
but may not conform to all your expectations that you bring with you from other
languages ... it's a question of you adapting to php not the other way around.

if everyone who came to a language had that language implementation changed
to meet their expectations of what it should be doing and how said language
would quickly deteriorate into complete shite ... something noone would want to
use or develop.

 
 calling a method on an object that doesn't exist is tantamount to calling a 
 function
 which doesn't exist ... both are a fatal error.
 
 Yes and maybe that is wrong two. But besides that, there is a difference
 between the two. It hardly happens that a bug results in a call to a
 non-existing function. But a bug can easily lead to an uninitialized
 variable which is then treated as an object.
 
 The problem with Fatal errors is that there is no way for me to handle
 them. I use an error_handler in the production system. When an error or
 unhandled exception occurs it displays an end-user-friendly error
 message and then sends an email to our team's mailbox. Working with
 arrays I can handle all sensible run-time errors using this methods.
 Working with objects, I apparently cannot, because Fatal Error aren't
 handled by the error_handler.
 
 That's a serious problem because it completely hides a likely group of
 errors from the notification system. I hopes this motivates the question
 a little better.
 
 But the question remains. Are there reasons to have a Fatal error here?

yes, it tells you your doing something impossible.

 For comparison: Python throws an exception in a comparable case,
 allowing me to handle the error.

PHP != Python. python is pure OO. php is hybrid. you have to refactor your
code in different ways.

if your writing code that blindly makes use of a $user var that may or may not
be a valid object then you code is incorrect. not being able to trap Fatals is
essentially a non-issue as your code should be structured so that they cannot 
occur.

there are a number of ways of dealing with the issue you have.

1. test the validity of the object

if ($user instanceof User) {
// do something
}

2. start using exceptions

try {
$user = UserGetter::get($id);

// do stuff with $user
} catch (UserException $e) {
// handle exception
}

// where UserGetter::get() is something like ...

class UserGetter {
static function get($id) {  
$data = getUserDataFromDB($id)
if ($data)
return new User($data);

throw new UserException($id is invalid);
}
}

what this comes down to is this, python gives you exceptions free of
charge, php asks you to implement and throw them yourself ... this is
primarily the result of php's procedural legacy. ce la vie.

 
 Best regards
 
 Christopher


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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Paweł Stradomski
W liście Christopher Vogt z dnia poniedziałek 17 listopada 2008:

 I have a good understanding of OOP. This is not a start for me. I am
 just refactoring existing PHP code to be object-oriented. You say there
 are plenty of reasons for a Fatal error, so please tell me a few, so I
 understand the reasons.
You're calling a method. This requires code execution, but the code isn't 
there. If you were accessing a property of non-existing object (that is, if 
you were doing $user-fullname;) then you'd get a warning and NULL. It's not 
so for functions, as they're request for code execution, not for value 
(remember, not all functions return values as they most important effect - 
it's not Haskell).

Calling non-existing function returns in fatal error in PHP; it's the same 
for:
$object-iHaveNoSuchMethod();
$null-method();
nosuchfunction();

-- 
Paweł Stradomski

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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Christopher Vogt
Hej Stefan,

 This was/is a question if something is worth a change request. This
 concerns the development of PHP and in my eyes belongs on internals. Am
 I mistaken here?
 
 Yes, because you are like the 100th person to request that. A mail to
 general@ probably would have told you that.

I am sorry about that. I'll first consult general@ in the future.

Best regards

Christopher

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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Christopher Vogt
Hej Jochem,

 this kind of thing belongs on php-general (and lets keep it on list
 please), if you have a serious proposal/rfc and/or one develops from a 
 discussion
 there then likely some of the old-hats will likely recommend escalating to
 internal.

I'm sorry I wasn't aware of this procedure. I will start discussions
on general@ from now on.

 But the question remains. Are there reasons to have a Fatal error here?
 
 yes, it tells you your doing something impossible.

Well yes, but this does not mean it has to terminate. It could skip it
instead.

 For comparison: Python throws an exception in a comparable case,
 allowing me to handle the error.
 
 PHP != Python. python is pure OO. php is hybrid. you have to refactor your
 code in different ways.

Python is, just as PHP, a multi-paradigm language. Both support
procedural, OOP and even functional programming styles.

 what this comes down to is this, python gives you exceptions free of
 charge, php asks you to implement and throw them yourself ...

You are right. This seems to be, what it comes down too. I can't say
that I am happy with it. And I think being able to handle fatal errors,
whenever possible would be a very useful feature.

What about E_RECOVERABLE_ERROR, couldn't calling a method on a
non-object trigger E_RECOVERABLE_ERROR, instead of E_ERROR?

Best regards

Christopher


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



[PHP] Re: [PHP-DEV] Fatal error: Call to a member function on a non-object

2008-11-17 Thread Jochem Maas
Christopher Vogt schreef:
 Hej Jochem,
 
 this kind of thing belongs on php-general (and lets keep it on list
 please), if you have a serious proposal/rfc and/or one develops from a 
 discussion
 there then likely some of the old-hats will likely recommend escalating to
 internal.
 
 I'm sorry I wasn't aware of this procedure. I will start discussions
 on general@ from now on.
 
 But the question remains. Are there reasons to have a Fatal error here?
 yes, it tells you your doing something impossible.
 
 Well yes, but this does not mean it has to terminate. It could skip it
 instead.

well I suppose, but then that comes down to 'you can implement a language
to do pretty much whatever you want' theoretically.

most likely there are BC issues, performance issues and technical limitations
that dictate E_FATAL in the case.

 For comparison: Python throws an exception in a comparable case,
 allowing me to handle the error.
 PHP != Python. python is pure OO. php is hybrid. you have to refactor your
 code in different ways.
 
 Python is, just as PHP, a multi-paradigm language. Both support
 procedural, OOP and even functional programming styles.

fair enough, but php's engine doesn't and will not (AFAIKT from core dev team
stance) throw exceptions (although some new OO extensions do and/or can), the
engine triggers errors.

you want it to trigger exceptions, fine. simply throw an exception if your
object factory can't build the requested object.

 what this comes down to is this, python gives you exceptions free of
 charge, php asks you to implement and throw them yourself ...
 
 You are right. This seems to be, what it comes down too. I can't say
 that I am happy with it. And I think being able to handle fatal errors,
 whenever possible would be a very useful feature.
 
 What about E_RECOVERABLE_ERROR, couldn't calling a method on a
 non-object trigger E_RECOVERABLE_ERROR, instead of E_ERROR?

E_FATAL means the engine is in an unrecoverable state - they can't be handled in
the php code by their very definition, whether this is strictly true in this 
case
I don't know. E_RECOVERABLE_ERROR was introduced long after it was decided
E_FATAL must/should be used in the described scenario.

if you really think the behaviour could be changed without breaking BC by all
means submit a patch ... if it's good and the argumentation sound the core devs
may accept it, otherwise change your code to work with the implementation that
exists rather than complain that php is not like insert favorite language 
here.
no?


 
 Best regards
 
 Christopher
 


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



Re: [PHP] Re: PHP / Procmail / MIME decoder, Imagemagick, MySQL, PDF fax management system

2008-11-10 Thread Richard Heyes
 fair

Fair ?! It does an outstanding job! :-)

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated November 1st)

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



[PHP] Re: PHP / Procmail / MIME decoder, Imagemagick, MySQL, PDF fax management system

2008-11-10 Thread Colin Guthrie

Ashley Sheridan wrote:

This may sound a bit of a strange question, but why put the fax in a
PDF? I mean, it's a bitmap graphic, so why not just leave it in a bitmap
format?


Most fax systems I've seen deal with TIFF images but they can be in a 
slightly weird format (missing lines, requiring stretching or something 
like that). Putting the data into PDF is trivial (this is done 
automatically by hylafax system IIRC).


Also it seems Dan's issue is not converting it in PDF format, as he gets 
the data sent to him in PDF already.



For the email decoding, as Richard said, the PEAR MimeDecode classes do 
a fair job of this.


Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



Re: [PHP] Re: PHP and Cyrus problem

2008-11-10 Thread Emerson Virti
Thank's for response.
This solution I tried many times but didn't resolved.
The reconstruct command don't modify this cyrus.header file.



2008/11/7 Colin Guthrie [EMAIL PROTECTED]

 Emerson Virti wrote:

 Where is the problem?


 Probably not the right list, but have you tried using cyradm and running:
 reconstruct user.name.mailbox.name

 (correct the folder as needed).

 When a cyrus database file gets corrupted or generally borked this fixes it
 99% of the time for me.

 Col

 --

 Colin Guthrie
 gmane(at)colin.guthr.ie
 http://colin.guthr.ie/

 Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
 Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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




-- 
Émerson Salvadori Virti
Engenheiro de Computação
Mestre em Ciência da Computação
[EMAIL PROTECTED]


[PHP] Re: PHP and Cyrus problem

2008-11-07 Thread Colin Guthrie

Richard Heyes wrote:

...PHP for webmail.


Did you know you can use Gmail for webmail, even having the From:
address set to your own domain? It will require a little more setup
(well, with ten thousand mailboxes that would be a lot) but you end
with one of the best webmail clients there is.


While this is a little off topic there are lots of reasons not to do 
this. For one, the IMAP support in GMail, while very welcome, does have 
different paradigms than traditional email systems. I actually prefer 
the GMail approach of labels rather than real folders, but until this 
is exported as part of the IMAP protocol and clients like thunderbird 
support and are aware of it, it's sadly quite clunky to work with. 
(things like copying/moving mails is bit of a headfuk cos you're not 
really copying them, you're labeling them and it shouldn't be purged 
from the inbox, because the inbox is just a new mail filter etc. etc.


As the original problem showed a IMAP+Webmail solution, I'd imagine IMAP 
support and a dedicated client is important.



Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



[PHP] Re: PHP and Cyrus problem

2008-11-07 Thread Colin Guthrie

Emerson Virti wrote:

Where is the problem?


Probably not the right list, but have you tried using cyradm and 
running: reconstruct user.name.mailbox.name


(correct the folder as needed).

When a cyrus database file gets corrupted or generally borked this fixes 
it 99% of the time for me.


Col

--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


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



<    2   3   4   5   6   7   8   9   10   11   >