php-general Digest 27 Feb 2009 14:10:57 -0000 Issue 5982
php-general Digest 27 Feb 2009 14:10:57 - Issue 5982 Topics (messages 288894 through 288917): How do I remove an array element from within a recursive function? 288894 by: Daevid Vincent 288895 by: Shawn McKenzie 288896 by: Shawn McKenzie 288897 by: Daevid Vincent 288898 by: Chris Re: verify text in field 288899 by: PJ 288902 by: David Robley Re: catch the error 288900 by: 9el 288917 by: Boyd, Todd M. Stop Being a Wage Slave! Join EarnGoogleCash Program! 288901 by: Julianne Carbaugh Stupid is as Stupid does 288903 by: Michael A. Peters 288905 by: Ondrej Kulaty 288906 by: Sudheer Re: use strict or similar in PHP? 288904 by: Per Jessen 288907 by: Hans Schultz 288908 by: 9el 288910 by: Michael A. Peters 288912 by: Hans Schultz 288913 by: Ashley Sheridan 288914 by: Hans Schultz 288915 by: Robert Cummings 288916 by: Bob McConnell Make Money From Your Home Using Internet 288909 by: Roly Cross Weird spam messages on the list... [WAS: Stop Being a Wage Slave! Join EarnGoogleCash Program!] 288911 by: Michelle Konzack Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- I have an array like this and I simply need to recurse over it and find a matching menu item to remove: array(3) { [dart]= array(10) { [0]= object(menuItem)#4 (9) { [menu]= string(7) My DART [name]= string(7) My DART [title]= string(39) Data Analasys Reliability Tracker [employee_only]= bool(false) [page]= NULL [children]= NULL [parent]= NULL [current]= bool(false) [array_key]= string(4) dart } [1]= object(menuItem)#5 (9) { [menu]= string(5) Login [name]= string(5) Login [title]= string(5) Login [employee_only]= bool(false) [page]= string(9) login.php [children]= NULL [parent]= NULL [current]= bool(false) [array_key]= string(4) dart } [2]= object(menuItem)#6 (9) { [menu]= string(13) Lost Password [name]= string(13) Lost Password [title]= string(13) Lost Password [employee_only]= bool(false) [page]= string(12) forgotpw.php [children]= NULL [parent]= NULL [current]= bool(false) [array_key]= string(4) dart } ... I'm trying to remove [menu] == 'Login' from the array, but despite finding the element, it never removes. isn't that what the reference stuff is for? menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password')); public static final function removeMenuItems($menuItems, $removeArray) { foreach($menuItems as $value) { if (is_array($value-children)) menuItem::removeMenuItems($value-children, $removeArray); else { //echo *** CHECKING .$value-menu. against .implode(',',$removeArray). ***; if (in_array($value-menu, $removeArray)) { //echo *** REMOVING .$value-menu. ***; unset($value); } } } } ---End Message--- ---BeginMessage--- Daevid Vincent wrote: I'm trying to remove [menu] == 'Login' from the array, but despite finding the element, it never removes. isn't that what the reference stuff is for? Yes, but foreach can't modify an array unless you use a reference in the foreach also. Try this: foreach($menuItems as $value) menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password')); public static final function removeMenuItems($menuItems, $removeArray) { foreach($menuItems as $value) { if (is_array($value-children)) menuItem::removeMenuItems($value-children, $removeArray); else { //echo *** CHECKING .$value-menu. against .implode(',',$removeArray). ***; if (in_array($value-menu, $removeArray)) { //echo *** REMOVING .$value-menu. ***;
Re: [PHP] use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz h.schult...@yahoo.com wrote: On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL If you are a programmer you should know the difference between Compiler and Interpreter. PHP is interpretted. You are using term without knowing the meaning. Just like javascript is run in browser ... PHP is run at server while the page is being served to the visitor clear? Now tell us your question again. www.twitter.com/nine_L www.lenin9l.wordpress.com -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
9el wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz h.schult...@yahoo.com wrote: On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL If you are a programmer you should know the difference between Compiler and Interpreter. PHP is interpretted. You are using term without knowing the meaning. Just like javascript is run in browser ... PHP is run at server while the page is being served to the visitor clear? Not necessarily - there are compilers for php, just like there are compilers for perl, though they are not needed. They can speed up the serving of pages and reduce resource consumption on the server. It is also good practice to completely assemble the page before sending a single line (including headers) to the browser rather than send some data while still executing the script, in which case the script execution time could be likened to a compile time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird spam messages on the list... [WAS: Stop Being a Wage Slave! Join EarnGoogleCash Program!]
Hello *, This list is subscribers only, and HOW can it be, that a Spamme can use a Debian mailinglist to spam php-general. AFAIK it is not possibel for a mailinglist to subscribe itself to anoter mailinglist. I think, the listadmins from list.php.net should blacklist lists.debian.org. 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] use strict or similar in PHP?
Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies On Fri, 27 Feb 2009 10:22:44 +0100, 9el le...@phpxperts.net wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz h.schult...@yahoo.com wrote: On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL If you are a programmer you should know the difference between Compiler and Interpreter. PHP is interpretted. You are using term without knowing the meaning. Just like javascript is run in browser ... PHP is run at server while the page is being served to the visitor clear? Now tell us your question again. www.twitter.com/nine_L www.lenin9l.wordpress.com -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies On Fri, 27 Feb 2009 10:22:44 +0100, 9el le...@phpxperts.net wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz h.schult...@yahoo.com wrote: On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL If you are a programmer you should know the difference between Compiler and Interpreter. PHP is interpretted. You are using term without knowing the meaning. Just like javascript is run in browser ... PHP is run at server while the page is being served to the visitor clear? Now tell us your question again. www.twitter.com/nine_L www.lenin9l.wordpress.com -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
Hahahah,I was thinking the same thing :D --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:11 PM On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? Ash www.ashleysheridan.co.uk
Re: [PHP] use strict or similar in PHP?
On Fri, 2009-02-27 at 13:11 +, Ashley Sheridan wrote: But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? There's a blurring of the lines these days with respect to compiled and interpreted languages. At one time an interpreted language was truly interpreted line-by-line as the code was running. But now, most interpreted languages perform a compilation stage whereby the source code is converted to bytecode or some internal representation of an engine specific instruction tree. This internal representation is what eAccelerator and APC caches use to speed up performance... specifically they eliminate the compilation stage. 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] use strict or similar in PHP?
From: Hans Schultz Hahahah,I was thinking the same thing :D --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:11 PM On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? The compile process parses the text of the source file and translates it into an alternate form. This can by byte code, ala Pascal and Java, or executable code, ala COBOL and C. An interpreter, on the other hand, simply parses the source file, line by line and executes each line as it reads it, usually without saving it in an alternate form. This is the way JavaScript works. Some languages, such as Perl, are somewhere between the two. Perl parses the whole file, then executes only if it did not find any syntax errors or undefined variables (if certain strictures are turned on). Otherwise it prints out only the error message. From what I have seen of PHP, it is strictly interpreted. i.e. a line is read, and executed. Then the next line is read, and executed. etc. So there is no way to get it to block execution from the beginning even when there are fatal errors. It will already have printed out as much of the page as it executed before it finds those errors. This works fine in a development or test environment, but is a serious problem in production. So, I believe the question that was actually asked, is there any way to induce PHP to completely parse the source file(s) and report any errors before printing out anything, even the HTTP headers? Or can I set it to redirect to an error page instead of sending an incomplete target page with error messages that might reveal information I don't want exposed? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: catch the error
-Original Message- From: Chris [mailto:dmag...@gmail.com] Sent: Thursday, February 26, 2009 6:38 PM To: Boyd, Todd M. Cc: PHP General list Subject: Re: [PHP] Re: catch the error Boyd, Todd M. wrote: -Original Message- From: Chris [mailto:dmag...@gmail.com] Sent: Thursday, February 26, 2009 4:16 PM To: Boyd, Todd M. Cc: PJ; PHP General list Subject: Re: [PHP] Re: catch the error In examples sent to you, people foolishly replaced your $db var with $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your database connection as $db_connect in some versions of the source, but then you reference $db (without _connect) in your mysql_select call in that same source. $db = mysql_connect([option list here]); # -- this code instantiates a connection mysql_select_db([some name], $db); # notice how $db is here? $result = mysql_query([some query], $db); # it's here, too! $db becomes your resource link when you use mysql_connect. That resource link must then be passed to your mysql functions. Otherwise, they have no idea which database connection you are attempting to use. RTFM? If no connection is specified, the last one is used. It is an optional argument (only *really* needed when you have multiple connections in the same script). RTF E-mail I sent? He had used $db_connect instead of $db. $db_connect hadn't been set to anything. He was specifying a connection, but it was null. Unless it falls back to the last connection used in the case of an empty variable, then this was most likely (read: proven to be) the problem. The last two emails I saw (no I haven't read the whole thread) were: $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name,$db); snip $result1 = mysql_query($sql1,$db); and $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name,$db); which have the right variables. Plus I was picking on the you must do this - using the link identifier is an optional thing as I already said. Yes, it was solved before I replied. I just wanted to point out why it worked in the situations that it did and why it did not work in the situations that it did not. As the OP had been staring at it for too long, all of the code started to blur together. :) Anyway, it's a moot point now. I think the information you provided about the link identifier was solid advice... I was just trying to point out that using two different variables when specifying the link identifier in mysql functions was what gave him so much guff. // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How do I remove an array element from within a recursive function?
-Original Message- From: Chris [mailto:dmag...@gmail.com] Sent: Thursday, February 26, 2009 8:48 PM To: Daevid Vincent Cc: php-general@lists.php.net; Shawn McKenzie Subject: Re: [PHP] Re: How do I remove an array element from within a recursive function? Daevid Vincent wrote: I tried that and it still doesn't work. I even tried this hardcore test: public static final function removeMenuItems($menuItems, $removeArray) { foreach($menuItems as $value) { unset($value); } } You don't unset the value, you unset the key. ?php $items = array('menu1', 'menu2', 'menu3'); echo Before:\n; print_r($items); foreach ($items as $_menuKey = $value) { if ($value == 'menu2') { unset($items[$_menuKey]); } } echo After:\n; print_r($items); $ php test.php Before: Array ( [0] = menu1 [1] = menu2 [2] = menu3 ) After: Array ( [0] = menu1 [2] = menu3 ) I would have gone with array_splice() on this one, I think. However, I believe it will mangle associative arrays. Glad to know that there's a way to use unset() on these, as I was unaware of it. 3 this list! :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird spam messages on the list... [WAS: Stop Being a Wage Slave! Join EarnGoogleCash Program!]
On Fri, Feb 27, 2009 at 12:35:25PM +0100, Michelle Konzack wrote: Hello *, This list is subscribers only, and HOW can it be, that a Spamme can use a Debian mailinglist to spam php-general. AFAIK it is not possibel for a mailinglist to subscribe itself to anoter mailinglist. I think, the listadmins from list.php.net should blacklist lists.debian.org. Look more closely at the headers. There is spoofing going on here. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] use strict or similar in PHP?
-Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Friday, February 27, 2009 7:44 AM To: h.schult...@yahoo.com; a...@ashleysheridan.co.uk Cc: php-general@lists.php.net; 9el Subject: RE: [PHP] use strict or similar in PHP? From: Hans Schultz Hahahah,I was thinking the same thing :D --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:11 PM On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? The compile process parses the text of the source file and translates it into an alternate form. This can by byte code, ala Pascal and Java, or A la Pascal? What?! :D I had always thought when hit F9 in my Borland studio back in the day that it built me a pretty little EXE file. executable code, ala COBOL and C. An interpreter, on the other hand, simply parses the source file, line by line and executes each line as it reads it, usually without saving it in an alternate form. This is the way JavaScript works. Some languages, such as Perl, are somewhere between the two. Perl parses the whole file, then executes only if it did not find any syntax errors or undefined variables (if certain strictures are turned on). Otherwise it prints out only the error message. From what I have seen of PHP, it is strictly interpreted. i.e. a line is read, and executed. Then the next line is read, and executed. etc. So there is no way to get it to block execution from the beginning even when there are fatal errors. It will already have printed out as much of the page as it executed before it finds those errors. This works fine in a development or test environment, but is a serious problem in production. So, I believe the question that was actually asked, is there any way to induce PHP to completely parse the source file(s) and report any errors before printing out anything, even the HTTP headers? Or can I set it to redirect to an error page instead of sending an incomplete target page with error messages that might reveal information I don't want exposed? Well, take care of all of your logic before you display anything. It's not that difficult, to be honest... especially if you're already using an MVC design pattern/framework or a template system. If you are just worried about displaying garbage and not about performing logic while the page is being output to the browser, then I'd say use an output buffer. If something bad happens, just clear the buffer out rather than send it to the user, and forward to your error page instead. http://www.php.net/ob_start HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Browser timeout
Hello, I am running a script that process the user's request, which usually takes about 40 seconds. The problem is that on Internet Explorer 6, it timeouts - probably because no response was sent. How do I solve this problem? Since I tried some things and header() messages, nothing worked.
[PHP] Re: use strict or similar in PHP?
Hans Schultz wrote: Is there in PHP something like use strict from perl? I find it pretty annoying to need to run script over and over again just to find out that I made typo in variable name. I find that my IDE catches most of the typos before I even try to run the page. I use Netbeans 6.5 with the PHP extension, but there are alternatives... Is there some way for PHP to cache some data on the page? I like very much PHP's speed but it would be even better to be able to cache some frequently used data from database? Generally it's not worth the trouble, but you could cache in the session... Remember that PHP is largely stateless, so one page call knows nothing of any other page calls. This is different to Java, where you can hold state in the underlying virtual machine and recover it later... Also regarding databases, I liked a lot java's way of sending data to database using parameters (select * from user where username = ? and then passing parameter separately with database doing necessary escaping and everything). Is there something like PHPDBC similar to JDBC? With PostgreSQL (and probably MySQL too) you can do either a prepared statement (see http://www.php.net/manual/en/function.pg-prepare.php) and then execute that, or a simpler parameterised query (see http://www.php.net/manual/en/function.pg-query-params.php) Something like $sql = 'SELECT * FROM user WHERE username=$1'; $params = Array('pete'); $result = pg_query_params($sql,$params); That way you get the safest handling of values without any tedious messing about with manually escaping strings. I suspect that under the hood it actually prepares a statement and then executes it, but I might be wrong... -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser timeout
Hi Daniel, Can you supply more information regarding this script? what it does? Regards, Nitsan דרך אגב נחמד לראות פה עוד ישראלים שבת שלום
RE: [PHP] use strict or similar in PHP?
On Fri, 2009-02-27 at 08:43 -0500, Bob McConnell wrote: From: Hans Schultz Hahahah,I was thinking the same thing :D --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:11 PM On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? The compile process parses the text of the source file and translates it into an alternate form. This can by byte code, ala Pascal and Java, or executable code, ala COBOL and C. An interpreter, on the other hand, simply parses the source file, line by line and executes each line as it reads it, usually without saving it in an alternate form. This is the way JavaScript works. Some languages, such as Perl, are somewhere between the two. Perl parses the whole file, then executes only if it did not find any syntax errors or undefined variables (if certain strictures are turned on). Otherwise it prints out only the error message. From what I have seen of PHP, it is strictly interpreted. i.e. a line is read, and executed. Then the next line is read, and executed. etc. So there is no way to get it to block execution from the beginning even when there are fatal errors. It will already have printed out as much of the page as it executed before it finds those errors. This works fine in a development or test environment, but is a serious problem in production. So, I believe the question that was actually asked, is there any way to induce PHP to completely parse the source file(s) and report any errors before printing out anything, even the HTTP headers? Or can I set it to redirect to an error page instead of sending an incomplete target page with error messages that might reveal information I don't want exposed? No, PHP is not strictly interpreted. You are confusing run-time includes with strict interpretation. PHP parses a source file completely before executing the code. The problem is when you make use of require() or include(). In these cases the parsing is defered until such time as the logic warrants inclusion of the source code. This is advantageous since compilation need not be performed for source code not being used by a page. However, as you have duly noted, you cannot detect parse errors before any content is sent to the browser for such included source (unless you use output buffering). However, there is a simple command-line facility to check the parsability of your source code before releasing it for public consumption: php -l source.php 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] use strict or similar in PHP?
So, in the end, following should output something in php??php echo PHP is interpreted!!!; %meaningless line with errors?!*! ? Anyway we are far off topic now :-) Cheers --- On Fri, 2/27/09, Bob McConnell r...@cbord.com wrote: From: Bob McConnell r...@cbord.com Subject: RE: [PHP] use strict or similar in PHP? To: h.schult...@yahoo.com, a...@ashleysheridan.co.uk Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:43 PM From: Hans Schultz Hahahah,I was thinking the same thing :D --- On Fri, 2/27/09, Ashley Sheridan a...@ashleysheridan.co.uk wrote: From: Ashley Sheridan a...@ashleysheridan.co.uk Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net, 9el le...@phpxperts.net Date: Friday, February 27, 2009, 1:11 PM On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote: Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: There is no compile time. PHP is interpreted so it is compiled and then executed. Sounds like contradiction in this very sentence :-). My apologies But if it never compiles, it can never run, but it can't run without compiling? Arggh, my head. So does that mean if I go back in time and shoot my grandfather, then nobody is in the woods to hear PHP try to compile? The compile process parses the text of the source file and translates it into an alternate form. This can by byte code, ala Pascal and Java, or executable code, ala COBOL and C. An interpreter, on the other hand, simply parses the source file, line by line and executes each line as it reads it, usually without saving it in an alternate form. This is the way JavaScript works. Some languages, such as Perl, are somewhere between the two. Perl parses the whole file, then executes only if it did not find any syntax errors or undefined variables (if certain strictures are turned on). Otherwise it prints out only the error message. From what I have seen of PHP, it is strictly interpreted. i.e. a line is read, and executed. Then the next line is read, and executed. etc. So there is no way to get it to block execution from the beginning even when there are fatal errors. It will already have printed out as much of the page as it executed before it finds those errors. This works fine in a development or test environment, but is a serious problem in production. So, I believe the question that was actually asked, is there any way to induce PHP to completely parse the source file(s) and report any errors before printing out anything, even the HTTP headers? Or can I set it to redirect to an error page instead of sending an incomplete target page with error messages that might reveal information I don't want exposed? Bob McConnell
[PHP] Re: use strict or similar in PHP?
Thanks, this is the most useful answer I got. I will try to use that IDE and to see if it works for me. Regarding databases I was hopping for some abstraction layer like dbx only better (to allow parameters). Regards, Hans On Fri, 27 Feb 2009 15:41:55 +0100, Peter Ford p...@justcroft.com wrote: Hans Schultz wrote: Is there in PHP something like use strict from perl? I find it pretty annoying to need to run script over and over again just to find out that I made typo in variable name. I find that my IDE catches most of the typos before I even try to run the page. I use Netbeans 6.5 with the PHP extension, but there are alternatives... Is there some way for PHP to cache some data on the page? I like very much PHP's speed but it would be even better to be able to cache some frequently used data from database? Generally it's not worth the trouble, but you could cache in the session... Remember that PHP is largely stateless, so one page call knows nothing of any other page calls. This is different to Java, where you can hold state in the underlying virtual machine and recover it later... Also regarding databases, I liked a lot java's way of sending data to database using parameters (select * from user where username = ? and then passing parameter separately with database doing necessary escaping and everything). Is there something like PHPDBC similar to JDBC? With PostgreSQL (and probably MySQL too) you can do either a prepared statement (see http://www.php.net/manual/en/function.pg-prepare.php) and then execute that, or a simpler parameterised query (see http://www.php.net/manual/en/function.pg-query-params.php) Something like $sql = 'SELECT * FROM user WHERE username=$1'; $params = Array('pete'); $result = pg_query_params($sql,$params); That way you get the safest handling of values without any tedious messing about with manually escaping strings. I suspect that under the hood it actually prepares a statement and then executes it, but I might be wrong... -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Development methods (was: use strict or similar in PHP?)
From: Boyd, Todd M. Well, take care of all of your logic before you display anything. It's not that difficult, to be honest... especially if you're already using an MVC design pattern/framework or a template system. That's an interesting string of buzzwords, but it carries no meaning for me. Would you care to elucidate further? As far as the code I am working with, I inherited over 160 files of mixed HTML and PHP, where the logic and presentation are intermingled (mangled) throughout. My initial toolset was TextPad4, WinSCP and Putty on a WinXP workstation, with Apache on RHEL 5 as the server. (The original coder used vi on a clone of the server until they took it away from him.) The chances of re-implementing the entire project are roughly equivalent to a zero with the edges rubbed out. I already have a six month to-do list just adding the new features already requested by current clients. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting An Inventory Product Count
Newbie question Hi folks, Currently, I have an inventory table that stores individual records for each single item in inventory - ( each item is on its own line because it has serial numbers associated with it) like: fields: Item - ModelID - sn item1 - 1 - sn xxx item1 - 1 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item3 - 2 - sn xxx Goal: I would like to give a report page with total counts for current in inventory like: COUNTS... item1 = 2 item2 = 3 item3 = 1 so I created a fool around query that gets a count for just ModelID = 1 $query_count_model1 = SELECT count(inventory_id) as thecount FROM inventory WHERE ModelID = 1; BUT: - the I'm sure there is some better way to get a count for *each* of the ModelID that exist in any given time *all at once* in some kind of loop or xxx???... I just don't know how do that... (newbie alert) - I would appreciate any ideas or URL links etc. - please keep is simple for this newbie -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Development methods (was: use strict or similar in PHP?)
-Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Friday, February 27, 2009 9:56 AM To: PHP General list Subject: [PHP] Development methods (was: use strict or similar in PHP?) From: Boyd, Todd M. Well, take care of all of your logic before you display anything. It's not that difficult, to be honest... especially if you're already using an MVC design pattern/framework or a template system. That's an interesting string of buzzwords, but it carries no meaning for me. Would you care to elucidate further? As far as the code I am working with, I inherited over 160 files of mixed HTML and PHP, where the logic and presentation are intermingled (mangled) throughout. My initial toolset was TextPad4, WinSCP and Putty on a WinXP workstation, with Apache on RHEL 5 as the server. (The original coder used vi on a clone of the server until they took it away from him.) The chances of re-implementing the entire project are roughly equivalent to a zero with the edges rubbed out. I already have a six month to-do list just adding the new features already requested by current clients. * MVC = Model-View-Controller [1] * Template = Basically just the display (View) with variables injected [2] * Output Buffer = Output isn't sent to the browser until you deem it so [3] As far as inheriting more than 160 files with logic and presentation intermingled... I think you're pretty much SOL with regard to converting it to a framework or a new design pattern. It's possible, but that's going to be quite a bit of work. Links: 1. http://en.wikipedia.org/wiki/Model-View-Controller 2. http://www.smarty.net/ (just an example of one templating system) 3. http://www.php.net/ob_start HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: use strict or similar in PHP?
On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
Bob McConnell wrote: From what I have seen of PHP, it is strictly interpreted. i.e. a line is read, and executed. Then the next line is read, and executed. etc. So there is no way to get it to block execution from the beginning even when there are fatal errors. It will already have printed out as much of the page as it executed before it finds those errors. This works fine in a development or test environment, but is a serious problem in production. You can use something like DOMDocument where you store the intended user output in an object until you are actually ready to do something with it (IE send it to the client as a complete documet). If all error reporting is turned off (like it should be on a production machine) nothing is sent to output until the output is fully constructed. Is that what you are after? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser timeout
Hello, I am running a script that process the user's request, which usually takes about 40 seconds. The problem is that on Internet Explorer 6, it timeouts - probably because no response was sent. How do I solve this problem? Since I tried some things and header() messages, nothing worked. Run the script in the background, and give the user a page that self-refreshes every 10 seconds. Or, better yet, use AJAX. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я ä-ö-ü-ß-Ä-Ö-Ü
[PHP] make libphp5.so
I am running into problems compiling a shared module on BSD/OS 4.3.1 . My configuration is configure \ --prefix=/usr/contrib \ --localstatedir=/var \ --infodir=/usr/share/info \ --disable-static \ --enable-shared \ --enable-embed=shared \ --mandir=/usr/share/man \ --with-elf \ --with-x \ --with-mysql=/usr/contrib \ --with-zlib \ --enable-track-vars \ --enable-versioning \ --with-config-file-path=/usr/contrib/lib \ --with-gd \ --enable-ftp \ --with-openssl=/usr/contrib \ --with-jpeg-dir=/usr \ --with-pgsql=/usr/contrib/pgsql \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-mcrypt=/usr/contrib \ --with-mhash=/usr/contrib \ --with-xpm-dir=/usr/X11R6 \ --with-libxml-dir=/usr/contrib \ --with-freetype-dir=/usr \ --with-tsrm-pthreads \ --enable-mbstring \ --with-zend-vm=CALL \ --enable-maintainer-zts \ --enable-zend-multibyte \ --enable-imap \ --with-bz2 \ --with-apxs2=/usr/contrib/bin/apxs \ --enable-fastcgi \ --enable-force-cgi-redirect \ --enable-debug I want to surpress static maode and fully concentrate only in the so. any pointers? Also running Apaceh 2.0.63. -- Member - Liberal International This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising! Never Satan President Republic! Christian(n): A Jew that believe Christ is Messiah and Saviour and alive -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: use strict or similar in PHP?
On Fri, 2009-02-27 at 09:28 -0700, LuKreme wrote: On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. I add the following to the top of my PHP shell scripts: #!/usr/bin/php -qC Then I do the following: chmod 775 script.php Then I run it as follows: ./script.php Look... and executable binary :) Don't say it's not binary. All data on a hard disk is binary (although I do know what you mean ;) 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: use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 11:46 PM, Robert Cummings rob...@interjinn.comwrote: On Fri, 2009-02-27 at 09:28 -0700, LuKreme wrote: On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. I add the following to the top of my PHP shell scripts: #!/usr/bin/php -qC Then I do the following: chmod 775 script.php Then I run it as follows: ./script.php Look... and executable binary :) Don't say it's not binary. All data on a hard disk is binary (although I do know what you mean ;) Well you are running shell script style execution its not example of Compiled code or Binary The data in the file is ASCII or UTF text :) Compilation happens when its zendOptimized or OpCoded. Its then is converted into binary content file. 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] compiling php with libjpg64
Hi there, I am trying to get a 64 bit suse 10.3 system to run with php 5. Somehow it does not recognize the libjpg which is definatelly in place: server:/home/sw/php-5.2.9 # './configure' '--enable-fastcgi' '--with-mysql=/usr/local/mysql' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' '--enable-soap' '--with-zlib-dir=/usr/lib64' '--with-freetype-dir=/usr/lib64' '--with-gd' '--with-jpeg-dir=/usr/lib64' '--with-png-dir=/usr/lib64' '--enable-exif' '--with-pdflib=/usr/local' configure.txt configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none). configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4 (found: 2.5.33) configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. configure: error: libjpeg.(a|so) not found. but: # locate libjpeg.so /usr/lib64/libjpeg.so /usr/lib64/libjpeg.so.62 /usr/lib64/libjpeg.so.62.0.0 # locate libjpeg.a /usr/lib64/libjpeg.a I am kind of lost with this one. I can not find the error. Has somebody an idea how to fix this? Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting An Inventory Product Count
On Fri, Feb 27, 2009 at 11:17 AM, revDAVE c...@hosting4days.com wrote: Newbie question Hi folks, Currently, I have an inventory table that stores individual records for each single item in inventory - ( each item is on its own line because it has serial numbers associated with it) like: fields: Item - ModelID - sn item1 - 1 - sn xxx item1 - 1 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item3 - 2 - sn xxx Goal: I would like to give a report page with total counts for current in inventory like: COUNTS... item1 = 2 item2 = 3 item3 = 1 so I created a fool around query that gets a count for just ModelID = 1 $query_count_model1 = SELECT count(inventory_id) as thecount FROM inventory WHERE ModelID = 1; BUT: - the I'm sure there is some better way to get a count for *each* of the ModelID that exist in any given time *all at once* in some kind of loop or xxx???... I just don't know how do that... (newbie alert) - I would appreciate any ideas or URL links etc. - please keep is simple for this newbie -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php select modelId, count(*) as total from table group by modelId -- Bastien Cat, the other other white meat
[PHP] Re: compiling php with libjpg64
Merlin Morgenstern wrote: Hi there, I am trying to get a 64 bit suse 10.3 system to run with php 5. Somehow it does not recognize the libjpg which is definatelly in place: server:/home/sw/php-5.2.9 # './configure' '--enable-fastcgi' '--with-mysql=/usr/local/mysql' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' '--enable-soap' '--with-zlib-dir=/usr/lib64' '--with-freetype-dir=/usr/lib64' '--with-gd' '--with-jpeg-dir=/usr/lib64' '--with-png-dir=/usr/lib64' '--enable-exif' '--with-pdflib=/usr/local' configure.txt configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none). configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4 (found: 2.5.33) configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. configure: error: libjpeg.(a|so) not found. but: # locate libjpeg.so /usr/lib64/libjpeg.so /usr/lib64/libjpeg.so.62 /usr/lib64/libjpeg.so.62.0.0 # locate libjpeg.a /usr/lib64/libjpeg.a I am kind of lost with this one. I can not find the error. Has somebody an idea how to fix this? Thank you for any help, Merlin Might try adding: --with-libdir=lib64 -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How important is your Express or Web Edition database? Please weigh in--
Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web-app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d -- Stan Stadelman (925) 336-6473 s...@berkeley.edu
RE: [PHP] How important is your Express or Web Edition database? Please weigh in--
From: sstadel...@gmail.com Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Put it on a site that doesn't require blindly enabling JavaScript and I might be able to help. On the other hand, I had never heard of that product, so we're probably not using it. We do currently support Sybase ASA, Oracle, PosgreSQL and SQL Server. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How important is your Express or Web Edition database? Please weigh in--
On Fri, Feb 27, 2009 at 2:04 PM, Bob McConnell r...@cbord.com wrote: From: sstadel...@gmail.com Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Put it on a site that doesn't require blindly enabling JavaScript and I might be able to help. On the other hand, I had never heard of that product, so we're probably not using it. We do currently support Sybase ASA, Oracle, PosgreSQL and SQL Server. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php MySQL, DB2, SQL Server -- Bastien Cat, the other other white meat
Re: [PHP] Re: use strict or similar in PHP?
On Sat, 2009-02-28 at 00:02 +0600, 9el wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 11:46 PM, Robert Cummings rob...@interjinn.comwrote: On Fri, 2009-02-27 at 09:28 -0700, LuKreme wrote: On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. I add the following to the top of my PHP shell scripts: #!/usr/bin/php -qC Then I do the following: chmod 775 script.php Then I run it as follows: ./script.php Look... and executable binary :) Don't say it's not binary. All data on a hard disk is binary (although I do know what you mean ;) Well you are running shell script style execution its not example of Compiled code or Binary The data in the file is ASCII or UTF text :) Which are subsets of binary representation ;) Compilation happens when its zendOptimized or OpCoded. Its then is converted into binary content file. But one could probably quite easily set up a system whereby eAccelerator or APC or Zend Optimizer cache bytecodes are torn from a file run similarly. As I said in an earlier post... the line between the definition of interpreted language and compiled language is quite blurry these days. 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] Development methods (was: use strict or similar in PHP?)
Also in place of Vi you should be looking for an IDE like Netbeans PDT which is one of the best for coding in PHP you can forget using TextPad for this. And to let your codes versioned use SVN=Subversion Using a framework lets you apply and abide by some conventions and lets you DRY=Dont Repeat Yourself .. which is very helpful for a large project. --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 10:27 PM, Boyd, Todd M. tmbo...@ccis.edu wrote: -Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Friday, February 27, 2009 9:56 AM To: PHP General list Subject: [PHP] Development methods (was: use strict or similar in PHP?) From: Boyd, Todd M. Well, take care of all of your logic before you display anything. It's not that difficult, to be honest... especially if you're already using an MVC design pattern/framework or a template system. That's an interesting string of buzzwords, but it carries no meaning for me. Would you care to elucidate further? As far as the code I am working with, I inherited over 160 files of mixed HTML and PHP, where the logic and presentation are intermingled (mangled) throughout. My initial toolset was TextPad4, WinSCP and Putty on a WinXP workstation, with Apache on RHEL 5 as the server. (The original coder used vi on a clone of the server until they took it away from him.) The chances of re-implementing the entire project are roughly equivalent to a zero with the edges rubbed out. I already have a six month to-do list just adding the new features already requested by current clients. * MVC = Model-View-Controller [1] * Template = Basically just the display (View) with variables injected [2] * Output Buffer = Output isn't sent to the browser until you deem it so [3] As far as inheriting more than 160 files with logic and presentation intermingled... I think you're pretty much SOL with regard to converting it to a framework or a new design pattern. It's possible, but that's going to be quite a bit of work. Links: 1. http://en.wikipedia.org/wiki/Model-View-Controller 2. http://www.smarty.net/ (just an example of one templating system) 3. http://www.php.net/ob_start HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How important is your Express or Web Edition database? Please weigh in--
Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web-app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie nos...@mckenzies.netwrote: Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web-app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Just another marketing tool to sell a limited toolset db to punters who like marketing hype -- Bastien Cat, the other other white meat
Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
On Fri, Feb 27, 2009 at 4:21 PM, Bastien Koert phps...@gmail.com wrote: On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie nos...@mckenzies.netwrote: Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web-app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com Just another marketing tool to sell a limited toolset db to punters who like marketing hype -- Bastien I thought they were free. Limited, but free. (reduced functionality or limited number of connections compared to the commercial versions of the products) I've not heard of Web Edition, but I have heard of both SQL Server and Oracle Express. I haven't used them, but I guess the idea I have in mind is of products that are supposed to be just good enough to use in either embedded apps or else to entice developers into wanting the full version for server apps. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get a list of column field names from a MS Access table
On Thu, Feb 26, 2009 at 4:01 PM, revDAVE c...@hosting4days.com wrote: Newbie question: I would like to get a list of column field names from a MS Access table and hopefully get them returned in the ORIGINAL order (as they appear in access) Is there a sql query I could do to get this result? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A dirty way is to query the table where 1=2 to return no results select * from table where 1=2 -- Bastien Cat, the other other white meat
Re: [PHP] Re: use strict or similar in PHP?
Robert Cummings wrote: ... the line between the definition of interpreted language and compiled language is quite blurry these days. #includestdio.h main() { printf(Hello World); } Compile that - and you can run it on any system that is binary compatible, whether or not is has a C compiler. However, it will not run on systems that are not binary compatible, even if they have a C compiler. ?php print (Hello World); ? That will only run on systems with a php interpreter, even if you compile it into byte-code. However, unlike the c example, it will run on any system with a php interpreter. Nothing fuzzy about it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
-Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: Friday, February 27, 2009 3:26 PM To: Bastien Koert Cc: Shawn McKenzie; php-general@lists.php.net Subject: Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in-- On Fri, Feb 27, 2009 at 4:21 PM, Bastien Koert phps...@gmail.com wrote: On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie nos...@mckenzies.netwrote: Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web- app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com Just another marketing tool to sell a limited toolset db to punters who like marketing hype -- Bastien I thought they were free. Limited, but free. (reduced functionality or limited number of connections compared to the commercial versions of the products) I've not heard of Web Edition, but I have heard of both SQL Server and Oracle Express. I haven't used them, but I guess the idea I have in mind is of products that are supposed to be just good enough to use in either embedded apps or else to entice developers into wanting the full version for server apps. I use SQLExpress (SQL Server Express) all the time at work for prototyping and such... although, I have to say--if my company hadn't installed it on my machine to begin with, and they weren't running SQL Server 2005 on the production servers, I would rather just use a private MySQL installation for prototyping and then push to a MySQL production server. Alas... // Todd
Re: [PHP] Re: use strict or similar in PHP?
On Fri, 2009-02-27 at 14:32 -0800, Michael A. Peters wrote: Robert Cummings wrote: ... the line between the definition of interpreted language and compiled language is quite blurry these days. #includestdio.h main() { printf(Hello World); } Compile that - and you can run it on any system that is binary compatible, whether or not is has a C compiler. However, it will not run on systems that are not binary compatible, even if they have a C compiler. ?php print (Hello World); ? That will only run on systems with a php interpreter, even if you compile it into byte-code. However, unlike the c example, it will run on any system with a php interpreter. Nothing fuzzy about it. This is not the litmus test for compiled versus interpreted languages. http://en.wikipedia.org/wiki/Compiled_language 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: use strict or similar in PHP?
On Friday 27 February 2009 10:56, Hans Schultz wrote: Regarding databases I was hopping for some abstraction layer like dbx only better (to allow parameters). I encourage you to use a database abstraction layer that gives you this and many other features you may be used to from JDBC MDB2 and PDO are the most current and popular http://pear.php.net/manual/en/package.database.mdb2.intro-execute.php http://us.php.net/manual/en/pdo.prepared-statements.php enjoy, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How do I remove an array element from within a recursive function? [solved]
OMG! How retarded am I. Duh. of course... For some reason I thought you could use the reference because it was a pointer to the actual object menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password')); public static final function removeMenuItems($menuItems, $removeArray) { foreach($menuItems as $key = $value) if (is_array($value-children)) menuItem::removeMenuItems($value-children, $removeArray); elseif (in_array($value-menu, $removeArray)) unset($menuItems[$key]); } -Original Message- From: Chris dmag...@gmail.com To: Daevid Vincent dae...@daevid.com Cc: php-general@lists.php.net, Shawn McKenzie nos...@mckenzies.net Subject: Re: [PHP] Re: How do I remove an array element from within a recursive function? Date: Fri, 27 Feb 2009 13:47:38 +1100 Daevid Vincent wrote: I tried that and it still doesn't work. I even tried this hardcore test: public static final function removeMenuItems($menuItems, $removeArray) { foreach($menuItems as $value) { unset($value); } } You don't unset the value, you unset the key. ?php $items = array('menu1', 'menu2', 'menu3'); echo Before:\n; print_r($items); foreach ($items as $_menuKey = $value) { if ($value == 'menu2') { unset($items[$_menuKey]); } } echo After:\n; print_r($items); $ php test.php Before: Array ( [0] = menu1 [1] = menu2 [2] = menu3 ) After: Array ( [0] = menu1 [2] = menu3 )
[PHP] Best error handling
Hi. I have a kind of webserver that certain applications communicate with. The problem is that the script (named peer.php) must output data as xml. Thats ok (thanks to XMLWriter). The problem is that when some error occurs (those note catchable by set_error_handler) I have no control on data being outputed. I would like to output xml even on fatal errors (in that case, telling that something gone wrong). I tried using register_shutdown_function but it is crashing (as the nature of fatal errors that make the envirionment unstable). Any idea? Thanks! -- Davi R. Tavares
Re: [PHP] Re: use strict or similar in PHP?
On Fri, 2009-02-27 at 14:32 -0500, Robert Cummings wrote: On Sat, 2009-02-28 at 00:02 +0600, 9el wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 11:46 PM, Robert Cummings rob...@interjinn.comwrote: On Fri, 2009-02-27 at 09:28 -0700, LuKreme wrote: On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. I add the following to the top of my PHP shell scripts: #!/usr/bin/php -qC Then I do the following: chmod 775 script.php Then I run it as follows: ./script.php Look... and executable binary :) Don't say it's not binary. All data on a hard disk is binary (although I do know what you mean ;) Well you are running shell script style execution its not example of Compiled code or Binary The data in the file is ASCII or UTF text :) Which are subsets of binary representation ;) Compilation happens when its zendOptimized or OpCoded. Its then is converted into binary content file. But one could probably quite easily set up a system whereby eAccelerator or APC or Zend Optimizer cache bytecodes are torn from a file run similarly. As I said in an earlier post... the line between the definition of interpreted language and compiled language is quite blurry these days. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ASCII is only a subset of binary in a pedantic, literal sense. When people say binary file, they mean one that contains characters which are outside the normal display spectrum, such as chr(0), etc. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser timeout
On Fri, 2009-02-27 at 16:33 +0200, דניאל דנון wrote: Hello, I am running a script that process the user's request, which usually takes about 40 seconds. The problem is that on Internet Explorer 6, it timeouts - probably because no response was sent. How do I solve this problem? Since I tried some things and header() messages, nothing worked. You could try looking at the flush() function (http://uk3.php.net/flush) to force some output to be sent to the browser before the entire script has been executed. It's most likely that your script is taking a long time to process, and so IE is falling over as it's not hearing back from the server. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting An Inventory Product Count
On Fri, 2009-02-27 at 13:21 -0500, Bastien Koert wrote: On Fri, Feb 27, 2009 at 11:17 AM, revDAVE c...@hosting4days.com wrote: Newbie question Hi folks, Currently, I have an inventory table that stores individual records for each single item in inventory - ( each item is on its own line because it has serial numbers associated with it) like: fields: Item - ModelID - sn item1 - 1 - sn xxx item1 - 1 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item2 - 2 - sn xxx item3 - 2 - sn xxx Goal: I would like to give a report page with total counts for current in inventory like: COUNTS... item1 = 2 item2 = 3 item3 = 1 so I created a fool around query that gets a count for just ModelID = 1 $query_count_model1 = SELECT count(inventory_id) as thecount FROM inventory WHERE ModelID = 1; BUT: - the I'm sure there is some better way to get a count for *each* of the ModelID that exist in any given time *all at once* in some kind of loop or xxx???... I just don't know how do that... (newbie alert) - I would appreciate any ideas or URL links etc. - please keep is simple for this newbie -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php select modelId, count(*) as total from table group by modelId Don't do a count(*) if you can avoid it, as it's a lot slower than doing a count on an individual field. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: compiling php with libjpg64
On Fri, 2009-02-27 at 12:43 -0600, Shawn McKenzie wrote: Merlin Morgenstern wrote: Hi there, I am trying to get a 64 bit suse 10.3 system to run with php 5. Somehow it does not recognize the libjpg which is definatelly in place: server:/home/sw/php-5.2.9 # './configure' '--enable-fastcgi' '--with-mysql=/usr/local/mysql' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' '--enable-soap' '--with-zlib-dir=/usr/lib64' '--with-freetype-dir=/usr/lib64' '--with-gd' '--with-jpeg-dir=/usr/lib64' '--with-png-dir=/usr/lib64' '--enable-exif' '--with-pdflib=/usr/local' configure.txt configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none). configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4 (found: 2.5.33) configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. configure: error: libjpeg.(a|so) not found. but: # locate libjpeg.so /usr/lib64/libjpeg.so /usr/lib64/libjpeg.so.62 /usr/lib64/libjpeg.so.62.0.0 # locate libjpeg.a /usr/lib64/libjpeg.a I am kind of lost with this one. I can not find the error. Has somebody an idea how to fix this? Thank you for any help, Merlin Might try adding: --with-libdir=lib64 -- Thanks! -Shawn http://www.spidean.com I've got Suse10.3 on my laptop, all 64-bit, and running the correct graphics libraries which I use for GD. I used Yast to install the whole thing, as it sorts out everything for me. For Suse, I'd recommend it, as it really is a great admin tool, albeit a little slow when building repository lists when you install things! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
On Fri, 2009-02-27 at 16:41 -0600, Boyd, Todd M. wrote: -Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: Friday, February 27, 2009 3:26 PM To: Bastien Koert Cc: Shawn McKenzie; php-general@lists.php.net Subject: Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in-- On Fri, Feb 27, 2009 at 4:21 PM, Bastien Koert phps...@gmail.com wrote: On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie nos...@mckenzies.netwrote: Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web- app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com Just another marketing tool to sell a limited toolset db to punters who like marketing hype -- Bastien I thought they were free. Limited, but free. (reduced functionality or limited number of connections compared to the commercial versions of the products) I've not heard of Web Edition, but I have heard of both SQL Server and Oracle Express. I haven't used them, but I guess the idea I have in mind is of products that are supposed to be just good enough to use in either embedded apps or else to entice developers into wanting the full version for server apps. I use SQLExpress (SQL Server Express) all the time at work for prototyping and such... although, I have to say--if my company hadn't installed it on my machine to begin with, and they weren't running SQL Server 2005 on the production servers, I would rather just use a private MySQL installation for prototyping and then push to a MySQL production server. Alas... // Todd For me it's MySQL all the way. My company is too cheap to pay for later versions of MS SQL Server, so the versions we have there are *very* limited in features (for example, no limit function!) MySQL also seems a lot faster for me too. I regularly deal with large databases (think millions of records) and MSSQL is a real bottleneck here, whereas MySQL seems fine (althogh, it is running on Linux, which frees up more resources for actually getting stuff done!) Oh, funny thing. I filled in the questionnaire above, and when it got to the final 'thanks' page, I clicked the button, and it bombed out to a completely blank page. Doesn't bode too well for a company attempting to sell a product for use in enterprise situations! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get a list of column field names from a MS Access table
On Fri, 2009-02-27 at 16:58 -0500, Bastien Koert wrote: On Thu, Feb 26, 2009 at 4:01 PM, revDAVE c...@hosting4days.com wrote: Newbie question: I would like to get a list of column field names from a MS Access table and hopefully get them returned in the ORIGINAL order (as they appear in access) Is there a sql query I could do to get this result? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A dirty way is to query the table where 1=2 to return no results select * from table where 1=2 That'll just return an empty result set, as in empty and with no fields output! In MySQL you can do this: SELECT column_name FROM information_schema.columns WHERE table_name = 'table_name' this might help with doing the same for M$Access? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
Not sure he's from a company. His email address is in the berkeley.edudomain. I guess there's a chance he's involved in Berkeley DB, although I believe this is now owned by Oracle? I'd be curious to know if any Berkeley people are still involved in the development of the engine. M is for Murray http://www.voodoologic.org On Sat, Feb 28, 2009 at 10:32 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Oh, funny thing. I filled in the questionnaire above, and when it got to the final 'thanks' page, I clicked the button, and it bombed out to a completely blank page. Doesn't bode too well for a company attempting to sell a product for use in enterprise situations!
Re: [PHP] Browser timeout
On Sat, 2009-02-28 at 02:42 +0200, דניאל דנון wrote: The problem is - What to send? Since I'm using a template-class, I did not include an option to send only the header(html, head), is there any way other then sending the template's HTML to solve this problem? On Sat, Feb 28, 2009 at 2:15 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2009-02-27 at 16:33 +0200, דניאל דנון wrote: Hello, I am running a script that process the user's request, which usually takes about 40 seconds. The problem is that on Internet Explorer 6, it timeouts - probably because no response was sent. How do I solve this problem? Since I tried some things and header() messages, nothing worked. You could try looking at the flush() function (http://uk3.php.net/flush) to force some output to be sent to the browser before the entire script has been executed. It's most likely that your script is taking a long time to process, and so IE is falling over as it's not hearing back from the server. Ash www.ashleysheridan.co.uk Depends what templating class you're using, it might be a built in feature? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best error handling
Davi Ramos wrote: Hi. I have a kind of webserver that certain applications communicate with. The problem is that the script (named peer.php) must output data as xml. Thats ok (thanks to XMLWriter). The problem is that when some error occurs (those note catchable by set_error_handler) I have no control on data being outputed. I would like to output xml even on fatal errors (in that case, telling that something gone wrong). I tried using register_shutdown_function but it is crashing (as the nature of fatal errors that make the envirionment unstable). Any idea? Thanks! not a nice answer but make sure you're application has no fatal errors - a fatal error halts the compiler as it's fatal, thus there is no way to implement anything else afterwards or turn it in to an exception or suchlike. further, for live servers you really should have display errors set to off in you're php.ini - at which point nothing will be returned try: (not tested or particularly thought about) 1: move all the code from peer.php in to an include file 2: make you're main peer.php file contain only ?php try { require_once 'include_file.php'; } catch($e) { echo 'some xml error'; } ? can't promise that'll work though, to test quickly just add all that to a php file and run it (as you don't have the required file so a fatal will get raised) regards and good luck - nathan ps: may check this one out myself, sure I've done it years ago when i still made sites -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
Murray wrote: Not sure he's from a company. His email address is in the berkeley.edudomain. I guess there's a chance he's involved in Berkeley DB, although I believe this is now owned by Oracle? I'd be curious to know if any Berkeley people are still involved in the development of the engine. M is for Murray http://www.voodoologic.org On Sat, Feb 28, 2009 at 10:32 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: Oh, funny thing. I filled in the questionnaire above, and when it got to the final 'thanks' page, I clicked the button, and it bombed out to a completely blank page. Doesn't bode too well for a company attempting to sell a product for use in enterprise situations! I didn't bother with the questionnaire. I personally prefer to use completely open source solutions whenever possible, it reduces deployment licensing costs and gives you options when the company producing the product decides to take the product in a direction you don't want to go. I suspect therefore that I am not the target audience for the questionnaire. I think it has been some time since Berkeley has been involved with BerkeleyDB - Sleepycat Software was located in Berkeley but was not Berkeley. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best error handling
No luck with your solution... I think that the only way is (as you said) to make sure that there will be no fatal errors :) I'll will implement the error handler as well (to catch some minor errors) and uncaught exceptions. The method for catch all errors using a shutdown function appears to work, but it crashes when using my php stream mock implementation (that I use to simulate calls to the script). Thanks anyway Nathan! PS. Is there some plan to make PHP full exception-ready, dropping the usual way of return values? Davi On Fri, Feb 27, 2009 at 9:51 PM, Nathan Rixham nrix...@gmail.com wrote: Davi Ramos wrote: Hi. I have a kind of webserver that certain applications communicate with. The problem is that the script (named peer.php) must output data as xml. Thats ok (thanks to XMLWriter). The problem is that when some error occurs (those note catchable by set_error_handler) I have no control on data being outputed. I would like to output xml even on fatal errors (in that case, telling that something gone wrong). I tried using register_shutdown_function but it is crashing (as the nature of fatal errors that make the envirionment unstable). Any idea? Thanks! not a nice answer but make sure you're application has no fatal errors - a fatal error halts the compiler as it's fatal, thus there is no way to implement anything else afterwards or turn it in to an exception or suchlike. further, for live servers you really should have display errors set to off in you're php.ini - at which point nothing will be returned try: (not tested or particularly thought about) 1: move all the code from peer.php in to an include file 2: make you're main peer.php file contain only ?php try { require_once 'include_file.php'; } catch($e) { echo 'some xml error'; } ? can't promise that'll work though, to test quickly just add all that to a php file and run it (as you don't have the required file so a fatal will get raised) regards and good luck - nathan ps: may check this one out myself, sure I've done it years ago when i still made sites -- Davi R. Tavares
[PHP] Help with a potential bug
Can someone help me find the smallest block of code that is making Apache SEGV? Actually the code is about 30 lines and actually depends with Doctrine (which I think it is not causing the crash as well, but it is combined with something else). I also make use of user defined stream wrappers. These combined cause PHP crash Apache when it is freeing resources (the last called function was stream_close, when I removed that method from my user-defined stream, it doesn't crashes anymore). The code makes use of register_shutdown_function to try to detect an E_ERROR (or other fatal error) and them output gracefully to the user. Removing Doctrine (that is actually just initialized) or my user-defined stream, there is no crash. PHP 5.2.6 (also tested with PHP 5.2.8) Apache 2.2 I am beginner on finding bugs on PHP, this one is really boring me because it makes an important part of my software not work. I have the backtrace and a ready to debug environment (PHP 5.2.6 and Apache 2.2) with GDB. -- Davi R. Tavares
Re: [PHP] Re: Best error handling
Nathan Rixham wrote: further, for live servers you really should have display errors set to off in you're php.ini - at which point nothing will be returned but they are still in the server logs - so they are still viewable if you need to see what errors occur (just mentioning it because some don't know this) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting PHP code to C#?
I go the same problem as well, how could I hardcode the iv and key, if iv=abc and key=123 in C#, what are the iv and key in PHP? Symbian wrote: mike-22 wrote: i'm pretty sure the IV mattered in our stuff. and remember i used CBC i think not EBC, and it worked fine. not sure if you want to try that and make it work for you or not without any warnings :) Ah! We're using EBC, also I realised that I needed to implement the eqivalent of the pack function in PHP which we use, so I finally have the correct (MD5'd both the PHP and C# bits) string going *into* the function. Now I have to wrestle with the Rijndael class again:( Rijndael r = Rijndael.Create(); r.Mode = CipherMode.ECB; r.Padding = PaddingMode.None; r.Key = Encoding.ASCII.GetBytes(KEY); ICryptoTransform de = r.CreateDecryptor(); byte[] output = CryptoTransform(input, de); Sym -- View this message in context: http://www.nabble.com/Converting-PHP-code-to-C---tp12541304p22258550.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get a list of column field names from a MS Access table
On Fri, Feb 27, 2009 at 4:58 PM, Bastien Koert phps...@gmail.com wrote: On Thu, Feb 26, 2009 at 4:01 PM, revDAVE c...@hosting4days.com wrote: Newbie question: I would like to get a list of column field names from a MS Access table and hopefully get them returned in the ORIGINAL order (as they appear in access) Is there a sql query I could do to get this result? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A dirty way is to query the table where 1=2 to return no results select * from table where 1=2 -- Bastien Cat, the other other white meat I thought (and almost replied) the same, but the more I think about it, I'm not sure it would work. The query would return no results, so there wouldn't even be an array of empty values. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get a list of column field names from a MS Access table
On Fri, Feb 27, 2009 at 7:41 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2009-02-27 at 16:58 -0500, Bastien Koert wrote: On Thu, Feb 26, 2009 at 4:01 PM, revDAVE c...@hosting4days.com wrote: Newbie question: I would like to get a list of column field names from a MS Access table and hopefully get them returned in the ORIGINAL order (as they appear in access) Is there a sql query I could do to get this result? -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A dirty way is to query the table where 1=2 to return no results select * from table where 1=2 That'll just return an empty result set, as in empty and with no fields output! In MySQL you can do this: SELECT column_name FROM information_schema.columns WHERE table_name = 'table_name' this might help with doing the same for M$Access? Ash www.ashleysheridan.co.uk I haven't ever seen information_schema in M$ Access. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: compiling php with libjpg64
Ashley Sheridan wrote: On Fri, 2009-02-27 at 12:43 -0600, Shawn McKenzie wrote: Merlin Morgenstern wrote: Hi there, I am trying to get a 64 bit suse 10.3 system to run with php 5. Somehow it does not recognize the libjpg which is definatelly in place: server:/home/sw/php-5.2.9 # './configure' '--enable-fastcgi' '--with-mysql=/usr/local/mysql' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-mbstring' '--with-pdo-mysql=/usr/local/mysql/' '--enable-soap' '--with-zlib-dir=/usr/lib64' '--with-freetype-dir=/usr/lib64' '--with-gd' '--with-jpeg-dir=/usr/lib64' '--with-png-dir=/usr/lib64' '--enable-exif' '--with-pdflib=/usr/local' configure.txt configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none). configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4 (found: 2.5.33) configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. configure: error: libjpeg.(a|so) not found. but: # locate libjpeg.so /usr/lib64/libjpeg.so /usr/lib64/libjpeg.so.62 /usr/lib64/libjpeg.so.62.0.0 # locate libjpeg.a /usr/lib64/libjpeg.a I am kind of lost with this one. I can not find the error. Has somebody an idea how to fix this? Thank you for any help, Merlin Might try adding: --with-libdir=lib64 -- Thanks! -Shawn http://www.spidean.com I've got Suse10.3 on my laptop, all 64-bit, and running the correct graphics libraries which I use for GD. I used Yast to install the whole thing, as it sorts out everything for me. For Suse, I'd recommend it, as it really is a great admin tool, albeit a little slow when building repository lists when you install things! Ash www.ashleysheridan.co.uk Yes, I always use a package from whatever distro (ubuntu for my desktop for several years and fedora on my web host). I've never needed to compile apache/php/mysql or most anything else. Sometimes there's something that I want that you can only get from source, but normally that builds easily for me. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in--
On Fri, Feb 27, 2009 at 7:32 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Fri, 2009-02-27 at 16:41 -0600, Boyd, Todd M. wrote: -Original Message- From: Andrew Ballard [mailto:aball...@gmail.com] Sent: Friday, February 27, 2009 3:26 PM To: Bastien Koert Cc: Shawn McKenzie; php-general@lists.php.net Subject: Re: [PHP] Re: How important is your Express or Web Edition database? Please weigh in-- On Fri, Feb 27, 2009 at 4:21 PM, Bastien Koert phps...@gmail.com wrote: On Fri, Feb 27, 2009 at 4:01 PM, Shawn McKenzie nos...@mckenzies.netwrote: Stan Stadelman wrote: Hello All: I'm trying to see how Web Edition databases are being used in your company for PHP-driven web-apps. Our strategy team thought that free and community editions would be dominant, but we interviewed Zend Framework developers using Oracle, IBM, Microsoft, MySQL, PostgreSQL, and it looks like--surprise--that each vendors' market share is about the same as in the broad commercial market. We think this means that you--the PHP developer community--aren't actually using the lightweight Web/Express Edition for your corporate web- app deployment, and instead are building out on the licenses for databases your company is already running. Is the Express/Community/Web Edition important for you at work? Is it a critical sandboxing step for you? Do you run it live for internal applications? Answering these 10 multiple choice questions--should take about 90 seconds--will help us understand what databases you need in your professional life, and how to deliver them to you. Happy cooking, and thanks! http://www.surveymonkey.com/s.aspx?sm=Jro0rkoIGJKuQNpfWZV_2bBQ_3d_3d What exactly are, Express or Web Edition databases? -- Thanks! -Shawn http://www.spidean.com Just another marketing tool to sell a limited toolset db to punters who like marketing hype -- Bastien I thought they were free. Limited, but free. (reduced functionality or limited number of connections compared to the commercial versions of the products) I've not heard of Web Edition, but I have heard of both SQL Server and Oracle Express. I haven't used them, but I guess the idea I have in mind is of products that are supposed to be just good enough to use in either embedded apps or else to entice developers into wanting the full version for server apps. I use SQLExpress (SQL Server Express) all the time at work for prototyping and such... although, I have to say--if my company hadn't installed it on my machine to begin with, and they weren't running SQL Server 2005 on the production servers, I would rather just use a private MySQL installation for prototyping and then push to a MySQL production server. Alas... // Todd For me it's MySQL all the way. My company is too cheap to pay for later versions of MS SQL Server, so the versions we have there are *very* limited in features (for example, no limit function!) MySQL also seems a lot faster for me too. I regularly deal with large databases (think millions of records) and MSSQL is a real bottleneck here, whereas MySQL seems fine (althogh, it is running on Linux, which frees up more resources for actually getting stuff done!) Oh, funny thing. I filled in the questionnaire above, and when it got to the final 'thanks' page, I clicked the button, and it bombed out to a completely blank page. Doesn't bode too well for a company attempting to sell a product for use in enterprise situations! Ash www.ashleysheridan.co.uk It all depends on what you need. I know from your previous posts that you're not very well disposed to SQL Server, but I've used it quite a bit now for the last 8 years and haven't really had any problems with performance. I'll grant that it doesn't have the LIMIT clause (Is it part of the actual ANSI SQL spec, or is it something handy that MySQL added to their product?) The newer versions offer a row number function that can be used to provide the the same functionality, but I'll admit it is not nearly as simple as being able to say LIMIT 25, 50. While I like MySQL, it has its oddities as well. I've run into situations where I had to add ORDER BY clauses to UPDATE statements (I'm not sure that's really valid SQL either) because it updated the rows sequentially and validated a unique index after each row rather than after all the rows were processed. I wish it would support CHECK constraints. And as convenient as I've found the SET and ENUM datatypes in simple databases, I'm coming to the notion that they are not a good idea in most situations. And while the availability of different engines has benefits, it can also cause issues. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php