php-general Digest 22 Mar 2010 14:33:01 -0000 Issue 6653
php-general Digest 22 Mar 2010 14:33:01 - Issue 6653 Topics (messages 303083 through 303087): Re: web sniffer 303083 by: Auke van Slooten Re: PHP SMTP Mailers 303084 by: Auke van Slooten 303085 by: Michael A. Peters another question on setting include paths for a project 303086 by: Robert P. J. Day 303087 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--- Jochen Schultz wrote: Btw., when you use file_get_contets, is there a good way to tell the script to stop recieving the file after let's say 2 seconds - just in case the server is not reachable - to avoid using fsockopen? http://nl.php.net/manual/en/context.http.php specifically: timeout float Read timeout in seconds, specified by a float (e.g. 10.5). By default the default_socket_timeout php.ini setting is used. used with http://nl.php.net/manual/en/function.stream-context-create.php regards, Auke van Slooten Muze ---End Message--- ---BeginMessage--- King Coffee wrote: Hi, I'm executing a third-parity standard PHP application on a Windows IIS 7 shared hosting server. I need to convert, or use, a SMTP mailer service. I found two SMTP PHP scripts - I think may work. The sourceforge.net PHPMailer project and the pear.php.net (Mail, Net_SMTP) project. Can any body please help me choose one and probably give a code snip of useage? Currently, I'm leaning forward the PHPMailer, with little to base the decision on. Hi, I'd take a look at http://www.phpguru.org/static/smtp.html It doesn't make the mistake of muddling the differnece between the message envelope and the message body, so you can set the recipients directly and different from the messages to/cc/bcc headers. It has a fairly sane design, based on the smtp protocol. And finally it uses exceptions in a sane way. Oh, and its a fairly small and straightforward piece of code, easy to include in any application. There's one problem in it when using it for bulk-mail. If you add many recipients and one of them is incorrect, it will fail the entire message. It's not free for commercial use, but the one-time license fee is more than worth it. regards, Auke van Slooten Muze (And no, I'm not affiliated with the author, just a happy customer). ---End Message--- ---BeginMessage--- King Coffee wrote: Hi, I'm executing a third-parity standard PHP application on a Windows IIS 7 shared hosting server. I need to convert, or use, a SMTP mailer service. I found two SMTP PHP scripts - I think may work. The sourceforge.net PHPMailer project and the pear.php.net (Mail, Net_SMTP) project. Can any body please help me choose one and probably give a code snip of useage? Currently, I'm leaning forward the PHPMailer, with little to base the decision on. Thanks in advanced, King Coffee I use phpmailer and find it to be painless and consistent. I extend the class and call the extended class: ?php require(class.phpmailer.php); class MyMailer extends PHPMailer { // Set default variables for all new objects var $From = zon...@shastaherps.org; var $FromName = Lampro P. Eltis; var $ReplyTo = mpet...@mac.com; var $Host = localhost; var $Mailer = smtp; // Alternative to IsSMTP() var $WordWrap = 75; } ? Then when I want to use it - $mail = new MyMailer(); $mail-Subject = Some Subject; $mail-Body = Some content; if($mail-Send()) { // it was successfully sent, code on success here } else { // there was an error, error code here } I never send HTML mail or attachments or bulk mail, but I believe it is capable of doing them quite easily. Tip: Whatever solution you use, set the wordwrap to something that works well on an 80 char display. Some clients do not autowrap unwrapped messages and other clients wrap for display but when replying, it doesn't wrap. I use 75 because it gives a little room for the that accompanies a reply. ---End Message--- ---BeginMessage--- to recap regarding an earlier question i asked regarding extending include paths, i have an existing project (call it proj currently all under a top-level directory also named proj) which can be SVN checked out anywhere under a user's home directory. so in my case, i might have my svn working copy under, say, /home/rpjday/stuff/work/proj/, and all proj-related content under that. at the moment, there are some subdirs under proj/ like common and utils and debug, and all includes or requires throughout the working copy are currently and awkwardly of the form: include '../../proj/utils/somescript.php'; in short, every script that needs to include another one somewhere else in
Re: [PHP] web sniffer
Jochen Schultz wrote: Btw., when you use file_get_contets, is there a good way to tell the script to stop recieving the file after let's say 2 seconds - just in case the server is not reachable - to avoid using fsockopen? http://nl.php.net/manual/en/context.http.php specifically: timeout float Read timeout in seconds, specified by a float (e.g. 10.5). By default the default_socket_timeout php.ini setting is used. used with http://nl.php.net/manual/en/function.stream-context-create.php regards, Auke van Slooten Muze -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP SMTP Mailers
King Coffee wrote: Hi, I'm executing a third-parity standard PHP application on a Windows IIS 7 shared hosting server. I need to convert, or use, a SMTP mailer service. I found two SMTP PHP scripts - I think may work. The sourceforge.net PHPMailer project and the pear.php.net (Mail, Net_SMTP) project. Can any body please help me choose one and probably give a code snip of useage? Currently, I'm leaning forward the PHPMailer, with little to base the decision on. Hi, I'd take a look at http://www.phpguru.org/static/smtp.html It doesn't make the mistake of muddling the differnece between the message envelope and the message body, so you can set the recipients directly and different from the messages to/cc/bcc headers. It has a fairly sane design, based on the smtp protocol. And finally it uses exceptions in a sane way. Oh, and its a fairly small and straightforward piece of code, easy to include in any application. There's one problem in it when using it for bulk-mail. If you add many recipients and one of them is incorrect, it will fail the entire message. It's not free for commercial use, but the one-time license fee is more than worth it. regards, Auke van Slooten Muze (And no, I'm not affiliated with the author, just a happy customer). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SMTP Mailers
King Coffee wrote: Hi, I'm executing a third-parity standard PHP application on a Windows IIS 7 shared hosting server. I need to convert, or use, a SMTP mailer service. I found two SMTP PHP scripts - I think may work. The sourceforge.net PHPMailer project and the pear.php.net (Mail, Net_SMTP) project. Can any body please help me choose one and probably give a code snip of useage? Currently, I'm leaning forward the PHPMailer, with little to base the decision on. Thanks in advanced, King Coffee I use phpmailer and find it to be painless and consistent. I extend the class and call the extended class: ?php require(class.phpmailer.php); class MyMailer extends PHPMailer { // Set default variables for all new objects var $From = zon...@shastaherps.org; var $FromName = Lampro P. Eltis; var $ReplyTo = mpet...@mac.com; var $Host = localhost; var $Mailer = smtp; // Alternative to IsSMTP() var $WordWrap = 75; } ? Then when I want to use it - $mail = new MyMailer(); $mail-Subject = Some Subject; $mail-Body = Some content; if($mail-Send()) { // it was successfully sent, code on success here } else { // there was an error, error code here } I never send HTML mail or attachments or bulk mail, but I believe it is capable of doing them quite easily. Tip: Whatever solution you use, set the wordwrap to something that works well on an 80 char display. Some clients do not autowrap unwrapped messages and other clients wrap for display but when replying, it doesn't wrap. I use 75 because it gives a little room for the that accompanies a reply. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] another question on setting include paths for a project
to recap regarding an earlier question i asked regarding extending include paths, i have an existing project (call it proj currently all under a top-level directory also named proj) which can be SVN checked out anywhere under a user's home directory. so in my case, i might have my svn working copy under, say, /home/rpjday/stuff/work/proj/, and all proj-related content under that. at the moment, there are some subdirs under proj/ like common and utils and debug, and all includes or requires throughout the working copy are currently and awkwardly of the form: include '../../proj/utils/somescript.php'; in short, every script that needs to include another one somewhere else in the code structure sadly needs to know its precise relative location. my proposal is to get rid of most of that by: 1) having developers set a single env var PROJ_DIR in their login session, reflecting wherever the heck they checked out their working copy to, then ... 2) having said developers uniformly extend their directly callable PHP scripts with something at the very top like: set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path()); not only will that let them simplify their command-line callable scripts to say just: include 'utils/somescript.php'; also, as i read it, that newly-extended include path percolates down through all PHP scripts invoked directly or indirectly from this one, right? so while i could add that set_include_path() to every single PHP script everywhere in the code base, it's really only necessary to add it to those PHP scripts that people intend to *invoke* directly -- every other script will pick it up automatically as it's called, is that correct? (did i phrase that meaningfully?) that was part one. the new additional complication is that some of those PHP scripts will manually construct HTTP POST requests and ship those requests off to PHP scripts that live under a public_html/ directory, whose scripts might *also* want to include some of those very same utils/ or common/ scripts but that modified include path will, of course, not carry across a POST request, so what's the standard way to similarly modify the include path of the scripts on the server end? (unsurprisingly, all those server-side PHP scripts are also part of the entire SVN checkout just so i can keep everything in the same place for testing.) so how can i have those server-side scripts extend their search path based on, perhaps, the same environment variable? thoughts? rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On 22 March 2010 14:18, Robert P. J. Day rpj...@crashcourse.ca wrote: to recap regarding an earlier question i asked regarding extending include paths, i have an existing project (call it proj currently all under a top-level directory also named proj) which can be SVN checked out anywhere under a user's home directory. so in my case, i might have my svn working copy under, say, /home/rpjday/stuff/work/proj/, and all proj-related content under that. at the moment, there are some subdirs under proj/ like common and utils and debug, and all includes or requires throughout the working copy are currently and awkwardly of the form: include '../../proj/utils/somescript.php'; in short, every script that needs to include another one somewhere else in the code structure sadly needs to know its precise relative location. my proposal is to get rid of most of that by: 1) having developers set a single env var PROJ_DIR in their login session, reflecting wherever the heck they checked out their working copy to, then ... 2) having said developers uniformly extend their directly callable PHP scripts with something at the very top like: set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path()); not only will that let them simplify their command-line callable scripts to say just: include 'utils/somescript.php'; also, as i read it, that newly-extended include path percolates down through all PHP scripts invoked directly or indirectly from this one, right? so while i could add that set_include_path() to every single PHP script everywhere in the code base, it's really only necessary to add it to those PHP scripts that people intend to *invoke* directly -- every other script will pick it up automatically as it's called, is that correct? (did i phrase that meaningfully?) that was part one. the new additional complication is that some of those PHP scripts will manually construct HTTP POST requests and ship those requests off to PHP scripts that live under a public_html/ directory, whose scripts might *also* want to include some of those very same utils/ or common/ scripts but that modified include path will, of course, not carry across a POST request, so what's the standard way to similarly modify the include path of the scripts on the server end? (unsurprisingly, all those server-side PHP scripts are also part of the entire SVN checkout just so i can keep everything in the same place for testing.) so how can i have those server-side scripts extend their search path based on, perhaps, the same environment variable? thoughts? rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Depending upon what is being included, an autoloader could help here. The main payoffs for autoloading are reduced memory footprint (class are loaded JIT) and no need for each class to know exactly where the other classes are. So, your main page needs to load the autoloader and the autoloader handles the loading of the classes. No need to change the include_path setting. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On Mon, 22 Mar 2010, Richard Quadling wrote: Depending upon what is being included, an autoloader could help here. The main payoffs for autoloading are reduced memory footprint (class are loaded JIT) and no need for each class to know exactly where the other classes are. So, your main page needs to load the autoloader and the autoloader handles the loading of the classes. No need to change the include_path setting. ok, i'm looking at the PHP manual page for autoload, sample: function __autoload($class_name) { require_once $class_name . '.php'; } and some obvious questions suggest themselves: 1) in as simple an example as above, does the include_path still control the search? since i'm not doing anything fancy above in terms of specifying *where* that class is defined, it seems that i'll still have the same problem to solve, no? 2) i'm guessing that i can make the __autoload function as sophisticated as i want, in that i can have it consult an environment variable to determine where to search, but i'm still unsure as to how i can set an environment variable to be consulted on the server side. rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On 03/22/2010 07:48 PM, Robert P. J. Day wrote: to recap regarding an earlier question i asked regarding extending include paths, i have an existing project (call it proj currently all under a top-level directory also named proj) which can be SVN checked out anywhere under a user's home directory. so in my case, i might have my svn working copy under, say, /home/rpjday/stuff/work/proj/, and all proj-related content under that. at the moment, there are some subdirs under proj/ like common and utils and debug, and all includes or requires throughout the working copy are currently and awkwardly of the form: include '../../proj/utils/somescript.php'; in short, every script that needs to include another one somewhere else in the code structure sadly needs to know its precise relative location. my proposal is to get rid of most of that by: 1) having developers set a single env var PROJ_DIR in their login session, reflecting wherever the heck they checked out their working copy to, then ... 2) having said developers uniformly extend their directly callable PHP scripts with something at the very top like: set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path()); not only will that let them simplify their command-line callable scripts to say just: include 'utils/somescript.php'; also, as i read it, that newly-extended include path percolates down through all PHP scripts invoked directly or indirectly from this one, right? so while i could add that set_include_path() to every single PHP script everywhere in the code base, it's really only necessary to add it to those PHP scripts that people intend to *invoke* directly -- every other script will pick it up automatically as it's called, is that correct? (did i phrase that meaningfully?) that was part one. the new additional complication is that some of those PHP scripts will manually construct HTTP POST requests and ship those requests off to PHP scripts that live under a public_html/ directory, whose scripts might *also* want to include some of those very same utils/ or common/ scripts but that modified include path will, of course, not carry across a POST request, so what's the standard way to similarly modify the include path of the scripts on the server end? (unsurprisingly, all those server-side PHP scripts are also part of the entire SVN checkout just so i can keep everything in the same place for testing.) so how can i have those server-side scripts extend their search path based on, perhaps, the same environment variable? thoughts? rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday What I do is, set the include path in the top-level bootstrapper. /bootstrap.php: set_include_path(dirname(__FILE__) . '/lib' . PATH_SEPARATOR . get_include_path()); Then I load the autoloader from /lib/autoload.php at the time of bootstrap. /lib contains others /lib/Common, /lib/Util, etc. So when I say new Common_Form();, it will include /lib/Common/Form.php -- Nilesh Govindarajan Site Server Administrator www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On Mon, Mar 22, 2010 at 10:51:38AM -0400, Robert P. J. Day wrote: On Mon, 22 Mar 2010, Richard Quadling wrote: Depending upon what is being included, an autoloader could help here. The main payoffs for autoloading are reduced memory footprint (class are loaded JIT) and no need for each class to know exactly where the other classes are. So, your main page needs to load the autoloader and the autoloader handles the loading of the classes. No need to change the include_path setting. ok, i'm looking at the PHP manual page for autoload, sample: function __autoload($class_name) { require_once $class_name . '.php'; } and some obvious questions suggest themselves: 1) in as simple an example as above, does the include_path still control the search? since i'm not doing anything fancy above in terms of specifying *where* that class is defined, it seems that i'll still have the same problem to solve, no? Yep and yep. 2) i'm guessing that i can make the __autoload function as sophisticated as i want, in that i can have it consult an environment variable to determine where to search, but i'm still unsure as to how i can set an environment variable to be consulted on the server side. That's the key. You can do anything you want inside __autoload(). If you must consult something in the environment, there are a couple of ways to do it. First, set a variable in the $_SESSION array, and consult it in __autoload(). Second, use a configuration file for your application. Have it in a stable place, and read the values out of it as needed. Consult these in your __autoload() if you like. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On 3/22/10 10:25 AM, Paul M Foster wrote: That's the key. You can do anything you want inside __autoload(). If you must consult something in the environment, there are a couple of ways to do it. First, set a variable in the $_SESSION array, and consult it in __autoload(). Second, use a configuration file for your application. Have it in a stable place, and read the values out of it as needed. Consult these in your __autoload() if you like. Paul I'd suggest skipping __autoload() and going straight for spl_autoload_register(), as it does the same thing but is more flexible since you can then have multiple autoload callbacks if necessary. --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On 22 March 2010 15:28, la...@garfieldtech.com la...@garfieldtech.com wrote: On 3/22/10 10:25 AM, Paul M Foster wrote: That's the key. You can do anything you want inside __autoload(). If you must consult something in the environment, there are a couple of ways to do it. First, set a variable in the $_SESSION array, and consult it in __autoload(). Second, use a configuration file for your application. Have it in a stable place, and read the values out of it as needed. Consult these in your __autoload() if you like. Paul I'd suggest skipping __autoload() and going straight for spl_autoload_register(), as it does the same thing but is more flexible since you can then have multiple autoload callbacks if necessary. --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Completely agree with Larry here. spl_autoload_register is __autoload++. Essentially, the autoloader knows where it is and should know where everything else it is expected to load is. Having a naming convention that say maps class name to file path/name (Zend_Soap_Wsdl_Exception maps to ./Zend/Soap/Wsdl/Exception.php) and sticking with it allows for a single autoloader to be used for any root name. Autoloading only really works out-the-box with classes. There has been discussion on making this work with functions and namespaces. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another question on setting include paths for a project
On 22 March 2010 14:51, Robert P. J. Day rpj...@crashcourse.ca wrote: On Mon, 22 Mar 2010, Richard Quadling wrote: Depending upon what is being included, an autoloader could help here. The main payoffs for autoloading are reduced memory footprint (class are loaded JIT) and no need for each class to know exactly where the other classes are. So, your main page needs to load the autoloader and the autoloader handles the loading of the classes. No need to change the include_path setting. ok, i'm looking at the PHP manual page for autoload, sample: function __autoload($class_name) { require_once $class_name . '.php'; } and some obvious questions suggest themselves: 1) in as simple an example as above, does the include_path still control the search? since i'm not doing anything fancy above in terms of specifying *where* that class is defined, it seems that i'll still have the same problem to solve, no? No. The autoloader is part of the project, so it will know its relative pathing to the other files. __DIR__ in the autoloader will tell the autoloader where it is and all associated files should be relative this. You only need to know the relative path of the autoloader. No need to alter include_path and you can remove all those (require|include)(_once)? lines too as the autoloader kicks in whenever a class it requested that hasn't been loaded. 2) i'm guessing that i can make the __autoload function as sophisticated as i want, in that i can have it consult an environment variable to determine where to search, but i'm still unsure as to how i can set an environment variable to be consulted on the server side. I think once you've got the autoloader working, you don't need to worry. rday -- Robert P. J. Day Waterloo, Ontario, CANADA Linux Consulting, Training and Kernel Pedantry. Web page: http://crashcourse.ca Twitter: http://twitter.com/rpjday -- - Richard Quadling Standing on the shoulders of some very clever giants! EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Variable Problem
tedd Please accept my apologies for not thanking you sooner, I am going over you code and learning great stuff. Again, thank you. And thank you to Adam as well. gary tedd tedd.sperl...@gmail.com wrote in message news:p06240804c7cbe9aa1...@[192.168.1.102]... At 10:14 AM -0400 3/21/10, Gary wrote: Thanks again for all the help, however the plot thickens. Gary : It doesn't have to thicken. Here's an example of using $_SESSION that works and you can have as many fields as you want: http://www.webbytedd.com/aa/step-form-sessions/index.php All the code is there. Plus, it will give you a way to go from page to page without leaving the gathering page. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com __ Information from ESET Smart Security, version of virus signature database 4962 (20100321) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 4965 (20100322) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: Re: [PHP] another question on setting include paths for a project
oops, mailed the OP direct rather than the list. sorry. Originele bericht Onderwerp: Re: [PHP] another question on setting include paths for a project Datum: Mon, 22 Mar 2010 15:58:28 + Van: Jochem Maas joc...@iamjochem.com Aan: Robert P. J. Day rpj...@crashcourse.ca Op 3/22/10 2:18 PM, Robert P. J. Day schreef: to recap regarding an earlier question i asked regarding extending include paths, i have an existing project (call it proj currently all under a top-level directory also named proj) which can be SVN checked out anywhere under a user's home directory. so in my case, i might have my svn working copy under, say, /home/rpjday/stuff/work/proj/, and all proj-related content under that. at the moment, there are some subdirs under proj/ like common and utils and debug, and all includes or requires throughout the working copy are currently and awkwardly of the form: include '../../proj/utils/somescript.php'; in short, every script that needs to include another one somewhere else in the code structure sadly needs to know its precise relative location. my proposal is to get rid of most of that by: 1) having developers set a single env var PROJ_DIR in their login session, reflecting wherever the heck they checked out their working copy to, then ... 2) having said developers uniformly extend their directly callable PHP scripts with something at the very top like: set_include_path(getenv('PROJ_DIR') . PATH_SEPARATOR . get_include_path()); not only will that let them simplify their command-line callable scripts to say just: include 'utils/somescript.php'; also, as i read it, that newly-extended include path percolates down through all PHP scripts invoked directly or indirectly from this one, right? so while i could add that set_include_path() to every single PHP script everywhere in the code base, it's really only necessary to add it to those PHP scripts that people intend to *invoke* directly -- every other script will pick it up automatically as it's called, is that correct? (did i phrase that meaningfully?) that was part one. the new additional complication is that some of those PHP scripts will manually construct HTTP POST requests and ship those requests off to PHP scripts that live under a public_html/ directory, whose scripts might *also* want to include some of those very same utils/ or common/ scripts but that modified include path will, of course, not carry across a POST request, so what's the standard way to similarly modify the include path of the scripts on the server end? (unsurprisingly, all those server-side PHP scripts are also part of the entire SVN checkout just so i can keep everything in the same place for testing.) so how can i have those server-side scripts extend their search path based on, perhaps, the same environment variable? thoughts? I think the whole 'set an ENV var in their shell session' idea is overkill. everything is checked out from svn, the structure of the project is known, there is no reason not to use relative paths for the includes, there is no need to tell the scripts where stuff is in this scenario - they can work it out automatically. the following might give you an idea for a bit of bootstrap code that's included by everything: define('INC_DIR', dirname(__FILE__)); this would allow all other code to use absolute paths and allow you to set the include_path to ''. how do the cmdline scripts know which URL to hit ... I would assume that this URL can change depending on whose checkout it is and the context (dev/prod), that means there is already a config file or some such - possibly a good place to stick the include path or define the include dir. ... and now for something 'completey' different: another trick I've used is to use custom ini settings in conjunction with get_cfg_var() - each developer/installation would have their own custom ini file (which you can store in svn too) .. the ini file would be symlinked to from the dir php is setup to read additional ini files from, the contents of the ini file would be something like: [My Cool App] my_cool_app.public_url = 'http://local.coolapp/'; my_cool_app.inc_dir = '/path/to/cool/app/'; you can then grab these values from anywhere using get_cfg_var('my_cool_app.inc_dir'), often I find that additional config stuff is needed per installation - mostly related to webserver setup (which sometimes differs somewhat between live and dev installs - SSL may not be available/required/wanted and if it is IP addresses need to be hard coded, apache may require you to use absolute paths, test systems may require IP restrictions, etc) so I setup a dir structure like so: project/cnf/targets/localhost.jochem/php project/cnf/targets/localhost.jochem/httpd project/cnf/targets/localhost.charlie/php project/cnf/targets/localhost.charlie/httpd
[PHP] Wordpress/PHP question
Hi all, I'm storing generated data as a post in wordpress using the wp_insert_post function, which works great. Users click a submit button and the things are saved, hurrah! However, on clicking the submit button I want to automatically navigate to the post. This has been less successful. I've tried using: header('Location: /?p=' . $postId); In this case, where $postId = wp_insert_post($generated_text), and $generated_text is the object that saves the output to a post. Now when I try to save I get the following error: Cannot modify header information - headers already sent by (output started at /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php:6) in */Users/sv/source/wpm/public_html/wp-content/plugins/wpm/wpm.php* on line *64* Line 64 contains the header('Location: /?p=' . $postId); line. Thanks! John -- Out now: Kvist 002 - Raglani - Web of Light - 12 Kvist 003 - EOD - untitled - 12 Kvist 004 - JD Emmanuel - Solid Dawn - CD Kvist 005 - Guillaume Gargaud - Here - CD Coming soon: Kvist 006 - Tom Hamilton - Pieces for Kohn/Formal Informal Music - CD www.kvistrecords.com
Re: [PHP] Wordpress/PHP question
John Tamm-Buckle wrote: Hi all, I'm storing generated data as a post in wordpress using the wp_insert_post function, which works great. Users click a submit button and the things are saved, hurrah! However, on clicking the submit button I want to automatically navigate to the post. This has been less successful. I've tried using: header('Location: /?p=' . $postId); In this case, where $postId = wp_insert_post($generated_text), and $generated_text is the object that saves the output to a post. Now when I try to save I get the following error: Cannot modify header information - headers already sent by (output started at /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php:6) in */Users/sv/source/wpm/public_html/wp-content/plugins/wpm/wpm.php* on line *64* Line 64 contains the header('Location: /?p=' . $postId); line. You have a space someplace... most like left after some anal coder decided it was a good idea to close all their ?php tags but didn't think about trailing space in the files :) 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] Filtering all output to STDERR
Hello, we have a strange problem here: - Our ISP is merging STDERR and STDOUT to STDOUT - We are calling a non-builtin function within PHP 5.2 which includes a lot of code and calls a lot of other functions - When calling this function, we receive the output Cannot open on STDERR. But since STDERR and STDOUT are merged, this Cannot open breaks the required HTTP-header which needs to be sent first. We really tried a lot to find out where this message comes from, we even used strace and ran PHP on the command line. But we cannot figure out the origin, so all we want to do is to get rid of the output sent to STDERR. We tried to close STDERR, but it didn't work out. We thought of using ob_start() and ob_end_clean(), but we cannot get it working with STDERR. Any ideas? Kind regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filtering all output to STDERR
You could consider suppressing errors for the duration of the problematic call - if indeed you're looking at a warning that doesn't grind everything to a halt. On 22 March 2010 18:01, Marten Lehmann lehm...@cnm.de wrote: Hello, we have a strange problem here: - Our ISP is merging STDERR and STDOUT to STDOUT - We are calling a non-builtin function within PHP 5.2 which includes a lot of code and calls a lot of other functions - When calling this function, we receive the output Cannot open on STDERR. But since STDERR and STDOUT are merged, this Cannot open breaks the required HTTP-header which needs to be sent first. We really tried a lot to find out where this message comes from, we even used strace and ran PHP on the command line. But we cannot figure out the origin, so all we want to do is to get rid of the output sent to STDERR. We tried to close STDERR, but it didn't work out. We thought of using ob_start() and ob_end_clean(), but we cannot get it working with STDERR. Any ideas? Kind regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wordpress/PHP question
On 22.03.2010 17:47, John Tamm-Buckle wrote: Hi all, I'm storing generated data as a post in wordpress using the wp_insert_post function, which works great. Users click a submit button and the things are saved, hurrah! However, on clicking the submit button I want to automatically navigate to the post. This has been less successful. I've tried using: header('Location: /?p=' . $postId); In this case, where $postId = wp_insert_post($generated_text), and $generated_text is the object that saves the output to a post. Now when I try to save I get the following error: Cannot modify header information - headers already sent by (output started at /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php:6) in */Users/sv/source/wpm/public_html/wp-content/plugins/wpm/wpm.php* on line *64* Line 64 contains the header('Location: /?p=' . $postId); line. Thanks! John Hi What's on line 6 from file /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php? --Piero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wordpress/PHP question
At 12:59 PM -0400 3/22/10, Robert Cummings wrote: You have a space someplace... most like left after some anal coder decided it was a good idea to close all their ?php tags but didn't think about trailing space in the files :) Cheers, Rob. That may be, but I always add fiber to my coding. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Code samples in OOo Presenter
Larry Garfield wrote: Hi all. I have a busy conference season coming up, and will be giving a number of presentations that involve code, specifically PHP. I am going to want to put code onto slides in OpenOffice (3.1 specifically, using Kubuntu 9.10), but to date I've never figured out a good way to do that. Anyone know of a good way to do syntax-highlighted code in OOo? Things I've tried in the past: 1) Just throw code onto the slide, no highlighting. This works, but is ugly and harder to read or demonstrate what I am doing. It's my usual fallback. 2) Screen-shot from a web page that uses syntax highlighting, such as PHP's built-in highlighting. Very difficult to prepare since the sizing is usually all off. Ugly. Very difficult to edit and change because the screen caps have to be regenerated. And PHP's default coloring for highlighting frequently clashes with the slides and looks godawful on a projector. (I once ended up with blue text on a black slide. That was a major fail.) 3) Jump out of the slides into an IDE. Works, but totally breaks the flow of the presentation. The IDE usually also has text that's way too small, and I have to reconfigure it into a presentation mode, often on the fly. It also makes discrete snippets harder to show, since there's still the entire rest of the IDE there. I don't like any of these options. :-) I don't know what the alternative is, though. Ideally I'd love to have a custom text region or format or something that is take this and highlight it properly, but I don't know if such a plugin exists. I could be talked into using KPresenter / KOffice instead if that would be easier, but as I am on Linux I have no access to KeyNote or PowerPoint. Any suggestions? --Larry Garfield Quick idea. I use geshi, or you can use highlight string. You can host the code on a local webserver and include it in a floating frame in impress. This will give a live view, or you can generate an HTML file and have that as the source of your floating frame. -- 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] Wordpress/PHP question
On 22.03.2010 18:45, John Tamm-Buckle wrote: Line 6 is: html xmlns=http://www.w3.org/1999/xhtml; ?php //language_attributes('xhtml'); ? Thanks, John On Mon, Mar 22, 2010 at 12:38 PM, Piero Steinger pi...@the-admins.ch mailto:pi...@the-admins.ch wrote: On 22.03.2010 17:47, John Tamm-Buckle wrote: Hi all, I'm storing generated data as a post in wordpress using the wp_insert_post function, which works great. Users click a submit button and the things are saved, hurrah! However, on clicking the submit button I want to automatically navigate to the post. This has been less successful. I've tried using: header('Location: /?p=' . $postId); In this case, where $postId = wp_insert_post($generated_text), and $generated_text is the object that saves the output to a post. Now when I try to save I get the following error: Cannot modify header information - headers already sent by (output started at /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php:6) in */Users/sv/source/wpm/public_html/wp-content/plugins/wpm/wpm.php* on line *64* Line 64 contains the header('Location: /?p=' . $postId); line. Thanks! John Hi What's on line 6 from file /Users/sv/source/wpm/public_html/wp-content/themes/mystique/header.php? --Piero -- Out now: Kvist 002 - Raglani - Web of Light - 12 Kvist 003 - EOD - untitled - 12 Kvist 004 - JD Emmanuel - Solid Dawn - CD Kvist 005 - Guillaume Gargaud - Here - CD Coming soon: Kvist 006 - Tom Hamilton - Pieces for Kohn/Formal Informal Music - CD www.kvistrecords.com http://www.kvistrecords.com You have to execute the plugin first, if possible. Alternatively you can put a JavaScript redirect in the file wpm.php instead of a HTTP redirect.
[PHP] Global Var Disappearing After Function
Hey list, I have a very odd problem which has been driving me crazy for two days. I've been trying to debug my code and gave up. I finally coded a very simple representation of what the code does, and I get the same problem. However, I still don't understand what's causing it. The representational code: http://pastie.org/private/fz3lgvsjopz3dhid8cf9a As you can see, it's very simple. A variable is set, then a function is called which modifies the variable in the global scope. However, the modifications CANNOT BE SEEN after the function is called. The output from the script is here: http://pastie.org/private/29r5mrr1k7rtqmw7eyoja As you can see, the modifications in do_test() cannot be seen after the function is called. What is causing this? And how can I fix it? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Var Disappearing After Function
On Mon, Mar 22, 2010 at 4:58 PM, APseudoUtopia apseudouto...@gmail.com wrote: Hey list, I have a very odd problem which has been driving me crazy for two days. I've been trying to debug my code and gave up. I finally coded a very simple representation of what the code does, and I get the same problem. However, I still don't understand what's causing it. The representational code: http://pastie.org/private/fz3lgvsjopz3dhid8cf9a As you can see, it's very simple. A variable is set, then a function is called which modifies the variable in the global scope. However, the modifications CANNOT BE SEEN after the function is called. The output from the script is here: http://pastie.org/private/29r5mrr1k7rtqmw7eyoja As you can see, the modifications in do_test() cannot be seen after the function is called. What is causing this? And how can I fix it? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I believe line 8 detaches the variable $Session that exists inside the function from the global variable that exists outside the function. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Var Disappearing After Function
On Mon, 22 Mar 2010 16:58:33 -0400 APseudoUtopia apseudouto...@gmail.com wrote: Hey list, I have a very odd problem which has been driving me crazy for two days. I've been trying to debug my code and gave up. I finally coded a very simple representation of what the code does, and I get the same problem. However, I still don't understand what's causing it. The representational code: http://pastie.org/private/fz3lgvsjopz3dhid8cf9a As you can see, it's very simple. A variable is set, then a function is called which modifies the variable in the global scope. However, the modifications CANNOT BE SEEN after the function is called. The output from the script is here: http://pastie.org/private/29r5mrr1k7rtqmw7eyoja As you can see, the modifications in do_test() cannot be seen after the function is called. What is causing this? And how can I fix it? Thanks! From PHP.net: If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called. [1] [1] http://php.net/manual/en/function.unset.php -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Twitter: @petervanderdoes WordPress Plugin Developer Blog: http://blog.avirtualhome.com Forums: http://forums.avirtualhome.com Twitter: @avhsoftware -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SMTP Mailers
Thanks, I try it and had not problems! King -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Var Disappearing After Function
On Mon, Mar 22, 2010 at 5:13 PM, Peter van der Does pvanderd...@gmail.com wrote: On Mon, 22 Mar 2010 16:58:33 -0400 APseudoUtopia apseudouto...@gmail.com wrote: Hey list, I have a very odd problem which has been driving me crazy for two days. I've been trying to debug my code and gave up. I finally coded a very simple representation of what the code does, and I get the same problem. However, I still don't understand what's causing it. The representational code: http://pastie.org/private/fz3lgvsjopz3dhid8cf9a As you can see, it's very simple. A variable is set, then a function is called which modifies the variable in the global scope. However, the modifications CANNOT BE SEEN after the function is called. The output from the script is here: http://pastie.org/private/29r5mrr1k7rtqmw7eyoja As you can see, the modifications in do_test() cannot be seen after the function is called. What is causing this? And how can I fix it? Thanks! From PHP.net: If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called. [1] [1] http://php.net/manual/en/function.unset.php Ah ha! I was looking on the php.net/global page for hints, but didn't see any. I should've looked on the unset page. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Var Disappearing After Function
APseudoUtopia wrote: On Mon, Mar 22, 2010 at 5:13 PM, Peter van der Does pvanderd...@gmail.com wrote: On Mon, 22 Mar 2010 16:58:33 -0400 APseudoUtopia apseudouto...@gmail.com wrote: Hey list, I have a very odd problem which has been driving me crazy for two days. I've been trying to debug my code and gave up. I finally coded a very simple representation of what the code does, and I get the same problem. However, I still don't understand what's causing it. The representational code: http://pastie.org/private/fz3lgvsjopz3dhid8cf9a As you can see, it's very simple. A variable is set, then a function is called which modifies the variable in the global scope. However, the modifications CANNOT BE SEEN after the function is called. The output from the script is here: http://pastie.org/private/29r5mrr1k7rtqmw7eyoja As you can see, the modifications in do_test() cannot be seen after the function is called. What is causing this? And how can I fix it? Thanks! From PHP.net: If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called. [1] [1] http://php.net/manual/en/function.unset.php Ah ha! I was looking on the php.net/global page for hints, but didn't see any. I should've looked on the unset page. Thanks! Really no reason to unset() it anyway since you do this: $Session = $UserInfo; -- 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] Filtering all output to STDERR
Hello, You could consider suppressing errors for the duration of the problematic call yes, but how? Regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filtering all output to STDERR
Have you tried with http://dk2.php.net/manual/en/function.error-reporting.php or just the @ operator? On 22 March 2010 23:56, Marten Lehmann lehm...@cnm.de wrote: Hello, You could consider suppressing errors for the duration of the problematic call yes, but how? Regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Will PHP ever grow up and have threading?
I've been using PHP for a decade or so (since PHP/FI) and love it. The one problem that seems to always keep coming back on enterprise level projects is the lack of threading. This always means we have to write some back-end code in Ruby or Java or C/C++ and some hacky database layer or DBUS or something to communicate with PHP. Will PHP ever have proper threading? It would sure let the language take the next logical leap to writing applications and daemons. I love the idea that Rails/Ruby have where you can just load objects in memory once and keep using them from page to page (this is NOT the same as a $_SESSION, it's way more flexible and powerful). But more importantly, in one application I'm working on, we need to connect to an Asterisk system for the IVR abilities. This means we have Ruby doing all that fun stuff and PHP doing the web stuff, but we're also duplicating a LOT of work. Both Ruby AND PHP now have to have ORMs for the user who's calling in, advertisements served, products shown, etc. We could have used Rails for the web portion, but I want to stay with PHP and I'm sure I don't have to explain to you PHPers why that is. Without threads, PHP just isn't even an option or only one user would be able to call in at a time. The pcntl stuff is not feasible. It's a hack at best. Spawning multiple scripts is also a recipie for disaster. When will the PHP core-devs (Zend?) realize that PHP is much more than a hook to a database. It's much more than web pages. Is this a case of it's too hard? Or is it a case of PHP core developers just being douche-bags like they are about the whole foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or other typed languages) As usual, I created a poll here too: http://www.rapidpoll.net/awp1ocy Past polls are below: http://www.rapidpoll.net/8opnt1e http://www.rapidpoll.net/arc1opy (although someone hacked this poll and loaded up the 76 votes like a little cheater) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Will PHP ever grow up and have threading?
Perhaps if you asked a question you'd get an answer rather than coming off as an angry immature crybaby in your last paragraph... No, I'm not going to dignify your post with a real answer. Come back when you can ask a real question and maybe you'll get a real answer. --Larry Garfield On Monday 22 March 2010 07:02:30 pm Daevid Vincent wrote: I've been using PHP for a decade or so (since PHP/FI) and love it. The one problem that seems to always keep coming back on enterprise level projects is the lack of threading. This always means we have to write some back-end code in Ruby or Java or C/C++ and some hacky database layer or DBUS or something to communicate with PHP. Will PHP ever have proper threading? It would sure let the language take the next logical leap to writing applications and daemons. I love the idea that Rails/Ruby have where you can just load objects in memory once and keep using them from page to page (this is NOT the same as a $_SESSION, it's way more flexible and powerful). But more importantly, in one application I'm working on, we need to connect to an Asterisk system for the IVR abilities. This means we have Ruby doing all that fun stuff and PHP doing the web stuff, but we're also duplicating a LOT of work. Both Ruby AND PHP now have to have ORMs for the user who's calling in, advertisements served, products shown, etc. We could have used Rails for the web portion, but I want to stay with PHP and I'm sure I don't have to explain to you PHPers why that is. Without threads, PHP just isn't even an option or only one user would be able to call in at a time. The pcntl stuff is not feasible. It's a hack at best. Spawning multiple scripts is also a recipie for disaster. When will the PHP core-devs (Zend?) realize that PHP is much more than a hook to a database. It's much more than web pages. Is this a case of it's too hard? Or is it a case of PHP core developers just being douche-bags like they are about the whole foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or other typed languages) As usual, I created a poll here too: http://www.rapidpoll.net/awp1ocy Past polls are below: http://www.rapidpoll.net/8opnt1e http://www.rapidpoll.net/arc1opy (although someone hacked this poll and loaded up the 76 votes like a little cheater) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Will PHP ever grow up and have threading?
That's okay Larry, YOU don't have to answer. Sorry my post offended you Larry (and anyone else equally offended). ...and yes. I AM angry that they refuse to add functionality to the PHP language that MANY people have been requesting, just because they are stubborn. I'll spare you the links to the threads (no pun intended) as you can easily find them. Have a lovely day! Your best friend always, Daevid. -Original Message- From: Larry Garfield [mailto:la...@garfieldtech.com] Sent: Monday, March 22, 2010 5:39 PM To: php-general@lists.php.net Subject: Re: [PHP] Will PHP ever grow up and have threading? Perhaps if you asked a question you'd get an answer rather than coming off as an angry immature crybaby in your last paragraph... No, I'm not going to dignify your post with a real answer. Come back when you can ask a real question and maybe you'll get a real answer. --Larry Garfield Is this a case of it's too hard? Or is it a case of PHP core developers just being douche-bags like they are about the whole foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or other typed languages) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Will PHP ever grow up and have threading?
On Monday 22 March 2010 20:59:21 Daevid Vincent wrote: That's okay Larry, YOU don't have to answer. Sorry my post offended you Larry (and anyone else equally offended). ...and yes. I AM angry that they refuse to add functionality to the PHP language that MANY people have been requesting, just because they are stubborn. I'll spare you the links to the threads (no pun intended) as you can easily find them. Have a lovely day! Your best friend always, Daevid. -Original Message- From: Larry Garfield [mailto:la...@garfieldtech.com] Sent: Monday, March 22, 2010 5:39 PM To: php-general@lists.php.net Subject: Re: [PHP] Will PHP ever grow up and have threading? Perhaps if you asked a question you'd get an answer rather than coming off as an angry immature crybaby in your last paragraph... No, I'm not going to dignify your post with a real answer. Come back when you can ask a real question and maybe you'll get a real answer. --Larry Garfield Is this a case of it's too hard? Or is it a case of PHP core developers just being douche-bags like they are about the whole foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or other typed languages) You could implement the features yourself. -- Blessings David M. I have been driven to my knees many times by the overwhelming conviction that I had nowhere else to go. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Will PHP ever grow up and have threading?
David McGlone wrote: On Monday 22 March 2010 20:59:21 Daevid Vincent wrote: That's okay Larry, YOU don't have to answer. Sorry my post offended you Larry (and anyone else equally offended). ...and yes. I AM angry that they refuse to add functionality to the PHP language that MANY people have been requesting, just because they are stubborn. I'll spare you the links to the threads (no pun intended) as you can easily find them. Have a lovely day! Your best friend always, Daevid. -Original Message- From: Larry Garfield [mailto:la...@garfieldtech.com] Sent: Monday, March 22, 2010 5:39 PM To: php-general@lists.php.net Subject: Re: [PHP] Will PHP ever grow up and have threading? Perhaps if you asked a question you'd get an answer rather than coming off as an angry immature crybaby in your last paragraph... No, I'm not going to dignify your post with a real answer. Come back when you can ask a real question and maybe you'll get a real answer. --Larry Garfield Is this a case of it's too hard? Or is it a case of PHP core developers Subscribe to internals. Read the archives. The truth is out there. just being douche-bags like they are about the whole That's just rude. foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a There are reasons. You would know this if you had done the legwork before opening your mouth and letting crap fall out. function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or PHP is NOT Java. other typed languages) Nor is it OTHER types languages. You could implement the features yourself. Damn, Mr McGlone beat me to it :) When you set the subject line of your rant to something like Will PHP ever 'grow up', I expect your argument to at least be rationale, logical, and quite possibly contain a patch. It's called open source because you too can make changes. 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] Will PHP ever grow up and have threading?
It's code design problem you face, there is loots of solutions to use treading in php. (analyse the way ms C# and VB creates and handles threads, and when you have done that you can create a couple of php scripts to acquire the same result). Read GOF (gang of fore) Design Patterns: Elements of Reusable Object-Oriented Software (ISBN 0-201-63361-2) and PHP 5 Power Programming (ISBN 0-131-47149-X) Start reading and stop being an AHole. 2010/3/23 Daevid Vincent dae...@daevid.com: I've been using PHP for a decade or so (since PHP/FI) and love it. The one problem that seems to always keep coming back on enterprise level projects is the lack of threading. This always means we have to write some back-end code in Ruby or Java or C/C++ and some hacky database layer or DBUS or something to communicate with PHP. Will PHP ever have proper threading? It would sure let the language take the next logical leap to writing applications and daemons. I love the idea that Rails/Ruby have where you can just load objects in memory once and keep using them from page to page (this is NOT the same as a $_SESSION, it's way more flexible and powerful). But more importantly, in one application I'm working on, we need to connect to an Asterisk system for the IVR abilities. This means we have Ruby doing all that fun stuff and PHP doing the web stuff, but we're also duplicating a LOT of work. Both Ruby AND PHP now have to have ORMs for the user who's calling in, advertisements served, products shown, etc. We could have used Rails for the web portion, but I want to stay with PHP and I'm sure I don't have to explain to you PHPers why that is. Without threads, PHP just isn't even an option or only one user would be able to call in at a time. The pcntl stuff is not feasible. It's a hack at best. Spawning multiple scripts is also a recipie for disaster. When will the PHP core-devs (Zend?) realize that PHP is much more than a hook to a database. It's much more than web pages. Is this a case of it's too hard? Or is it a case of PHP core developers just being douche-bags like they are about the whole foo($set_this_parameter=$bar); bull$hit??! (there is NO reason NOT to let the developer choose WHICH of the list of parameters they want to set in a function/method call aside from being stubborn! Especially when there are many parameters and you can't overload functions like you can in Java or other typed languages) As usual, I created a poll here too: http://www.rapidpoll.net/awp1ocy Past polls are below: http://www.rapidpoll.net/8opnt1e http://www.rapidpoll.net/arc1opy (although someone hacked this poll and loaded up the 76 votes like a little cheater) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- MvH / Hans Åhlin Tel: +46761488019 http//www.kronan-net.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP to access shell script to print barcodes
Op 3/23/10 3:27 AM, Rob Gould schreef: I am trying to replicate the functionality that I see on this site: http://blog.maniac.nl/webbased-pdf-lto-barcode-generator/ Notice after you hit SUBMIT QUERY, you get a PDF file with a page of barcodes. That's _exactly_ what I'm after. Fortunately, the author gives step-by-step instructions on how to do this on this page: http://blog.maniac.nl/2008/05/28/creating-lto-barcodes/ So I've gotten through all the steps, and have created the barcode_with_samples.ps file, and have it hosted here: http://www.winecarepro.com/kiosk/fast/shell/ Notice how the last few lines contain the shell-script that renders the postscript: #!/bin/bash BASE=”100″; NR=$BASE for hor in 30 220 410 do ver=740 while [ $ver -ge 40 ]; do printf -v FNR “(%06dL3)” $NR echo “$hor $ver moveto $FNR (includetext height=0.55) code39 barcode” let ver=$ver-70 let NR=NR+1 done done I need to somehow create a PHP script that executes this shell script. And after doing some research, it sounds like I need to use the PHP exec command, so I do that with the following file: http://www.winecarepro.com/kiosk/fast/shell/printbarcodes.php Which has the following script: ?php $command=http://www.winecarepro.com/kiosk/fast/shell/barcode_with_sample.ps;; exec($command, $arr); echo $arr; ? And, as you can see, nothing works. I guess firstly, I'd like to know: A) Is this PHP exec call really the way to go with executing this shell script? Is there a better way? It seems to me like it's not really executing. that's what exec() is for. $command need to contain a *local* path to the command in question, currently your trying to pass a url to bash ... which obviously doesn't do much. the shell script in question needs to have the executable bit set in order to run (either that or change to command to run bash with your script as an argument) I'd also suggest putting the shell script outside of your webroot, or at least in a directory that's not accessable from the web. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php