Cronjob PHP script in password protected directory

Status
Not open for further replies.

duitsescanner84

New Member
Messages
3
Reaction score
0
Points
0
Hello.

I am new to cronjobs, but I would like to use it to ran a script.
The 'update.php' is in a password(Username & Password) protected directory.

What would be to correct command to run this?
The file is located in:
/public_html/hax/zitrostats/update/(update.php)

Thanks for letting me host on your site and thanks for your help :)
Greets Marijn.
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
If you have password protected the directory through .htaccess then it will not affect how you run the script as the authentication takes place within the webserver layer. Therefore, all you need to do is add a cron job like so:
"/usr/bin/php /public_html/hax/zitrostats/update/update.php"
 

duitsescanner84

New Member
Messages
3
Reaction score
0
Points
0
Thanks for your quick reply :)

I dont use .htacces, but I used the "With password protected directories" from x10's cPanel. I made an account and a password for it.

I tried your sollution, but it doesn't seem to work :(

Thanks :)
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
/usr/bin/php /home/igor/public_html/hax/zitrostats/update/update.php
 >>/home/igor/public_html/cron_log.txt 2>&1

where you replace 'igor' with your cpanel account name.

that way, any output or error messages will be written to cron_log.txt to help you find problems/verify it is running.
 

duitsescanner84

New Member
Messages
3
Reaction score
0
Points
0
Thanks for your reply.

The Cron_log gives:

PHP: Error parsing /usr/local/lib/php.ini on line 786
X-Powered-By: PHP/5.2.17
Pragma: no-cache
Expires: 0
Content-type: text/plain


And underneath it gives the content of update.php. Seems it worked?! :D

I will test it a bit more right now, but I think it is fixed.
Thnx for your help :)
Let me get back to you within an hour :)
Greets Marijn
_________________________________
It works :D
Thanks for your help guys :D
Greets :)
 
Last edited:
Status
Not open for further replies.
Top