在 linux/apache 服务器上的 cron 作业上运行 script.php,但限制对 php 文件的公共访问
我有这个 script.php 文件,我想在我的 linux/apache 服务器上将其作为 cron 作业运行.
I have this script.php file which i want to run as a cron job on my linux/apache server.
但是,我不希望公众访问 www.mycompanyname.com/script.php 并同时运行脚本.
However, i do not want public to access www.mycompanyname.com/script.php and also run the script concurrently.
我们如何防止这种情况发生?我们如何限制脚本只能访问服务器?是使用 chmod 还是在 .htaccess 文件中设置了一些东西?
How can we prevent that? How can we restrict the script to the server's access only? Is it using chmod or setting something inside .htaccess file, something along the line?
有什么建议吗?
推荐答案
您可能有一个类似于 public_html
的目录,其中包含所有 php.把它放在那个目录之外.
You probably have something like a public_html
directory, in which you have all the phps. Just put it outside of that directory.
相关文章