Is it possible to execute from crontab a php file inside a folder which is protected with 开发者_如何学Chtaccess and how?
.htaccess
is a way to limit access from outside (the Internet) and is enforced by the apache
. So there's nothing preventing the crontab
to run the script.
I believe crontab can execute any of your scripts. .htaccess just plays over your web access so it should not stop crontab from executing it.
No. If htaccess is set to deny access from the web it will prevent any web based method from accessing it. Running wget or curl from the commandline is just the same as accessing it in a browser and htaccess will stop it.
You can restrict access to the page with an authentication scheme and make the cron script authenticate and then it will work, but if htaccess is denying access, you can't access it.
It is possible to run php from the commandline without accessing from the web but it's iffy, here's a link that describes how to do it.
i've a .htaccess protected area and use a cronjob created via Plesk.
you have to call your url with the php script. Try this:
http://username:password@www.yourDomain.com/protected_area/YourScript.php
username and password are your desired data for .htaccess
hope it helps.
精彩评论