简体   繁体   中英

Ban direct access to a php file but not for cron job

I have a php file that sends curl and saves the data in the database, and I need to run this script daily, but I want only cron job to execute that PHP file, not anybody else.
I could use a piece of advice.
Thanks

Assuming linux, if it's in your home dir and you are the owner, and you didn't chmod 777 it, it should be okay.

If your questions is how to prevent people from opening the php file externally from the browser, don't place it in /var/html or whatever your webserver directory is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM