Cronjob and Apache folder denial

I have .htaccess that blocks everybody access to a certain folder. Within this certain folder I’d like to create a PHP file that needs to be called every day by cronjob. Will such .htaccess prevent execution of this file by server itself? Or can server cronjob it bypass it?

It should be OK.
It is quite normal to have PHP scripts and includes in locations that outside visitors are forbidden to access, but the server itself is able to access its own folders.

2 Likes

You may also be able to place the folder above the root which will put it out of reach of the website visitors and you will not need to .htaccess it.

1 Like

The .htaccess file will only restrict the webserver to serve requests to this folder, nothing more.

And your cronjobs should be able to run PHP files in this folder if your target user has the permissions to read and execute them.

Actually most quick way will be just try and check :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.