Web lists-archives.com

Re: [PHP] cli script




On Sun, Jan 14, 2018 at 8:47 PM, Yeni Setiawan <yenisetiawan@xxxxxxxxx>
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@xxxxxxxxxxx>
> 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.