php-general Digest 9 Mar 2011 10:18:31 -0000 Issue 7218
php-general Digest 9 Mar 2011 10:18:31 - Issue 7218 Topics (messages 311743 through 311746): Re: Overriding session length in existing session? 311743 by: Marc Guay 311744 by: Scott Baker 311745 by: Scott Baker Re: Somewhat OT - Stored Procedures 311746 by: Richard Quadling 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--- Hi Scott, I'm glad you resolved your problem. I'm curious about your method though, as it seems to be an entirely different approach to my own. How do you refer to your session data throughout the rest of the site? Do you always reference the $_COOKIE variables or do you utilise $_SESSION's at some point? Marc ---End Message--- ---BeginMessage--- On 03/08/2011 09:46 AM, Marc Guay wrote: Hi Scott, I'm glad you resolved your problem. I'm curious about your method though, as it seems to be an entirely different approach to my own. How do you refer to your session data throughout the rest of the site? Do you always reference the $_COOKIE variables or do you utilise $_SESSION's at some point? I'll summarize... Everytime I hit a page I open a session with a session time of 7 days. If the user logs in correctly it stores the user information in $_SESSION, and then the site sees their login info and lets them past the login screen. If, at the login screen, they select public terminal it sets the session cookie length to 0 and regenerates the cookie to expire on browser close. Everything after that is pulled from the $_SESSION variable. ---End Message--- ---BeginMessage--- On 03/08/2011 09:46 AM, Marc Guay wrote: Hi Scott, I'm glad you resolved your problem. I'm curious about your method though, as it seems to be an entirely different approach to my own. How do you refer to your session data throughout the rest of the site? Do you always reference the $_COOKIE variables or do you utilise $_SESSION's at some point? I'll summarize... Everytime I hit a page I open a session with a session time of 7 days. If the user logs in correctly it stores the user information in $_SESSION, and then the site sees their login info and lets them past the login screen. If, at the login screen, they select public terminal it sets the session cookie length to 0 and regenerates the cookie to expire on browser close. Everything after that is pulled from the $_SESSION variable. ---End Message--- ---BeginMessage--- On 7 March 2011 23:37, Nathan Nobbe quickshif...@gmail.com wrote: On Fri, Mar 4, 2011 at 7:29 AM, Richard Quadling rquadl...@gmail.com wrote: On 3 March 2011 18:30, Nathan Nobbe quickshif...@gmail.com wrote: Hey gang, (Yes Tedd, I like your style, when it pertains to how you address the list :)) I have a new curiosity that's arisen as a result of a new contract I'm working on, I'd like to bounce around some thoughts off the list and see what you folks think if interested. The topic at hand is stored procedures. Frankly, I've hardly ever even seen these in use, and what I'm trying to figure out are good rules of thumb as to where / when / how they are best used in application development. Also, bear in mind that personally I tend to favor OO paradigms for application development so would prefer feedback that incorporates that tendency. Initial thoughts are Bad: . Not well suited for ORM, particularly procedures which return multiple result sets consisting of columns from multiple tables . Greater potential for duplicated logic, I think this comes down to a well defined set of rules for any given application, read: convention required for success . Scripting languages are vendor specific, and likely most application developers have a limited understanding thereof Good: . Better performance . Fill in blank on convincing bullets here I've also done some reading on MSSQL vs. MySQL and found that the former offers much more features. I've also read that most databases only see roughly 40% of the feature sets being used for typical applications in the wild, and would agree from personal experience it is accurate. From my standpoint MySQL is popular because the features it offers are the features folks are really looking, one of those 80/20 things... I stumbled into this link on a google search, it's from '04 but looks to be relevant to this day http://www.codinghorror.com/blog/2004/10/who-needs-stored-procedures-anyways.html Your thoughts appreciated, -nathan Hello Nathan. I develop for and on Windows using IIS7 and MS SQL Server 7/2000/2005/2008. i love how you preface many of your responses like this. Almost exclusively
Re: [PHP] Somewhat OT - Stored Procedures
On 7 March 2011 23:37, Nathan Nobbe quickshif...@gmail.com wrote: On Fri, Mar 4, 2011 at 7:29 AM, Richard Quadling rquadl...@gmail.com wrote: On 3 March 2011 18:30, Nathan Nobbe quickshif...@gmail.com wrote: Hey gang, (Yes Tedd, I like your style, when it pertains to how you address the list :)) I have a new curiosity that's arisen as a result of a new contract I'm working on, I'd like to bounce around some thoughts off the list and see what you folks think if interested. The topic at hand is stored procedures. Frankly, I've hardly ever even seen these in use, and what I'm trying to figure out are good rules of thumb as to where / when / how they are best used in application development. Also, bear in mind that personally I tend to favor OO paradigms for application development so would prefer feedback that incorporates that tendency. Initial thoughts are Bad: . Not well suited for ORM, particularly procedures which return multiple result sets consisting of columns from multiple tables . Greater potential for duplicated logic, I think this comes down to a well defined set of rules for any given application, read: convention required for success . Scripting languages are vendor specific, and likely most application developers have a limited understanding thereof Good: . Better performance . Fill in blank on convincing bullets here I've also done some reading on MSSQL vs. MySQL and found that the former offers much more features. I've also read that most databases only see roughly 40% of the feature sets being used for typical applications in the wild, and would agree from personal experience it is accurate. From my standpoint MySQL is popular because the features it offers are the features folks are really looking, one of those 80/20 things... I stumbled into this link on a google search, it's from '04 but looks to be relevant to this day http://www.codinghorror.com/blog/2004/10/who-needs-stored-procedures-anyways.html Your thoughts appreciated, -nathan Hello Nathan. I develop for and on Windows using IIS7 and MS SQL Server 7/2000/2005/2008. i love how you preface many of your responses like this. Almost exclusively I use prepared statements to talk to stored procedures and views. I use triggers and constraints to enforce RDI. I _do_ have the occasional hacky script which includes SQL, but only 'cause I was being lazy and wanted to do a one off change. this sounds as if you're doing next to 0 query generation from php, is that correct? At a fundamental level, my PHP code isn't concerning itself with any physical data structures. As much as possible my PHP code treats the sql data source as a processor ready to supply data in a standardized form (even hierarchical) and to accept data for storage (again hierarchical). My PHP code knows next to nothing about the table structure (why should it - it isn't a database). It does know that a customer object has a set of properties and a set of instruments of change which are passed to the SQL server to effect the data and are cached locally. PHP deals in objects/entities. Stored procedures provide the translation between the OOP and the RDBMS. This provides a nice clean interface between PHP and the data. The stored procedures and views are all pre-compiled - with their internal usage statistics to make best use of available indices and are tuned to the actual data rather than something I thought I knew about the data usage when I designed the DB. So speed is much more significant. Having every single SQL statement compiled from scratch for a 1 off use would seem wasteful. Multiple result sets are completely fine (at least for MS SQL Server) - Admittedly you have to currently process the result sets in sequential order (i.e. set 1 before moving to set 2 - can't move back to set 1). But that is something quite easy to work with when you know the limitation. And is the easiest way to get hierarchical data into PHP for me. I get all the relevant data in 1 hit rather than getting the data with potential mis-matching values due to the realtime multi-user environment. i understand the ability to consume multiple result sets is available. the issue i think would be raised with an orm would be getting result sets with mixed columns from multiple tables. im not sure how capable an orm like propel (for example) is of mapping those results back to objects. at a glance of google results it appears the result is just an array which sacrifices the abstraction the orm aims to provide. -nathan All my new projects are using stored procedures and views. No direct access to the tables. This means that if I use PHP or Excel VBA or Delphi or C or any other language, every single request will be processed in an identical way. No variation (seen/unseen, known/unknown). Some unknown nuance related to my
Re: [PHP] Help translating PHP5 code to PHP4.
On 7 March 2011 17:29, Marc Guay marc.g...@gmail.com wrote: Hi Richard, It's not a SOAP service, and I've actually decided to have ask the client to upgrade their server software before continuing. But for the sake of study: Depending upon your requirement, you could use simplexml_load_string() to convert an XML string into a native PHP object rather than manually parsing the text of the XML string. I looked up simplexml_load_string() and the manual seems to say that it's only available in PHP5. Can you clarify? Marc Ah. I see that you are trying to port TO V4 ... (Yes, simplexml is PHP5+ only). PHP4 is end of life and though I have my ZCE which was gained based upon PHP4, I've not really used it for the last many years (looking back it is probably 5 years or so). Depending upon their hosting, I would recommend one of the following options. 1 - Upgrade to PHP 5.3.5 2 - Dual install PHP 5.3.5 3 - Create a new vhost with PHP 5.3.5 I'm guessing upgrading straight away is a no-no. Running PHP4 and PHP5 SxS is very simple (I used to run PHP4 ISAPI, PHP5 CGI and PHP6-dev CGI - on the same Sambar Server - on Windows too!). The ease I had in running multiple versions of PHP on Windows would suggest it should be pretty easy to do for non-windows. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Returning a recordset to a desktop app
On 3/7/2011 7:19 AM, Richard Quadling wrote: On 5 March 2011 13:48, Ken Watkins k...@atlanticbb.net wrote: On 3/5/2011 4:30 AM, Richard Quadling wrote: On 4 March 2011 23:48, Ken Watkins k...@atlanticbb.net wrote: Hi All. I have a Windows desktop app that I created using Visual Foxpro (a database app). I want to write a PHP script that I will call from my desktop app. The script will simply query a MySQL database on my web server and return the recordset to the desktop app. My question is simply this: What is the preferred method for passing this recordset back to the desktop app? I'm assuming that there's no reasonable way to send a recordset back without converting it to an array or XML or an object or something? How do I return the data in the recordset to the desktop app? Thanks for your advice. Ken Watkins In general terms, the output of a PHP script is going to be text (html, xml, csv, etc.) or binary (images). Getting a PHP script to communicate natively with FoxPro is not going to be trivial task. It MAY be able to be done, but hopefully FoxPro has the capability of running a PHP script via the command line ... C:\PHP5\php.exe -f script.php -- script_arg1 script_arg2 PHP can either output the result set (in an appropriate form) directly and FoxPro could read it from STDIN (if it has that support) or PHP can write the answer to a file and FoxPro can use normal file and string functions to read the data. If FoxPro has XML support, then use it. It will be much cleaner in the long run if the data changes. If not, then a tab separated data file (rather than a CSV file). This assumes that your data does not contain tabs. If so, choose another separator. Richard. Richard, Foxpro does have XML support, so you answered that part of my question, thanks. And it is capable of calling any other executable on the local machine through the local OS shell - which seems to be what you are advocating. But I'm not sure how I would do that over the internet. I just discussed this issue with Larry, and I assume that I would use HTTP? Or is there a way to call a command line script on a remote web server without using HTTP? Sorry if this is a stupid question. Thanks for your help! Ken So, what you need to have is an HTTP Request from within FoxPro. http://www.example-code.com/foxpro/http_post_form.asp gives an example, but it seems to use a third party ActiveX component. If FoxPro can load any locally resident/installed ActiveX component, then maybe ... http://fox.wikis.com/wc.dll?Wiki~ReadUrl has better examples. So, using something from that to get the data (XML) and then using FoxPro's native support for XML and you should be on your way. But at this stage, I'd be looking to ask for further help in a FoxPro forum as this is really nothing to do with PHP. Good luck. Richard. Richard, Thanks for your comments. I ended up taking the simple approach - I installed an ODBC driver for MySQL and let Foxpro query the database directly from a remote workstation. I suppose that what I wanted to do originally was to introduce PHP into the mix just to have another option, and to gain more experience in PHP. Probably not a good idea anyway. Thanks again for the help. Ken Watkins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can´t upload files bigger than 50KB
Hi all: On my website I have an Ajax form. From this form user can upload files. Server side is a PHP script. This form works properly on my development server. But when I uploaded my application to the definitive server I discovered that I can only upload files less than 50KB (It works perfectly with 1 to 20 KB images). These are the data from the server configuration that I believe can affect: post_max_size 8M upload_max_filesize 2M memory_limit 128M safe_mode off SELinux disabled open_basedir none I´m now making tests with 52KB image: image.jpg I discovered that the uploaded file is uploaded to /tmp. This file name is php10tfTp. But the file is not completely uploaded! So, my PHP script is not fired! The original image size is 52KB and the new file size is 35KB . I download the tmp file and rename it to php10tfTp.jpg. I can see that half frame is the same as the original and the other half is gray. Any idea what is happening? Thanks in advance.
RE: [PHP] Can´t upload files bigger than 50KB
[snip] 50KB [/snip] Have you checked the upload form itself for max_file_size? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can´t upload files bigger than 50KB
Upload form is OK, I can upload 5MB files in development server. 2011/3/9 Jay Blanchard jblanch...@pocket.com [snip] 50KB [/snip] Have you checked the upload form itself for max_file_size?
Re: [PHP] Can´t upload files bigger than 50KB
Hi Gotzon, I'm wondering if your javascript is timing out. On the development server, is everything local so it's happening close to instantly? If so, it's possible that the latency of your production environment is causing the issue, as it's taking longer to process the request than the ajax script has allotted. That could explain why a 20K upload would work and a 50K isn't. 50K isn't that big, but if the timeout was set to one or two seconds, I suppose it's possible. Adam On Wed, Mar 9, 2011 at 10:02 AM, Gotzon Astondoa gaston...@gmail.comwrote: Upload form is OK, I can upload 5MB files in development server. 2011/3/9 Jay Blanchard jblanch...@pocket.com [snip] 50KB [/snip] Have you checked the upload form itself for max_file_size? -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
[PHP] Need help debugging random httpd segfault
Hello list, We've been experiencing random crashes on httpd, error_log shows a bunch of [notice] child pid 12984 exit signal Segmentation fault (11) PHP 5.2.17: ./configure --with-apxs2=/var/www/bin/apxs --with-gd --with-jpeg-dir=/usr/local --with-pgsql --with-pdo-pgsql --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-mssql --enable-wddx --with-mysqli --with-freetype-dir=/usr/local --enable-zend-multibyte --with-mcrypt --with-mysql --with-pdo-mysql --enable-mbstring --with-pdo-dblib --with-sybase=/usr/local/freetds --enable-soap --with-openssl --with-curl --with-imap --with-kerberos --with-imap-ssl --enable-ftp --enable-debug I've been looking at coredumps; here's what I got: (gdb) bt #0 zend_mm_remove_from_free_list (heap=0x85043f0, mm_block=0x8512420) at /root/download/php/php-5.2.17/Zend/zend_alloc.c:837 #1 0x01042561 in _zend_mm_free_int (heap=0x85043f0, p=value optimized out) at /root/download/php/php-5.2.17/Zend/zend_alloc.c:1979 #2 0x0104f9c0 in _zval_dtor () at /root/download/php/php-5.2.17/Zend/zend_variables.h:35 #3 _zval_ptr_dtor (zval_ptr=0x887af7c) at /root/download/php/php-5.2.17/Zend/zend_execute_API.c:414 #4 0x0106682e in zend_hash_destroy (ht=0x86b43c8) at /root/download/php/php-5.2.17/Zend/zend_hash.c:526 #5 0x01053a5d in destroy_zend_class (pce=0x8736aec) at /root/download/php/php-5.2.17/Zend/zend_opcode.c:185 #6 0x0106682e in zend_hash_destroy (ht=0x85046b8) at /root/download/php/php-5.2.17/Zend/zend_hash.c:526 #7 0x0105cc78 in zend_shutdown () at /root/download/php/php-5.2.17/Zend/zend.c:736 #8 0x01019ba5 in php_module_shutdown () at /root/download/php/php-5.2.17/main/main.c:1918 #9 0x01019c4b in php_module_shutdown_wrapper (sapi_globals=0x13724a0) at /root/download/php/php-5.2.17/main/main.c:1889 #10 0x010c89e3 in php_apache_child_shutdown (tmp=0x0) at /root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:369 #11 0x009d3b69 in run_cleanups () at memory/unix/apr_pools.c:2306 #12 apr_pool_destroy (pool=0x867a1b0) at memory/unix/apr_pools.c:774 #13 0x080cbd54 in clean_child_exit (code=0) at prefork.c:196 #14 0x080cc49d in just_die (sig=15) at prefork.c:328 #15 signal handler called #16 0x0052d424 in __kernel_vsyscall () #17 0x0028670b in poll () from /lib/libc.so.6 #18 0x009dda94 in apr_wait_for_io_or_timeout (f=0x0, s=0x867c1f8, for_read=0) at support/unix/waitio.c:51 #19 0x009d7ada in apr_socket_sendv (sock=0x867c1f8, vec=0xbfe85340, nvec=1, len=0xbfe85248) at network_io/unix/sendrecv.c:212 #20 0x0807b8a6 in writev_it_all (s=0x867c1f8, vec=0xbfe85338, nvec=2, len=20851, nbytes=0xbfe853dc) at core_filters.c:321 #21 0x0807c42e in ap_core_output_filter (f=0x867c850, b=0x8686538) at core_filters.c:868 #22 0x080afa28 in ap_http_header_filter (f=0x871ee70, b=0x8691a98) at http_filters.c:1306 #23 0x08071f0e in ap_content_length_filter (f=0x871ee58, b=0x8691a98) at protocol.c:1338 #24 0x080b1228 in ap_byterange_filter (f=0x871ee40, bb=0x8691a98) at byterange_filter.c:169 #25 0x08092d42 in deflate_out_filter (f=0x8691a60, bb=0x8691a98) at mod_deflate.c:512 #26 0x08092d42 in deflate_out_filter (f=0x8695050, bb=0x8691a98) at mod_deflate.c:512 #27 0x00116edd in apr_brigade_write (b=0x8691a98, flush=0x8087640 ap_filter_flush, ctx=0x8695050, str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\ lang=\fr\\r\nhead\r\nmeta name=\..., nbyte=20520) at buckets/apr_brigade.c:429 #28 0x0806fe26 in buffer_output (r=0x8694278, str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\ lang=\fr\\r\nhead\r\nmeta name=\..., len=20520) at protocol.c:1453 #29 0x0806ffcc in ap_rwrite (buf=0x875e3bc, nbyte=20520, r=0x8694278) at protocol.c:1488 #30 0x010c90a5 in php_apache_sapi_ub_write ( str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\ lang=\fr\\r\nhead\r\nmeta name=\..., str_length=20520) at /root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:78 #31 0x0102ada3 in php_ub_body_write_no_header ( str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\ lang=\fr\\r\nhead\r\nmeta name=\..., str_length=20520) at /root/download/php/php-5.2.17/main/output.c:684 #32 0x0102b377 in php_end_ob_buffer (send_buffer=1 '\001', just_flush=0 '\0') at /root/download/php/php-5.2.17/main/output.c:294 #33 0x0102ba38 in zif_ob_end_flush (ht=0, return_value=0x86a4084, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at /root/download/php/php-5.2.17/main/output.c:810 #34 0x0109162a in zend_do_fcall_common_helper_SPEC (execute_data=0xbfe85990) at
Re: [PHP] Help translating PHP5 code to PHP4.
The ease I had in running multiple versions of PHP on Windows would suggest it should be pretty easy to do for non-windows. Funny and true. Thanks for the tips Richard, I've suggested that they upgrade their hosting package. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can´t upload files bigger than 50KB
Thank you for your interest Lucas. 2011/3/9 Jim Lucas li...@cmsws.com On 3/9/2011 6:28 AM, Gotzon Astondoa wrote: Hi all: On my website I have an Ajax form. From this form user can upload files. My guess would be that you have an HTML form. Not AJAX OK. The code is http://www.phpletter.com/Demo/Tinymce-Ajax-File-Manager/ Server side is a PHP script. This form works properly on my development server. Is this on localhost or is it remote too? Development is local, production is remote. But when I uploaded my application to the definitive server I discovered that I can only upload files less than 50KB (It works perfectly with 1 to 20 KB images). Silly question, how long does it take for these 1 to 20 KB files to upload? In all of the cases the time is the same (more or less), about 4,5 seconds. I also do a test with a 35KB image and the time is the same, about 4,5 seconds These are the data from the server configuration that I believe can affect: post_max_size 8M upload_max_filesize 2M memory_limit 128M safe_mode off SELinux disabled open_basedir none I´m now making tests with 52KB image: image.jpg I discovered that the uploaded file is uploaded to /tmp. This file name is php10tfTp. how much space is free on the partition that contains /tmp ? About 16 GB But the file is not completely uploaded! So, my PHP script is not fired! The original image size is 52KB and the new file size is 35KB . I download the tmp file and rename it to php10tfTp.jpg. I can see that half frame is the same as the original and the other half is gray. Any idea what is happening? Thanks in advance.
Re: [PHP] Can´t upload files bigger than 50KB
On 3/9/2011 6:28 AM, Gotzon Astondoa wrote: Hi all: On my website I have an Ajax form. From this form user can upload files. My guess would be that you have an HTML form. Not AJAX Server side is a PHP script. This form works properly on my development server. Is this on localhost or is it remote too? But when I uploaded my application to the definitive server I discovered that I can only upload files less than 50KB (It works perfectly with 1 to 20 KB images). Silly question, how long does it take for these 1 to 20 KB files to upload? These are the data from the server configuration that I believe can affect: post_max_size 8M upload_max_filesize 2M memory_limit 128M safe_mode off SELinux disabled open_basedir none I´m now making tests with 52KB image: image.jpg I discovered that the uploaded file is uploaded to /tmp. This file name is php10tfTp. how much space is free on the partition that contains /tmp ? But the file is not completely uploaded! So, my PHP script is not fired! The original image size is 52KB and the new file size is 35KB . I download the tmp file and rename it to php10tfTp.jpg. I can see that half frame is the same as the original and the other half is gray. Any idea what is happening? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can´t upload files bigger than 50KB
Hi Adam: I don´t understand well your point. I do some time tests (production environment) uploading files from 1KB to 47 KB, in all of the cases the time is the same (more or less), about 4,5 seconds. The magic size is 48KB, can´t upload files bigger that this :-( 2011/3/9 Adam Richardson simples...@gmail.com Hi Gotzon, I'm wondering if your javascript is timing out. On the development server, is everything local so it's happening close to instantly? If so, it's possible that the latency of your production environment is causing the issue, as it's taking longer to process the request than the ajax script has allotted. That could explain why a 20K upload would work and a 50K isn't. 50K isn't that big, but if the timeout was set to one or two seconds, I suppose it's possible. Adam On Wed, Mar 9, 2011 at 10:02 AM, Gotzon Astondoa gaston...@gmail.com wrote: Upload form is OK, I can upload 5MB files in development server. 2011/3/9 Jay Blanchard jblanch...@pocket.com [snip] 50KB [/snip] Have you checked the upload form itself for max_file_size? -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com
Re: [PHP] Somewhat OT - Stored Procedures
On Wed, Mar 9, 2011 at 3:18 AM, Richard Quadling rquadl...@gmail.comwrote: On 7 March 2011 23:37, Nathan Nobbe quickshif...@gmail.com wrote: On Fri, Mar 4, 2011 at 7:29 AM, Richard Quadling rquadl...@gmail.com wrote: On 3 March 2011 18:30, Nathan Nobbe quickshif...@gmail.com wrote: Hey gang, (Yes Tedd, I like your style, when it pertains to how you address the list :)) I have a new curiosity that's arisen as a result of a new contract I'm working on, I'd like to bounce around some thoughts off the list and see what you folks think if interested. The topic at hand is stored procedures. Frankly, I've hardly ever even seen these in use, and what I'm trying to figure out are good rules of thumb as to where / when / how they are best used in application development. Also, bear in mind that personally I tend to favor OO paradigms for application development so would prefer feedback that incorporates that tendency. Initial thoughts are Bad: . Not well suited for ORM, particularly procedures which return multiple result sets consisting of columns from multiple tables . Greater potential for duplicated logic, I think this comes down to a well defined set of rules for any given application, read: convention required for success . Scripting languages are vendor specific, and likely most application developers have a limited understanding thereof Good: . Better performance . Fill in blank on convincing bullets here I've also done some reading on MSSQL vs. MySQL and found that the former offers much more features. I've also read that most databases only see roughly 40% of the feature sets being used for typical applications in the wild, and would agree from personal experience it is accurate. From my standpoint MySQL is popular because the features it offers are the features folks are really looking, one of those 80/20 things... I stumbled into this link on a google search, it's from '04 but looks to be relevant to this day http://www.codinghorror.com/blog/2004/10/who-needs-stored-procedures-anyways.html Your thoughts appreciated, -nathan Hello Nathan. I develop for and on Windows using IIS7 and MS SQL Server 7/2000/2005/2008. i love how you preface many of your responses like this. Almost exclusively I use prepared statements to talk to stored procedures and views. I use triggers and constraints to enforce RDI. I _do_ have the occasional hacky script which includes SQL, but only 'cause I was being lazy and wanted to do a one off change. this sounds as if you're doing next to 0 query generation from php, is that correct? At a fundamental level, my PHP code isn't concerning itself with any physical data structures. As much as possible my PHP code treats the sql data source as a processor ready to supply data in a standardized form (even hierarchical) and to accept data for storage (again hierarchical). My PHP code knows next to nothing about the table structure (why should it - it isn't a database). It does know that a customer object has a set of properties and a set of instruments of change which are passed to the SQL server to effect the data and are cached locally. PHP deals in objects/entities. Stored procedures provide the translation between the OOP and the RDBMS. This provides a nice clean interface between PHP and the data. The stored procedures and views are all pre-compiled - with their internal usage statistics to make best use of available indices and are tuned to the actual data rather than something I thought I knew about the data usage when I designed the DB. So speed is much more significant. Having every single SQL statement compiled from scratch for a 1 off use would seem wasteful. Multiple result sets are completely fine (at least for MS SQL Server) - Admittedly you have to currently process the result sets in sequential order (i.e. set 1 before moving to set 2 - can't move back to set 1). But that is something quite easy to work with when you know the limitation. And is the easiest way to get hierarchical data into PHP for me. I get all the relevant data in 1 hit rather than getting the data with potential mis-matching values due to the realtime multi-user environment. i understand the ability to consume multiple result sets is available. the issue i think would be raised with an orm would be getting result sets with mixed columns from multiple tables. im not sure how capable an orm like propel (for example) is of mapping those results back to objects. at a glance of google results it appears the result is just an array which sacrifices the abstraction the orm aims to provide. -nathan All my new projects are using stored procedures and views. No direct access to the tables. This means that if I use