Jump to content

Recommended Posts

Posted (edited)

Right now I have cron job for running some php script from a not password protected folder with next command:

 

/usr/bin/php -q /home/cpanel_name/public_html/folder_not_protected/script.php > /dev/null

 

What should I change in the command line if the folder where the php file is placed would be password protected?

 

Thank you in advance

Edited by msdan
Posted

If you don't want anyone to be able to access the script.php file place it in a root folder (same level as public_html) then change your cron job to read.

 

>/usr/bin/php -q /home/cpanel_name/folder-you-create/script.php > /dev/null

 

That should be all you need to do.

  • 1 month later...
Posted

I am trying to do the exact same thing, I set it to email me the output and this is what I receive in the email.

 

>Status: 404
Content-type: text/html

No input file specified.

 

This is what the file I'm trying to run does:

 

><?php
// Load Site.
$page = fopen("http://www.itrytoloadawebsite.com/", "r");
fclose($page);
?>

 

Could the output I am receiving be the output from this script or is it an error with the cron tab?

Posted

I went ahead and added:

> /dev/null

 

to the end of the command that would run, I don't get an email anymore, however, I don't know if it is working or not.

Posted (edited)

Well, the script just loads another site. The reason being that the server where I have the other site doesn't have a cron tab. I put phpCron on the other site, but that still requires that the page be loaded in order for that cron to run. The solution I am using is really sloppy, but until the other site is moved to a server, like Total Choice which allows cron tabs, this is the only solution I have.

 

The phpCron on the other site works, and what it does is check which users have something scheduled for that day and sends them an email reminder in the middle of the night.

Edited by spadin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...