D
D
Dmitry Bondarchuk2020-11-27 06:12:52
PHP
Dmitry Bondarchuk, 2020-11-27 06:12:52

Why does a php script run through cron work differently than a script run in the web interface?

I have a php script that downloads archives from FTP and unpacks them. If I run through the web interface, then the script works like clockwork, but through cron I get messages that the archive cannot be downloaded from FTP.

I can not understand what the problem is, and how to find out why the file is not downloading.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
ThunderCat, 2020-11-27
@scotch18

For cli and web environments, usually different php.ini are used, just look at phpinfo() from the web and from the console to see the difference in settings.

As an option, pull the script with cron via wget. Get it on the web
If you don't restrict requests to this URL by ip/key/port or otherwise, you run the risk of getting a DDoS hole.

R
res2001, 2020-11-27
@res2001

Miscellaneous environment: the user under which the script is running (something may not be available), environment variables (especially PATH)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question