RE: [PHP] Doing a Multiple Search

2003-03-04 Thread Justin Michael Couto

Hunter,

What you need to do is this:

$Query=SELECT * from $TableName WHERE lastname='$Array[lastname]' OR
firstname='$Array[firstname]' ;

That will get the functionality you are looking for.  You might also
want to consider doing this:

$Query=SELECT * from $TableName WHERE lastname LIKE '$Array[lastname]%'
OR firstname LIKE '$Array[firstname]%' ;

That wil also search on the first name and last name.  In addition, if
you are searching from someone by the name of Bob Smith and you just put
an 'S' in the last name field, you would pull up everyperson that had a
last name that started with 'S'

Good Luck

XXX
I know this must be an easy solution, just not seeing what it is.

I have tried to add several options to the below code but can't seem to
get
it right.

Here is the Base Line I am working with:

$Query=SELECT * from $TableName WHERE lastname='$Array[lastname] AND
firstname='$Array[firstname]' ;

What I ant to be able to do is a search on both the lastname and the
firstname so if someone just puts in the last name it will display all
people with the queried last name regardless of the first name.  So for
the
visual representation

If I search for Bob Smith, it will give me:

Smith   Bob

If I search by last name Smith, it will give me

Smith Bob
Smith John
Smith Mike


Any and all help would be greatly appreciated.

Thanks in Advance

Jess

-- 
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] Still no luck running a PHPCLI script from CRON

2003-03-03 Thread Justin Michael Couto
 other types of scripts like bash scripts run fine
JMC from
cron.  I am surprised no one else has come across this problem
before.

Please help me!

  Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com


-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:44 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

Shouldn't it be
#!/usr/local/bin/php

Or was it just a typo here?

- Original Message -
From: Justin Michael Couto [EMAIL PROTECTED]
To: 'Ernest E Vogelsinger' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 12:09 PM
Subject: RE: [PHP] Can't run PHP cli script from Cron


  I can run it from the shell prompt perfectly fine.  I just won't
JMC run
  from cron.
 
  I do have the statement:
 
  #!/usr/local/php
 
  In the beginning of my script.  Like I said it works perfect when
I
run
  it by hand from the shell prompt.  I think the reason it is not
running
  has to do with the cron environment, but I am not ssure what it
is.
 
  Justin Michael Couto[EMAIL PROTECTED]
  Director of Operations  805.781.0420
  Somnio World Web Solutions  http://www.somnioworld.com
 
 
  -Original Message-
  From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 28, 2003 12:55 AM
  To: Justin Michael Couto
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Can't run PHP cli script from Cron
 
  At 05:30 28.02.2003, Justin Michael Couto said:
  [snip]
  Here is my crontab entry:
  
  * * * * * /path/to/file/file_name.php
  
  I also have
  
  * * * * * /path/to/file/bash_test_script
  [snip]
 
  Did you try to run the php file interactively, from the shell
JMC prompt?
 
  You need at last this statement on top of your PHP files:
  #!/usr/local/php
 
 
  --
 O Ernest E. Vogelsinger
 (\)ICQ #13394035
  ^ http://www.vogelsinger.at/
 
 
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



