I have a php script which I want to run only from the command prompt, and want it to be blocked over HTTP. How should I do it?
What I have tried:
define('CLI_SCRIPT', true);
It did not help me a lot, was still able to open the file.
Adding to .htaccess:
DENY FROM ALL
It blocks the file from all source, even from the command prompt.
I cannot place it outside the public_html. I don't have access to other folders of the server.
curl http://example.com/script.php
, in which case you should just be doingphp script.php
.