php-general Digest 30 Jan 2010 12:20:43 -0000 Issue 6566
php-general Digest 30 Jan 2010 12:20:43 - Issue 6566 Topics (messages 301666 through 301688): Re: In need of PHP to JS collapsable array printing routine? 301666 by: TG 301672 by: Ashley Sheridan 301680 by: Jochem Maas how do I use php://memory? 301667 by: Mari Masuda 301668 by: Nathan Nobbe 301669 by: Jochem Maas 301670 by: Shawn McKenzie 301673 by: Eric Lee 301681 by: Shawn McKenzie 301682 by: Daniel P. Brown 301683 by: Mari Masuda 301684 by: Mari Masuda Re: Ideas please -- take query results --- output to image 301671 by: Ashley Sheridan Sessions across subdomains 301674 by: Ben Miller 301679 by: Jochem Maas Re: Creating an Entire .html page with PHP 301675 by: clancy_1.cybec.com.au 301676 by: Ashley Sheridan 301677 by: clancy_1.cybec.com.au Re: Pointers For Newbies, Reminders For Oldies 301678 by: clancy_1.cybec.com.au Re: Speed of sending email .. can I put them in a queue rather than wait? 301685 by: Manuel Lemos 301686 by: Per Jessen File Upload 301687 by: Ali Reza Sajedi 301688 by: Kim Madsen 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--- Take a look at the Firebug addon for Firefox and another addon called FirePHP or FireConsole (the new name coming soon). It lets you output PHP debugging data to HTTP headers that show up in your Firebug console. I believe it supports collapsable tree type output. -TG - Original Message - From: Daevid Vincent dae...@daevid.com To: php-gene...@lists.php.net Date: Fri, 29 Jan 2010 15:54:33 -0800 Subject: [PHP] In need of PHP to JS collapsable array printing routine? I'm wondering if anyone has a PHP debug-type routine that will take a PHP array and output it to the web page, but make all the dimensions of the array collapsable, ideally showing each sub-key (or index) as the name to click to expand it again. I'm dealing with some rather huge datasets in multi-dimensional hashes and printing them out with a beautified print_r() is just not cutting it anymore. I need to collapse them down to wrap my head around them. Some of them have 6 or more dimensions! I use jQuery for JS if that helps (in case your routine requires that too). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- On Fri, 2010-01-29 at 15:54 -0800, Daevid Vincent wrote: I'm wondering if anyone has a PHP debug-type routine that will take a PHP array and output it to the web page, but make all the dimensions of the array collapsable, ideally showing each sub-key (or index) as the name to click to expand it again. I'm dealing with some rather huge datasets in multi-dimensional hashes and printing them out with a beautified print_r() is just not cutting it anymore. I need to collapse them down to wrap my head around them. Some of them have 6 or more dimensions! I use jQuery for JS if that helps (in case your routine requires that too). I know it's not quite what you want, but what about copying and pasting the output from the view source to a more advanced text editor like Kate or Notepad++. They both support code-folding, and allow you to minimise blocks of code at points in the text, usually where you have opened brackets, etc. This also comes in handy when you're developing too. Thanks, Ash http://www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- Op 1/30/10 12:54 AM, Daevid Vincent schreef: I'm wondering if anyone has a PHP debug-type routine that will take a PHP array and output it to the web page, but make all the dimensions of the array collapsable, ideally showing each sub-key (or index) as the name to click to expand it again. I'm dealing with some rather huge datasets in multi-dimensional hashes and printing them out with a beautified print_r() is just not cutting it anymore. I need to collapse them down to wrap my head around them. Some of them have 6 or more dimensions! I use jQuery for JS if that helps (in case your routine requires that too). what everyone else said ... additionally check out the recent archives for posts by Rene Veerman ... his current pet project seems to be something that would be of interest you. ---End Message--- ---BeginMessage--- Hello, I have a function that uses tidy to attempt to clean up a bunch of crappy HTML that I inherited. In order to use tidy, I write the crappy HTML to a temporary file on disk, run tidy, and extract and return the clean(er) HTML. The program itself works
Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?
Hello, on 01/27/2010 12:07 AM Eric Lee said the following: Hi, all I'am doubted about installing a local mail server for just low volume mailing. May I ask all yours professional what do you think about it ? I do not use nor recommend Windows for delivering messages to many recipients, but if you are stuck with it, maybe you can use Microsoft Exchange in the same machine where PHP is running, you can drop the messages in the mail queue pickup directory to avoid waiting for the mail server to process them. -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Speed of sending email .. can I put them in a queue rather than wait?
Angus Mann wrote: The number of emails sent is very small. Each one is only sent after a user fills out a form and presses send. But there is a noticable lag of about 5 or sometimes 10 seconds after pressing send before the user sees the Mail sent page. I presume the reason for the lag is the time spent logging on and off a remote POP, then SMTP server, transferring the data etc. It would be better if this happened in the background - that is, the user could get on with doing his next task while the emails sat in a queue in the backgorund, being lined up and sent without PHP waiting for the process to finish. sendmail is your answer. /Per -- Per Jessen, Zürich (0.6°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload
Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
Ali Reza Sajedi wrote on 30/01/2010 12:27: UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? What does print phpinfo(); tell you about the upload_tmp_dir? -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.comwrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pointers For Newbies, Reminders For Oldies
On Sat, 2010-01-30 at 13:02 +1100, clanc...@cybec.com.au wrote: On Thu, 28 Jan 2010 10:02:56 -0500, rob...@interjinn.com (Robert Cummings) wrote: I don't know what you guys are doing wrong but the following should be the correct behaviour: ?php function get_memory( $init=false ) { static $base = null; if( $base === null || $init ) { $base = memory_get_usage(); } return memory_get_usage() - $base; } function simple_access( $data ) { $foo = $data[100]; echo 'Memory: '.get_memory().' (simple access)'.\n; } function foreach_value_access( $data ) { foreach( $data as $value ) { $foo = $value; break; } echo 'Memory: '.get_memory().' (foreach value access)'.\n; } function foreach_key_access( $data ) { foreach( $data as $key = $value ) { $foo = $key; $foo = $value; break; } echo 'Memory: '.get_memory().' (foreach key/value access)'.\n; } function modify_single_access( $data ) { $data[100] = str_repeat( '@', 1 ); echo 'Memory: '.get_memory().' (modify single access)'.\n; } function modify_all_access( $data ) { for( $i = 0; $i 1000; $i++ ) { $data[$i] = str_repeat( '@', 1 ); } echo 'Memory: '.get_memory().' (modify all access)'.\n; } get_memory( true ); $data = array(); for( $i = 0; $i 1000; $i++ ) { $data[$i] = str_repeat( '#', 1 ); } echo 'Memory: '.get_memory().' (data initialized)'.\n; simple_access( $data ); foreach_value_access( $data ); foreach_key_access( $data ); modify_single_access( $data ); modify_all_access( $data ); ? I get the following output (PHP 5.2.11 from command-line): Memory: 10160768 (data initialized) Memory: 10161008 (simple access) Memory: 10161104 (foreach value access) Memory: 10161240 (foreach key/value access) Memory: 10267312 (modify single access) Memory: 20321576 (modify all access) I don't double up on memory consumption until I force the write onto every element... this is expected because internally every array element is individually subject to the Copy-On-Write (COW) principle since each element is internally stored as a zval just like the array itself. Thanks for this. I was just revising a bit of code to insert some extra entries into an array. Previously I had opened a new array, copied the data up to the insertion point into it, put in the new entry, then copied the tail, then renamed the new array. After reading this, I realise the correct procedure was to copy the existing data into a temporary array, insert the new entry in the existing array, and then copy the tail from the copy back into the working data. This way only the data in the tail actually has to be copied, rather than the whole array. Erm, what about array_splice()? You can use that to insert items into an array at any point you want. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] File Upload
Thank you for your replys. In php.ini upload_tmp_dir is not set, so that the system should use its default tmp folder. It used to work properly. But, after a system update from centos5.3 to centos5.4 this malfunction is now observed. Any idea? Kind regards Ali - Original Message - From: Eric Lee To: Ali Reza Sajedi Cc: phpList list Sent: Saturday, January 30, 2010 1:21 PM Subject: Re: [PHP] File Upload On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.com wrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload
On Sat, 2010-01-30 at 14:40 +0100, Ali Reza Sajedi wrote: Thank you for your replys. In php.ini upload_tmp_dir is not set, so that the system should use its default tmp folder. It used to work properly. But, after a system update from centos5.3 to centos5.4 this malfunction is now observed. Any idea? Kind regards Ali - Original Message - From: Eric Lee To: Ali Reza Sajedi Cc: phpList list Sent: Saturday, January 30, 2010 1:21 PM Subject: Re: [PHP] File Upload On Sat, Jan 30, 2010 at 7:27 PM, Ali Reza Sajedi arsaj...@khanehjou.com wrote: Hello, When uploading a file the variable $_FILES['userfile']['tmp_name'] is not set and when debugging I get the following error although /tmp folder exists and the permissions are set to 777: $_FILES['userfile']['error'] = 6 which says UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Has anyone encountered such a problem or has a clue as to what the cause could be? It might be the upload_tmp_dir no pointing to the right dir ! What is the current of it ? Regards, Eric, Thank you. Kind regards Ali -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The upgrade just changed the setting. If you set this in your php.ini, it should work again. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: how do I use php://memory?
Daniel P. Brown wrote: (Typing from the DROID, so forgive the top-posting.) Shawn, would you take a few moments to submit this as a bug at http://bugs.php.net/? I know you well enough that, if you say the docs suck, they probably do. On Jan 29, 2010 10:47 PM, Shawn McKenzie nos...@mckenzies.net wrote: Eric Lee wrote: On Sat, Jan 30, 2010 at 9:00 AM, Shawn McKenzie nos...@mckenzies.net wrote: ... So maybe it only works with an open file/stream resource? Hard to tell with no docs. -- Thanks! -Shawn http://www.spidean.com Done. Thanks Dan. http://bugs.php.net/bug.php?id=50886 -- 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 do I use php://memory?
On Sat, Jan 30, 2010 at 12:18, Shawn McKenzie nos...@mckenzies.net wrote: Done. Thanks Dan. http://bugs.php.net/bug.php?id=50886 Thank you, sir. I thanked you on Facebook when I saw the report come in, but wanted to thank you properly here as well. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or dedicated servers? Ask me how we can fit your budget! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating an Entire .html page with PHP
On Fri, 29 Jan 2010 14:48:47 +, Ashley Sheridan wrote: On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote: you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages.. You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower. .htaccess: DirectoryIndex index.php /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating an Entire .html page with PHP
On Sat, 2010-01-30 at 19:20 +0100, Nisse Engström wrote: On Fri, 29 Jan 2010 14:48:47 +, Ashley Sheridan wrote: On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote: you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages.. You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower. .htaccess: DirectoryIndex index.php /Nisse That would only set the index for a given directory, it doesn't force Apache to run that script when something else is called. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Creating an Entire .html page with PHP
Ashley Sheridan wrote: On Sat, 2010-01-30 at 19:20 +0100, Nisse Engström wrote: On Fri, 29 Jan 2010 14:48:47 +, Ashley Sheridan wrote: On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote: you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages.. You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower. .htaccess: DirectoryIndex index.php /Nisse That would only set the index for a given directory, it doesn't force Apache to run that script when something else is called. I answered this issue yesterday with the following: AddType application/x-httpd-php .php .html .htm I think tedd also adds .css :) 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] Creating an Entire .html page with PHP
On Sat, 2010-01-30 at 13:40 -0500, Robert Cummings wrote: Ashley Sheridan wrote: On Sat, 2010-01-30 at 19:20 +0100, Nisse Engström wrote: On Fri, 29 Jan 2010 14:48:47 +, Ashley Sheridan wrote: On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote: you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages.. You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower. .htaccess: DirectoryIndex index.php /Nisse That would only set the index for a given directory, it doesn't force Apache to run that script when something else is called. I answered this issue yesterday with the following: AddType application/x-httpd-php .php .html .htm I think tedd also adds .css :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I thought that doing that introduced slowdowns where Apache was parsing html files that didn't contain PHP code though? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Creating an Entire .html page with PHP
Ashley Sheridan wrote: On Sat, 2010-01-30 at 13:40 -0500, Robert Cummings wrote: Ashley Sheridan wrote: On Sat, 2010-01-30 at 19:20 +0100, Nisse Engström wrote: On Fri, 29 Jan 2010 14:48:47 +, Ashley Sheridan wrote: On Fri, 2010-01-29 at 20:15 +0530, Raman . wrote: you can use Apache mod rewrite to create html pages having all programing saved in .php pages. I have never tried generating .html pages with this but have successfully generated .htm pages.. You still have to create .php pages, mod_rewrite just masks what the user is requesting through their browser. You can set Apache to parse .html pages as PHP, but I wouldn't recommend it, as any html pages that don't contain PHP code still have to be parsed as if they did, which is slower. .htaccess: DirectoryIndex index.php /Nisse That would only set the index for a given directory, it doesn't force Apache to run that script when something else is called. I answered this issue yesterday with the following: AddType application/x-httpd-php .php .html .htm I think tedd also adds .css :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP I thought that doing that introduced slowdowns where Apache was parsing html files that didn't contain PHP code though? It does... if your files don't have PHP. I imagine (but haven't checked) that you can set this on a virtual host basis. So then it becomes a question of utility versus wasted cycles. How many PHP sites actually bother to create .html files when there's no PHP code? 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] Good source for sample data?
At 3:08 PM -0800 1/29/10, Brian Dunning wrote: Thanks for the suggestions but I couldn't find any that suited my needs, so I made my own. Feel free to download if you can use them, I made files with up to a million unique records. Name, Company, Address, Phone, Email, etc., all are fake but are real addresses with correct area codes, zips, exchange, so will work for mapping, phone or address validation, whatever your needs are. Hope someone find it useful. http://www.briandunning.com/sample-data/ Brian: Thanks -- that was very nice of you. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eAccelerator Loader can't load code. Incorrect Zend Engine
After many tries I have this error still persisting in my server. It's a script that was coded using phpcoder and just request eAccelerator (or e Loader) to work. I, of course, install both (eAcc better) and then this error cames out. What I must do??? How can I know what Zend Engine is requesting??? Saludos Fraternales _ Atte. Alberto García Gómez M:.M:. Administrador de Redes/Webmaster IPI Carlos Marx, Matanzas. Cuba. 0145-2887(30-33) ext 124 __ Información de ESET NOD32 Antivirus, versión de la base de firmas de virus 4821 (20100130) __ ESET NOD32 Antivirus ha comprobado este mensaje. http://www.eset.com