JMC -- 
JMC PHP General Mailing List (http://www.php.net/)
JMC To unsubscribe, visit: http://www.php.net/unsub.php


JMC -- 
JMC PHP General Mailing List (http://www.php.net/)
JMC To unsubscribe, visit: http://www.php.net/unsub.php

JMC Put phpinfo(); in your script and you should get an email from cron
JMC with the output of your script. See if there is anything in there
that
JMC can give you a clue.
JMC I ran your script using cli 4.3.0 and it worked fine.
JMC What user are you running cron as?

JMC -- 
JMC regards,
JMC Tom

I ran it from cron as root on linux (crux linux)
are you sure it is not running? It maybe that it won't email from
cron.
just look in /var/log/cron if it exists and see if it at least is
trying to run the script

-- 
regards,
Tom


-- 
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] Still no luck running a PHPCLI script from CRON

2003-03-03 Thread Justin Michael Couto
Dan,

I used your example exactly like you have it specified.  My cron log
looks like this:

Mar  3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD
(/usr/local/contab-scripts/wibble.php)

Mar  3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD
(/usr/local/contab-scripts/wibble.php)

However, it does nothing at all.  It doesn't create the
/tmp/wibble.output file.  After testing this, I went in and ran the
wibble.php script by hand from the command line and it worked just as my
scripts work when I run them by hand.  I ran the cron as root and ran
the script by hand as root.  I really think there is a bug somewhere,
either in FreeBSD or in PHP.  I am not sure what it can be.  All I know
is that other scripts like bash scripts run fine from cron.  This
problem is really weird and I would truly appreciate any more assistance
in getting it resolved.

Thanks everyone,


XX

 Ok, by looking at my cron logs it looks like cron is trying to run my
 PHP CLI script.  However, it is not running it.  I only have one line
of
 code that isn't commented out and the line simply sends me an email
 using the PHP mail() function.

One thing to keep in mind when working with crontab is environmental
variables. As in, Cron has none. You have to set any you want in your
crontab, or your called scripts. For example, use full paths.

You shouldnt have to call a shell before calling the php cli. Here is an
example script for you to test. My php binary is in /usr/local/bin/php,
my
script is /usr/local/crontab-scripts/wibble.php and the file I am
writing
to is in /tmp/wibble.output

This is what wibble looks like [chmoded to 755, owned by the user of the
crontab]:

#!/usr/local/bin/php -q
?php
  if ($fp = fopen(/tmp/wibble.output,a)) {
fputs($fp, Script Executed on .date(YmdHis).\n);
fclose($fp);
  } else {
die(Could not open 'wibble.output' for read / write operations);
  }
?

and the crontab line I have is:

* * * * /usr/local/contab-scripts/wibble.php

and you can see the output of it running every minute:

tail -f /tmp/wibble.output

Works fine for me ... try it

-- 
Dan Hardiker [EMAIL PROTECTED]
ADAM Software  Systems Engineer
First Creative



-- 
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] Still no luck running a PHPCLI script from CRON -- getting closer

2003-03-03 Thread Justin Michael Couto
I have my PHP script running from cron now as root, but when I try to
run it as a non root user it doesn't work.  When I drop down to the non
root user and run the script by hand I get this.

/usr/libexec/ld-elf.so.1: Shared object libmysqlclient.so.12 not found

any ideas why this wouldn't not happen as root but does as a non root
user?

thanks

Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com
 

-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 03, 2003 6:23 PM
To: Justin Michael Couto
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re[2]: [PHP] Still no luck running a PHPCLI script from CRON

Hi,

Tuesday, March 4, 2003, 10:01:25 AM, you wrote:
JMC Dan,

JMC I used your example exactly like you have it specified.  My cron
log
JMC looks like this:

JMC Mar  3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC (/usr/local/contab-scripts/wibble.php)

JMC Mar  3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD
JMC (/usr/local/contab-scripts/wibble.php)

JMC However, it does nothing at all.  It doesn't create the
JMC /tmp/wibble.output file.  After testing this, I went in and ran the
JMC wibble.php script by hand from the command line and it worked just
as my
JMC scripts work when I run them by hand.  I ran the cron as root and
ran
JMC the script by hand as root.  I really think there is a bug
somewhere,
JMC either in FreeBSD or in PHP.  I am not sure what it can be.  All I
know
JMC is that other scripts like bash scripts run fine from cron.  This
JMC problem is really weird and I would truly appreciate any more
assistance
JMC in getting it resolved.

JMC Thanks everyone,


JMC
XX

 Ok, by looking at my cron logs it looks like cron is trying to run my
 PHP CLI script.  However, it is not running it.  I only have one line
JMC of
 code that isn't commented out and the line simply sends me an email
 using the PHP mail() function.

JMC One thing to keep in mind when working with crontab is
environmental
JMC variables. As in, Cron has none. You have to set any you want in
your
JMC crontab, or your called scripts. For example, use full paths.

JMC You shouldnt have to call a shell before calling the php cli. Here
is an
JMC example script for you to test. My php binary is in
/usr/local/bin/php,
JMC my
JMC script is /usr/local/crontab-scripts/wibble.php and the file I am
JMC writing
JMC to is in /tmp/wibble.output

