S
S
Sergey2018-11-18 19:47:25
PHP
Sergey, 2018-11-18 19:47:25

PHP source code output when trying to run it via Cron. What to do?

Available Ubuntu 16.04 Server + LEMP. It is required to run the script.php script from the /usr/share/nginx/html/script.php directory every 2 minutes.
I start ssh and write crontab -e and add the line

*/2 * * * * php /usr/share/nginx/html/script.php > /usr/share/nginx/html/log.txt 2>&1

As a result, the script.php source code is displayed in the logs, I decided to try /usr/bin/php, a similar situation.
When calling php /usr/share/nginx/html/script.php and /usr/bin/php /usr/share/nginx/html/script.php in the ssh console, the sources are also displayed instead of executing the file.
PHP installed 7.2.12 Can
you please tell me what is wrong and why is this happening?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-11-18
@goodwin74

Console puff and puff for web server have different configs.
Run php --ini in the console and see what needs to be edited.
ps short tags are evil.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question