XILO Community Forum

Support 0845 034 6444 • Sales 0800 084 2421

Go Back   XILO Community Forum > Customer Support > Support Queries > shebang for php5
Support Queries This forum should be used to contact XILO's support team should you have any problems with your account.

Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Reseller
apricotweb is on a distinguished road
 
Posts: 20
Join Date: Dec 2006
Location: York, UK
Default shebang for php5 - 01/12/2007, 5:11 PM

I am trying to run a php5 script from crontab on one of your cpanel reseller boxes. The script needs to run in php5. What shebang should I use or how would I go about this?

Thanks
Reply With Quote
  (#2 (permalink)) Old
XILO Staff
Matt is on a distinguished road
 
Matt's Avatar
 
Posts: 690
Join Date: Nov 2005
Default Re: shebang for php5 - 01/12/2007, 5:40 PM

Hi,

Do you already have a standard PHP shebang? If so, replace 'php' with 'php5'

Matt


XILO Communications Ltd.
Internet Hosting and Online Services
w: http://www.xilo.net/
h:
http://my.xilo.net/
t: +44 (0) 845 034 6444
f: +44 (0) 845 034 6555
Reply With Quote
  (#3 (permalink)) Old
Reseller
apricotweb is on a distinguished road
 
Posts: 20
Join Date: Dec 2006
Location: York, UK
Default Re: shebang for php5 - 07/12/2007, 6:35 PM

Hi Matt

I'm afraid it wasn't as simple as that. There wasn't an alias in /bin. After allot of trail and error I discovered it was:

Code:
#!/usr/local/php5/bin/php5
It is almost all working nicely now. I am just getting this in my error logs every time the script runs.

[07-Dec-2007 18:23:01] PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0
Reply With Quote
  (#4 (permalink)) Old
User
arnoldkrg is on a distinguished road
 
Posts: 5
Join Date: Jul 2007
Default Re: shebang for php5 - 11/02/2008, 11:38 AM

I just thought I would post an addition to this thread in case it is useful to anyone else. I am writing a script to read and process text in incoming emails. In order to do this I am piping the incoming mail to a script written in php5 (which is now standard on my host server....Indigo)

Here is the pipe:

|/home/username/script_directory/nameofscript.php

I initially used the following shebang line in the script:

#!/usr/bin/php

This worked and the email was received by the script and was processed.

However, a bounce message was sent to the originator of the email. Obviously not desirable since the message was actually forwarded to and received by the script.

Changed the shebang line to the following:

#!/usr/bin/php -q

the -q switch suppresses the bounce message and allows the piped email to be processed silently.

Hope this saves someone else a bit of time.
Reply With Quote
  (#5 (permalink)) Old
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 769
Join Date: Apr 2006
Location: Swindon, UK
Default Re: shebang for php5 - 11/02/2008, 1:04 PM

Quote:
Originally Posted by arnoldkrg View Post
However, a bounce message was sent to the originator of the email. Obviously not desirable since the message was actually forwarded to and received by the script.

Changed the shebang line to the following:

#!/usr/bin/php -q

the -q switch suppresses the bounce message and allows the piped email to be processed silently.
Good call there; that is exactly what you are supposed to do when you are running a script blind (no user will be present to see output and so output is not required). This switch is also useful for those running PHP scripts via a cron job.

Thanks for sharing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP5 on shared hosting solaris Support Queries 1 18/10/2007 7:14 AM
Php5 Matt Comments and Suggestions 6 20/07/2006 11:51 PM


Powered by vBulletin | XHTML | © Copyright 2003-2008 XILO Communications Ltd. All rights reserved. E&OE