JMC This is what wibble looks like [chmoded to 755, owned by the user
of the
JMC crontab]:

JMC #!/usr/local/bin/php -q
JMC ?php
JMC   if ($fp = fopen(/tmp/wibble.output,a)) {
JMC fputs($fp, Script Executed on .date(YmdHis).\n);
JMC fclose($fp);
JMC   } else {
JMC die(Could not open 'wibble.output' for read / write
operations);
JMC   }
?

JMC and the crontab line I have is:

JMC * * * * /usr/local/contab-scripts/wibble.php

JMC and you can see the output of it running every minute:

JMC tail -f /tmp/wibble.output

JMC Works fine for me ... try it

JMC -- 
JMC Dan Hardiker [EMAIL PROTECTED]
JMC ADAM Software  Systems Engineer
JMC First Creative



JMC -- 
JMC PHP General Mailing List (http://www.php.net/)
JMC To unsubscribe, visit: http://www.php.net/unsub.php

Try removing the -q's and see if root or whatever user cron runs as gets
an email with an error message in it, as cron is actully having a
crack at running the script.

-- 
regards,
Tom


-- 
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] Still no luck running a PHPCLI script from CRON

2003-03-02 Thread Justin Michael Couto
Does anyone have a PHP CLI script running from cron?

If so I would greatly appreciate any assistance.  Below is everything
from this on going problem.  It seems none has an answer so far.

Please help.
XXX

I tried to run the script directly from cron like:

* * * * * /usr/local/bin/php -q /path/to/cron/script/file_name

I also tried to run cron in the bash environment by writing a bash
script that calls my PHP script.  I set cron you call the bash script
every minute. The bash script contained the following information:

 START SCRIPT
=
#!/usr/local/bin/bash
/path/to/PHP/script/file_name
= END SCRIPT
==

If I run the bash script from the command line it definitely runs my PHP
script. I know this because my PHP script sends me an email. 

Also, if I run my PHP script from the command line it also runs fine and
I receive an email.  However, anytime I try to run PHP script or the
bash script from cron nothing happens.  I get no emails.  I also know
cron is working properly because a regular bash script as I listed in my
earlier posting works fine.

This is using the new CLI that come with PHP 4.3 I have in past versions
of used the CGI from cron with no problems at all.  As a matter of fact
I have another server that does all its maintenance via PHP scripts that
get ran by cron

Here is the PHP CLI cron script I am testing to see if cron will run my
PHP

 START SCRIPT
=
#!/usr/local/bin/php -q
?

mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i a));

?
= END SCRIPT
==
 

Any more suggestions would be greatly appreciated.

Justin

