title: Execute a PHP file with Cron ONLY
body: <p>I've got a PHP script that needs to be executed once a day, at 3:05am Pacific time.  I've currently got the script in the root of my site (as in, <a href="http://example.com/script.php" rel="nofollow noreferrer">http://example.com/script.php</a>), and as such, it's executable by anyone who navigates to it in their browser.  My server is laid out like this:</p>
  
  <p><strong>/home/[user]/example.com/</strong></p>
  
  <p>Where the <em>example.com</em> folder is the root of that domain.  I read the other thread about this:</p>
  
  <p><a href="https://stackoverflow.com/questions/4387569/php-cron-security-issues">PHP &amp; cron: security issues</a></p>
  
  <p>where it was said that I should move the script outside the public directory, so in my case I would move it to the <em>[user]</em> folder.  Currently my Cron job command looks like this:</p>
  
  <p><strong>/usr/local/php5/bin/php /home/[user]/example.com/script.php</strong></p>
  
  <p>(I'm using pseudo-names of course.)  Would I simply move the file and change the command to:</p>
  
  <p><strong>/usr/local/php5/bin/php /home/[user]/script.php</strong></p>
  
  <p>And it would run normally, yet be unavailable to the public?  Since the script is already running through Cron, it's already set up using absolute paths (instead of relative ones) to the files that it needs to include, so this should be a simple move and edit, right?</p>