Re: cli script

From: Date: Mon, 15 Jan 2018 02:08:33 +0000
Subject: Re: cli script
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-326352@lists.php.net to get a copy of this message
> On Jan 14, 2018, at 6:00 PM, Aziz Saleh <azizsaleh@gmail.com> wrote: > > On Sun, Jan 14, 2018 at 8:47 PM, Yeni Setiawan <yenisetiawan@gmail.com> > wrote: > >> Hi Jeff, >> >> Have you chmod-ed your cli script into executable? (chmod +x filename.php). >> >> After chmod it, you can call it by using command like: >> >> server# ./BTO.php >> >> Don't forget to add shebang line on your cli file that refer to php >> executable file location. >> >> On Mon, Jan 15, 2018 at 8:40 AM, Jeffry Killen <jekillen@prodigy.net> >> wrote: >> >>> Hello; >>> >>> I have a cli script and I want to run it as root. >>> >>> So I run "sh-3.2#BTO.php" when pwd is the directory >>> containing the BTO.php script file. >>> >>> The cli script resides in a server document root dir. It is >>> for changing ownership to server user for specific named files. >>> >>> I am informed that "BTO.php: command not found" >>> >>> I don't do this often enough to be on top of the problem/solution >>> >>> But I don't remember having this problem in the past. >>> I have copied the document root dir and contents and installed the >>> copies in another servers document root. Then I run this cli as root >>> to change all the permissions to server user on new server. >>> >>> There are no phantom spaces in the name and O is not 0 (zero) in >>> the name, or vis versa. >>> >>> Any other possibilities? >>> >>> Thanks for time and attention; >>> Jeff K >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> -- >> regards, >> >> Yeni Setiawan >> http://sandalian.com >> > > What is your first line of the PHP file? Does it contain the location to > PHP executable binary (ex: #!/usr/bin/php)? If not you would need to run > the php file as /usr/bin/php BTO.php. I should have included that: #!/usr/bin/php -f <?php // ... etc ?> ... O.K. this may not be the location of the php executable on Mac OSX. I think I may have originally written it for a server on a FreeBSD system. Thank you for time and attention Jeff K

« previous php.general (#326352) next »