-Original Message-
From: CodersNightMare [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 10:32 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Can't run PHP cli script from Cron


I am sure you have tried this, but,
Do you call the full path to php for cron.

something like:

40 * * * * /usr/local/bin/php -q /home/user/phpcliscript

Hope this helps.


At 10:10 AM 2/28/2003 -0800, you wrote:
The path is

#!/usr/local/bin/php -q

But like I said, that can't be the problem because when I run it from
the command line, it runs fine.  The only problem I am having is that
it
won't run from cron.  That is why I think it is an issue with the cron
environment.  All other types of scripts like bash scripts run fine
from
cron.  I am surprised no one else has come across this problem before.

Please help me!

  Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com


-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:44 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

Shouldn't it be
#!/usr/local/bin/php

Or was it just a typo here?

- Original Message -
From: Justin Michael Couto [EMAIL PROTECTED]
To: 'Ernest E Vogelsinger' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 12:09 PM
Subject: RE: [PHP] Can't run PHP cli script from Cron


  I can run it from the shell prompt perfectly fine.  I just won't run
  from cron.
 
  I do have the statement:
 
  #!/usr/local/php
 
  In the beginning of my script.  Like I said it works perfect when I
run
  it by hand from the shell prompt.  I think the reason it is not
running
  has to do with the cron environment, but I am not ssure what it is.
 
  Justin Michael Couto[EMAIL PROTECTED]
  Director of Operations  805.781.0420
  Somnio World Web Solutions  http://www.somnioworld.com
 
 
  -Original Message-
  From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 28, 2003 12:55 AM
  To: Justin Michael Couto
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Can't run PHP cli script from Cron
 
  At 05:30 28.02.2003, Justin Michael Couto said:
  [snip]
  Here is my crontab entry:
  
  * * * * * /path/to/file/file_name.php
  
  I also have
  
  * * * * * /path/to/file/bash_test_script
  [snip]
 
  Did you try to run the php file interactively, from the shell
prompt?
 
  You need at last this statement on top of your PHP files:
  #!/usr/local/php
 
 
  --
 O Ernest E. Vogelsinger
 (\)ICQ #13394035
  ^ http://www.vogelsinger.at/
 
 
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net

RE: [PHP] Still no luck running a PHPCLI script from CRON

2003-03-02 Thread Justin Michael Couto
Tom,

Did you run the script from cron?  If so, what operating system are you
using?  Putting PHP info in my script won't do me any good since cron
won't run it.  The trouble is that cron does nothing.  When I run the
email script I get no mail.  If I run the script from the command line
by hand ./script_name etc it works fine.

Any other ideas would be great.

Thanks


X

Hi,

Monday, March 3, 2003, 6:33:46 AM, you wrote:
JMC Does anyone have a PHP CLI script running from cron?

JMC If so I would greatly appreciate any assistance.  Below is
everything
JMC from this on going problem.  It seems none has an answer so far.

JMC Please help.
JMC
XXX

JMC I tried to run the script directly from cron like:

JMC * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name

JMC I also tried to run cron in the bash environment by writing a bash
JMC script that calls my PHP script.  I set cron you call the bash
script
JMC every minute. The bash script contained the following information:

JMC  START SCRIPT
JMC =
JMC #!/usr/local/bin/bash
JMC /path/to/PHP/script/file_name
JMC = END SCRIPT
JMC ==

JMC If I run the bash script from the command line it definitely runs
my PHP
JMC script. I know this because my PHP script sends me an email. 

JMC Also, if I run my PHP script from the command line it also runs
fine and
JMC I receive an email.  However, anytime I try to run PHP script or
the
JMC bash script from cron nothing happens.  I get no emails.  I also
know
JMC cron is working properly because a regular bash script as I listed
in my
JMC earlier posting works fine.

JMC This is using the new CLI that come with PHP 4.3 I have in past
versions
JMC of used the CGI from cron with no problems at all.  As a matter of
fact
JMC I have another server that does all its maintenance via PHP scripts
that
JMC get ran by cron

JMC Here is the PHP CLI cron script I am testing to see if cron will
run my
JMC PHP

JMC  START SCRIPT
JMC =
JMC #!/usr/local/bin/php -q
JMC ?

JMC mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i
a));

?
JMC = END SCRIPT
JMC ==
 

JMC Any more suggestions would be greatly appreciated.

JMC Justin

