Forum Moderators: coopster

Message Too Old, No Replies

php script in cron

         

kkonline

4:49 am on Jun 10, 2008 (gmt 0)

10+ Year Member



dear all,
I have written a php script to send newsletter to all the members in db, Now i want to run the same script after every hour in order to send mails in small chunks so it does distribute the load equally.

what shud be the permission of the file as if i write php -q /home/mysite/public_html/news/send.php in crontab if gives a permission not allowed

Basically it is a php code with <?php ... ?> which needs to be run after every hour

eelixduppy

2:13 pm on Jun 10, 2008 (gmt 0)



What are the permissions for that file now?

amnesia440

6:31 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



I am going to be doing a similar thing....

If the file that sends the email is send.php, what would the perms of send.php have to be so it's not accessible via browser. Would it be chmodded to 600 ?

I realize that you can do other checks to make sure this doesn't happen, but just curious.

Also - would it be possible to put the send.php file out of a web accessible directory? OR would that defeat the purpose?

eelixduppy

6:43 pm on Jun 10, 2008 (gmt 0)



>> Also - would it be possible to put the send.php file out of a web accessible directory

This is what I would do if you are never going to need to access the script directly. Command line scripts should be kept out of the web root.

amnesia440

7:50 pm on Jun 10, 2008 (gmt 0)

10+ Year Member



So if the script is outside of the web directory (ie...outside of the public_html folder) it will send mail?

kkonline

7:41 am on Jun 11, 2008 (gmt 0)

10+ Year Member



the file is chmoded to 644 and all are absolute paths inside the includes of the script and in the cpanel i wrote

/usr/local/bin/php /home/path/to/script/simple.php

and it worked fine :)

eelixduppy

1:21 am on Jun 12, 2008 (gmt 0)



>> it will send mail?

It should.