php-general Digest 27 Jun 2004 15:45:17 -0000 Issue 2844
php-general Digest 27 Jun 2004 15:45:17 - Issue 2844 Topics (messages 189107 through 189113): Crontab PHP Script 189107 by: Ryan Schefke 189108 by: Marek Kilimajer 189109 by: Scot L. Harris 189112 by: Tim Traver Re: image upload woes 189110 by: Marek Kilimajer Construction 189111 by: Jason Davidson 189113 by: David Goodlad Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n; /* to */ $to = [EMAIL PROTECTED]; /* from */ $headers .= From: tgWedding [EMAIL PROTECTED]\r\n; /* bcc */ // $headers .= Bcc: [EMAIL PROTECTED]; mail($to, $str_subject, $messagecontent, $headers); ? Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php https://217.160.251.56:8443/sysuser/crontab_edit.php?cte_src=CTEJKgkqCSoJKg kvaG9tZS9odHRwZC92aG9zdHMvdGd3ZWRkaW5nLmNvbS9odHRwZG9jcy90Z3dlZGRpbmcvY3Jvbn RhYi5waHA= I used * for every field except M, which I set to 01 to run every minute. It's not working...can someone guide me along and let me know what I've done wrong. Thanks, Ryan ---End Message--- ---BeginMessage--- Ryan Schefke wrote --- napísal:: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php The crontab command should be: /path/to/php /path/to/your/crontab.php Add -q parameter if the php executable is cgi and not cli ---End Message--- ---BeginMessage--- On Sat, 2004-06-26 at 19:34, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. You need to add #!/usr/bin/php At the start of your script so it knows how to run it. You will also need to set the permission bits to allow execution chmod 700 Change the path to where you have the cli version of php on your system. -- Scot L. Harris [EMAIL PROTECTED] ---End Message--- ---BeginMessage--- Not sure if this is different in linux, but usually the first parameter is the minutes, and if you had 01 in it, that means that it would do it once an hour (i.e. 12:01, 1:01, 2:01, etc... They should all have stars to do it once a minute. In freeBSD, it would look like this : * * * * root/usr/local/bin/php home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php Tim. At 04:34 PM 6/26/2004, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n;
Re: [PHP] Construction
As far as I know, this is fairly common in most programming languages (but I just woke up so don't take my word on it!). It allows you a lot greater control over the construction of your class, since you can force the child class to override what the parent class's default member variable values are by calling the parent constructor first, or you can have it be overridden by the parent by calling the parent constructor at the end of the child's constructor. Dave On Sat, 26 Jun 2004 20:51:58 -0700, Jason Davidson [EMAIL PROTECTED] wrote: If you instantiate a child class, the parent class constructor is not called, is there a reason for this? anyone know of plans to change this at all, the obvious workaround is to call the parents constructor inside the childs constructor, but this seems kinda strange. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New changes
attachment: nyngargjah.bmp-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Construction
On Sat, 26 Jun 2004 20:51:58 -0700, Jason Davidson [EMAIL PROTECTED] wrote: If you instantiate a child class, the parent class constructor is not called, is there a reason for this? anyone know of plans to change this at all, the obvious workaround is to call the parents constructor inside the childs constructor, but this seems kinda strange. I think it's unlikely to change. PHP5 also works this way, though it uses constructor methods named __construct (in addition to allowing old-style constructors with the name of the class). ?php // PHP5 class Foo { function __construct() { $this-x = data; } } class Bar extends Foo { function __construct() { parent::__construct(); $this-y = more data; } } ? FWIW Python also requires child classes to call parent constructors manually. Not sure what the justification is for this design decision is, though, in either language. Anybody? pb -- paul bissex, e-scribe.com -- database-driven web development 413.585.8095 69.55.225.29 01061-0847 72°39'71W 42°19'42N -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Construction
Paul Bissex wrote: FWIW Python also requires child classes to call parent constructors manually. Not sure what the justification is for this design decision is, though, in either language. Anybody? Flexibility, I would guess. With PHP's current behavior one can: (1) Call the parent constructor first, before the subclass constructor does its work. (2) Call the parent constructor last, after the subclass constructor does its work. (3) Call the parent constructor in the middle...doing some work before, and then some work after. :) (3) Pass through all of the subclass constructor's arguments to the parent constructor unaltered. (4) Change or filter some of the arguments that get passed to the parent constuctor. (5) Choose not to call the parent constructor at all. (6) Many other things that I'm sure I'm overlooking... If PHP called the parent constructor for you automagically, then how would you implement the above options? PHP would have to choose one approach and stick to it. I like the current behavior much better. Forgive me if this has been mentioned in this thread previously, but PHP does call the parent class constructor automatically if the subclass has no constuctor, which does make sense -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Crontab PHP Script
Just some closure on my crontab question: 1 - Since my linux box has Plesk 7 (PSA) and it already had php installed on it I guess php is installed in the /usr/local/psa/admin/bin/php directory. Pretty sure atleast since the below crontab command is now executing my script: /usr/local/psa/admin/bin/php /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php I believe traditionally php is installed in /usr/local/bin/php but I could be wrong...this is what was throwing me off. 2 - Tim, you were right, all stars will make the crontab run every minute on my linux box -Original Message- From: Tim Traver [mailto:[EMAIL PROTECTED] Sent: Sunday, June 27, 2004 1:17 AM To: Ryan Schefke; Php-General-Help; [EMAIL PROTECTED] Subject: Re: [PHP] Crontab PHP Script Not sure if this is different in linux, but usually the first parameter is the minutes, and if you had 01 in it, that means that it would do it once an hour (i.e. 12:01, 1:01, 2:01, etc... They should all have stars to do it once a minute. In freeBSD, it would look like this : * * * * root/usr/local/bin/php home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php Tim. At 04:34 PM 6/26/2004, Ryan Schefke wrote: Hi, Can someone please give me some guidance. I'd like to run a php script every minute (in reality every night, but just testing). I've done some reading and found that a crontab is the best way to go (I think). I'm using Plesk 7 on a Linux box and I have root access. I made a quick php script called crontab.php to email me. == ?php //send email on domain /* subject */ $str_subject = crontab test; /* message */ $messagecontent = this is a test to see if crontab working nightly\n\n; /* to */ $to = [EMAIL PROTECTED]; /* from */ $headers .= From: tgWedding [EMAIL PROTECTED]\r\n; /* bcc */ // $headers .= Bcc: [EMAIL PROTECTED]; mail($to, $str_subject, $messagecontent, $headers); ? Then I setup my crontab command as: /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/crontab.php https://217.160.251.56:8443/sysuser/crontab_edit.php?cte_src=CTEJKgkqCSoJK g kvaG9tZS9odHRwZC92aG9zdHMvdGd3ZWRkaW5nLmNvbS9odHRwZG9jcy90Z3dlZGRpbmcvY3Jvb n RhYi5waHA= I used * for every field except M, which I set to 01 to run every minute. It's not working...can someone guide me along and let me know what I've done wrong. Thanks, Ryan SimpleNet's Back ! http://www.simplenet.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hierarchies and MySQL with PHP
Hi, I wonder what you think are the best (or least worst) strategies to store and retrieve hierarchial data (such as a threaded discussion or a multi-level menu tree) in MySQL using PHP? I have been using table structures where each row contains a parent reference, such as: Table Example: Field namedata type/db flagsComents = RowID int unsigned auto_increment not null (primary key) ParentRowID int unsigned 0 (or NULL if at top level) Name varchar(50) ... which is OK for *defining* the hierarchy. However, it's a pain to retrieve the data so that it can be displayed in a nice threaded/sorted way, where children are sorted directly below their parents. I also want the items to be nicely sorted within their own branch, of course. On MS SQL, I successfully used stored procedures that employ temporary tables and while statements and the like. That method is not available in MySQL (yet), so I'll have to do a lot of the manipulation on the web server instead, using PHP. Any suggestions? /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hierarchies and MySQL with PHP
This should be of your interest: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/ Mattias Thorslund wrote --- napísal:: Hi, I wonder what you think are the best (or least worst) strategies to store and retrieve hierarchial data (such as a threaded discussion or a multi-level menu tree) in MySQL using PHP? I have been using table structures where each row contains a parent reference, such as: Table Example: Field namedata type/db flagsComents = RowID int unsigned auto_increment not null (primary key) ParentRowID int unsigned 0 (or NULL if at top level) Name varchar(50) ... which is OK for *defining* the hierarchy. However, it's a pain to retrieve the data so that it can be displayed in a nice threaded/sorted way, where children are sorted directly below their parents. I also want the items to be nicely sorted within their own branch, of course. On MS SQL, I successfully used stored procedures that employ temporary tables and while statements and the like. That method is not available in MySQL (yet), so I'll have to do a lot of the manipulation on the web server instead, using PHP. Any suggestions? /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hierarchies and MySQL with PHP
I did one once where the key to the table was a string, and the string contained 1 to n Node Numbers separated by a separator character. 1 1.1 1.1.1 1.2 select data from table where node between (1 and 2) resulted in an entire limb of the tree being retrieved. Limitations were the size of the string, depth of the tree (the string was truncated), and the number of digits in each node number. Problem also with ordering node numbers, node number 1 tended to be followed by node number 10, 11, 12, etc, then number 2, until I pre-determined the number of leading zeros for each node. Not pretty, but it works well for small trees. Warren Vail -Original Message- From: Mattias Thorslund [mailto:[EMAIL PROTECTED] Sent: Sunday, June 27, 2004 9:59 AM To: PHP General Mail List Subject: [PHP] Hierarchies and MySQL with PHP Hi, I wonder what you think are the best (or least worst) strategies to store and retrieve hierarchial data (such as a threaded discussion or a multi-level menu tree) in MySQL using PHP? I have been using table structures where each row contains a parent reference, such as: Table Example: Field namedata type/db flagsComents = RowID int unsigned auto_increment not null (primary key) ParentRowID int unsigned 0 (or NULL if at top level) Name varchar(50) ... which is OK for *defining* the hierarchy. However, it's a pain to retrieve the data so that it can be displayed in a nice threaded/sorted way, where children are sorted directly below their parents. I also want the items to be nicely sorted within their own branch, of course. On MS SQL, I successfully used stored procedures that employ temporary tables and while statements and the like. That method is not available in MySQL (yet), so I'll have to do a lot of the manipulation on the web server instead, using PHP. Any suggestions? /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hierarchies and MySQL with PHP
Marek Kilimajer wrote: This should be of your interest: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/4047/ Indeed! The flat table model is simple, efficient and - I think - sufficient. Thanks! I also found this article which explains the fourth method not really described above, despite the title: http://www.sitepoint.com/article/hierarchical-data-database/ That method is a bit more complicated but it also allows you to determine the (total) number of child nodes of a node, without an extra SQL query. /Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php