JMC -Original Message-
JMC From: CodersNightMare [mailto:[EMAIL PROTECTED] 
JMC Sent: Friday, February 28, 2003 10:32 AM
JMC To: [EMAIL PROTECTED]
JMC Subject: RE: [PHP] Can't run PHP cli script from Cron


JMC I am sure you have tried this, but,
JMC Do you call the full path to php for cron.

JMC something like:

JMC 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript

JMC Hope this helps.


JMC At 10:10 AM 2/28/2003 -0800, you wrote:
The path is

#!/usr/local/bin/php -q

But like I said, that can't be the problem because when I run it from
the command line, it runs fine.  The only problem I am having is that
JMC it
won't run from cron.  That is why I think it is an issue with the cron
environment.  All other types of scripts like bash scripts run fine
JMC from
cron.  I am surprised no one else has come across this problem before.

Please help me!

  Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com


-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:44 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

Shouldn't it be
#!/usr/local/bin/php

Or was it just a typo here?

- Original Message -
From: Justin Michael Couto [EMAIL PROTECTED]
To: 'Ernest E Vogelsinger' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 12:09 PM
Subject: RE: [PHP] Can't run PHP cli script from Cron


  I can run it from the shell prompt perfectly fine.  I just won't
run
  from cron.
 
  I do have the statement:
 
  #!/usr/local/php
 
  In the beginning of my script.  Like I said it works perfect when I
run
  it by hand from the shell prompt.  I think the reason it is not
running
  has to do with the cron environment, but I am not ssure what it is.
 
  Justin Michael Couto[EMAIL PROTECTED]
  Director of Operations  805.781.0420
  Somnio World Web Solutions  http://www.somnioworld.com
 
 
  -Original Message-
  From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 28, 2003 12:55 AM
  To: Justin Michael Couto
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Can't run PHP cli script from Cron
 
  At 05:30 28.02.2003, Justin Michael Couto said:
  [snip]
  Here is my crontab entry:
  
  * * * * * /path/to/file

RE: [PHP] Can't run PHP cli script from Cron

2003-02-28 Thread Justin Michael Couto
I can run it from the shell prompt perfectly fine.  I just won't run
from cron.  

I do have the statement:

#!/usr/local/php

In the beginning of my script.  Like I said it works perfect when I run
it by hand from the shell prompt.  I think the reason it is not running
has to do with the cron environment, but I am not ssure what it is.

Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com
 

-Original Message-
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 12:55 AM
To: Justin Michael Couto
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

At 05:30 28.02.2003, Justin Michael Couto said:
[snip]
Here is my crontab entry:
 
* * * * * /path/to/file/file_name.php
 
I also have 
 
* * * * * /path/to/file/bash_test_script
[snip] 

Did you try to run the php file interactively, from the shell prompt?

You need at last this statement on top of your PHP files:
#!/usr/local/php


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Can't run PHP cli script from Cron

2003-02-28 Thread Justin Michael Couto
The path is 

#!/usr/local/bin/php -q

But like I said, that can't be the problem because when I run it from
the command line, it runs fine.  The only problem I am having is that it
won't run from cron.  That is why I think it is an issue with the cron
environment.  All other types of scripts like bash scripts run fine from
cron.  I am surprised no one else has come across this problem before.

Please help me!

 Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com
 

-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 9:44 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

Shouldn't it be 
#!/usr/local/bin/php 

Or was it just a typo here?

- Original Message - 
From: Justin Michael Couto [EMAIL PROTECTED]
To: 'Ernest E Vogelsinger' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 12:09 PM
Subject: RE: [PHP] Can't run PHP cli script from Cron


 I can run it from the shell prompt perfectly fine.  I just won't run
 from cron.  
 
 I do have the statement:
 
 #!/usr/local/php
 
 In the beginning of my script.  Like I said it works perfect when I
run
 it by hand from the shell prompt.  I think the reason it is not
running
 has to do with the cron environment, but I am not ssure what it is.
 
 Justin Michael Couto[EMAIL PROTECTED]
 Director of Operations  805.781.0420
 Somnio World Web Solutions  http://www.somnioworld.com
  
 
 -Original Message-
 From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] 
 Sent: Friday, February 28, 2003 12:55 AM
 To: Justin Michael Couto
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Can't run PHP cli script from Cron
 
 At 05:30 28.02.2003, Justin Michael Couto said:
 [snip]
 Here is my crontab entry:
  
 * * * * * /path/to/file/file_name.php
  
 I also have 
  
 * * * * * /path/to/file/bash_test_script
 [snip] 
 
 Did you try to run the php file interactively, from the shell prompt?
 
 You need at last this statement on top of your PHP files:
 #!/usr/local/php
 
 
 -- 
O Ernest E. Vogelsinger
(\)ICQ #13394035
 ^ http://www.vogelsinger.at/
 
 
 
 -- 
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Can't run PHP cli script from Cron

2003-02-28 Thread Justin Michael Couto

I tried to run the script directly from cron like:

* * * * * /usr/local/bin/php -q /path/to/cron/script/file_name

I also tried to run cron in the bash environment by writing a bash
script that calls my PHP script.  I set cron you call the bash script
every minute. The bash script contained the following information:

 START SCRIPT
=
#!/usr/local/bin/bash
/path/to/PHP/script/file_name
= END SCRIPT
==

If I run the bash script from the command line it definitely runs my PHP
script. I know this because my PHP script sends me an email. 

