I’m trying to execute a php script via command line like:
"php -f test.php"
I first tried some serverside socket programming and now just tried a minimal example with test.php only containing the line
What I expect would be the output on the cli “test” but the php command only echos the file content on the command line, showing: ‘echo “test”;’ instead of executing the command echo. Same for my socket programming
I also tried using #!/usr/bin/php and make the script executable (chmod 755) giving the same result.
output of whereis php:
php: /usr/bin/php /usr/bin/php7.0 /usr/lib/php /etc/php
I tried this independently on my server and my laptop (Ubuntu and Xubuntu, both have php7.0 and especially php7.0-cli installed). I must be doing something very basic wrong… however, in this tutorial nothing is stated what I could do differently: