aeroswat Posted March 29, 2010 Share Posted March 29, 2010 Here is what the host inserts automatically for my cron job whenever i create one php -f /home/a1925824/ after that I type in the remaining path to the file i want to put in so that the full path would look something like this php -f /home/a1925824/public_html/crons/job.php and then there are several boxes i can use to set the time i want the script to execute. So I type that in and set the time to every 5 minutes of every hour of every day of every month. However my cron job does not execute. I am assuming this is because I set the crons directory to be password protected. How can I set this cron job so it works with username and password required. Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/ Share on other sites More sharing options...
aeroswat Posted March 29, 2010 Author Share Posted March 29, 2010 Can I get some help? Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033704 Share on other sites More sharing options...
the182guy Posted March 29, 2010 Share Posted March 29, 2010 I'd remove the password protection from the directory and use another way of protecting the cron scripts like by checking the clients IP. You might also be able to move your cron scripts outside of the public httpdocs. Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033706 Share on other sites More sharing options...
aeroswat Posted March 29, 2010 Author Share Posted March 29, 2010 I'd remove the password protection from the directory and use another way of protecting the cron scripts like by checking the clients IP. You might also be able to move your cron scripts outside of the public httpdocs. Ya I tried that. I think it's because my require_once call inside of the php file is using a relative path. I'm attempting to change that right now but I'll let everyone know what happens. If anyone could help me in the mean time I'd appreciate that too Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033711 Share on other sites More sharing options...
the182guy Posted March 29, 2010 Share Posted March 29, 2010 I'd remove the password protection from the directory and use another way of protecting the cron scripts like by checking the clients IP. You might also be able to move your cron scripts outside of the public httpdocs. Ya I tried that. I think it's because my require_once call inside of the php file is using a relative path. I'm attempting to change that right now but I'll let everyone know what happens. If anyone could help me in the mean time I'd appreciate that too If you're having problems with require_once() and relative paths, just use the full path e.g. require_once('/home/a1925824/public_html/includes/myinclude.php'); Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033718 Share on other sites More sharing options...
aeroswat Posted March 29, 2010 Author Share Posted March 29, 2010 Ya I did use the full path. My cron now works Thanks Btw is there any way to make this a little more friendly? To simulate a relative path? Is it possible to do something that will automatically find its way to there? Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033720 Share on other sites More sharing options...
the182guy Posted March 29, 2010 Share Posted March 29, 2010 Usually there is an initialisation script where the web application root is defined so that you don't need to use the full path everywhere. For example DEFINE('BASE_PATH', '/home/a1925824/public_html/'); then in any of your files which use the init script you can just include like require_once(BASE_PATH . 'includes/something.php'); Link to comment https://forums.phpfreaks.com/topic/196895-cron-job-in-password-protected-directory/#findComment-1033731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.