Also, if I run my PHP script from the command line it also runs fine and
I receive an email.  However, anytime I try to run PHP script or the
bash script from cron nothing happens.  I get no emails.  I also know
cron is working properly because a regular bash script as I listed in my
earlier posting works fine.

This is using the new CLI that come with PHP 4.3 I have in past versions
of used the CGI from cron with no problems at all.  As a matter of fact
I have another server that does all its maintenance via PHP scripts that
get ran by cron

Here is the PHP CLI cron script I am testing to see if cron will run my
PHP

 START SCRIPT
=
#!/usr/local/bin/php -q
?

mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i a));

?
= END SCRIPT
==
 

Any more suggestions would be greatly appreciated.

Justin

-Original Message-
From: CodersNightMare [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 28, 2003 10:32 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Can't run PHP cli script from Cron


I am sure you have tried this, but,
Do you call the full path to php for cron.

something like:

40 * * * * /usr/local/bin/php -q /home/user/phpcliscript

Hope this helps.


At 10:10 AM 2/28/2003 -0800, you wrote:
The path is

#!/usr/local/bin/php -q

But like I said, that can't be the problem because when I run it from
the command line, it runs fine.  The only problem I am having is that
it
won't run from cron.  That is why I think it is an issue with the cron
environment.  All other types of scripts like bash scripts run fine
from
cron.  I am surprised no one else has come across this problem before.

Please help me!

  Justin Michael Couto[EMAIL PROTECTED]
Director of Operations  805.781.0420
Somnio World Web Solutions  http://www.somnioworld.com


-Original Message-
From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:44 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Can't run PHP cli script from Cron

Shouldn't it be
#!/usr/local/bin/php

Or was it just a typo here?

- Original Message -
From: Justin Michael Couto [EMAIL PROTECTED]
To: 'Ernest E Vogelsinger' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 12:09 PM
Subject: RE: [PHP] Can't run PHP cli script from Cron


  I can run it from the shell prompt perfectly fine.  I just won't run
  from cron.
 
  I do have the statement:
 
  #!/usr/local/php
 
  In the beginning of my script.  Like I said it works perfect when I
run
  it by hand from the shell prompt.  I think the reason it is not
running
  has to do with the cron environment, but I am not ssure what it is.
 
  Justin Michael Couto[EMAIL PROTECTED]
  Director of Operations  805.781.0420
  Somnio World Web Solutions  http://www.somnioworld.com
 
 
  -Original Message-
  From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
  Sent: Friday, February 28, 2003 12:55 AM
  To: Justin Michael Couto
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Can't run PHP cli script from Cron
 
  At 05:30 28.02.2003, Justin Michael Couto said:
  [snip]
  Here is my crontab entry:
  
  * * * * * /path/to/file/file_name.php
  
  I also have
  
  * * * * * /path/to/file/bash_test_script
  [snip]
 
  Did you try to run the php file interactively, from the shell
prompt?
 
  You need at last this statement on top of your PHP files:
  #!/usr/local/php
 
 
  --
 O Ernest E. Vogelsinger
 (\)ICQ #13394035
  ^ http://www.vogelsinger.at/
 
 
 
  --
  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 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can't run PHP cli script from Cron

2003-02-27 Thread Justin Michael Couto
I am trying to run a PHP CLI script from cron using PHP 4.3 and FreeBSD
5.0
 
This is what I have verified:
 
My clock is set right
I can run bash scripts from cron
I have tried running the script as root and as other users
If I run the PHP CLI script by had it works fine
I set cron to run the script every minute just to make sure I am doing
my cron tab right
 
Here is my crontab entry:
 
* * * * * /path/to/file/file_name.php
 
I also have 
 
* * * * * /path/to/file/bash_test_script
 
which contains the following information
 
ls -l  /path/to/file/holder/file_results.txt
 
With every passing minute the bash script gets run and file
file_results.txt get another ls appendied to it
 
On the other hand, Nothing happens with the PHP script.  Inside the php
script I have it emailing me using the php mail() funtction.  If I run
this script by hand I get an email from the script.  If I run the script
by cron everyminute I get nothing when I should be getting a email every
minute.  
 
I hope someone can help me with this.