Issue
Ubuntu 20 running on WSL, PHP 7.4
I am trying to debug code but cannot seem to get any output from the script. To replicate:
myfile.php
<?php
echo "output text";
called from the terminal with
php myfile.php
The script runs but returns nothing.
Solution
You are trying to do int in right way. You can tell php to execute a file like the following:
php myfile.php
... or
php -f myfile.php
You can check the following two things.
- First one is that make sure you have installed php cli.
- In your script try to put that line #!/usr/bin/php on very top of the file. So your file will looks like the following:
#!/usr/bin/php
<?php
echo "output text";
Hope that helps you or at least gives you a right direction.
Answered By - ovanes_budakyan Answer Checked By - Senaida (WPSolving Volunteer)