I've looked at how composer is set up to run a php script by calling composer
without issuing php
manually and I tried to do this myself but it isn't working. I know this is probably asked before but I can't formulate a question to find it.
I have my file
#!/usr/bin/php
<?php
echo 'teststring' . PHP_EOL;
when I issue test
in the directory the file is located I get nothing, but if I do php test
then I get "teststring" echoed out. The question is - how do I set it up so that I can execute the file directly?
I have given x
permissions on the file.
Here is a sample output:
x@y:~/www/html/dev/Project$ ls
...
-rwxrwxr-x 1 www-data www-data 53 сеп 22 12:34 test
...
x@y:~/www/html/dev/Project$ test
x@y:~/www/html/dev/Project$ php test
teststring
x@y:~/www/html/dev/Project$ which php
/usr/bin/php
x@y:~/www/html/dev/Project$