cron job does not work in cpanel - cron

I have put this command line in Cpanel cronjob
/usr/local/bin/php -q /public_html/myfolder/directory/admin/cron.php
and got this error
Could not open input file: /public_html/myfolder/directory/admin/cron.php
I have checked, the file is there in the folder. This is basically a script that sends a login
reminder to every member of the MySQL database. The script runs successfully if I launch it from the URL in browser.

Use full path:
php -q /home/username/public_html/myfolder/directory/admin/cron.php
Or simply use get the URL :
GET http://example.com/myfolder/directory/admin/cron.php

Related

Permission Denied with crontab

I try to execute a script (on my personal pc, Linux Mint) who execute two other scripts who launch two servers (one script for a Symfony server and one for a webpack server) using cron. So I put this line inside my crontab
#reboot /usr/local/bin/launchFm.sh 2>&1 ~/Documents/script/errorcron
inside ~/Documents/script/errorcron file I got this line
Unable to init server: Impossible de se connecter : Connexion refusée
Yeah I'm french but it's basically connection denied.
I can execute this script by manullay and it works fine. Also, I tried to execute a dummy script inside the crontab like #reboot touch test, and this work perfectly fine. I have no cron.deny or cron.allow file.
I got this permission for the /usr/local/bin/launchFm.sh -rwxr-xr-x and I'm the owner. So everybody got the x(execute) permission. The error says Unable to init server but I got nothing inside the error log of the script who launch server so I think the problem is the crontab permission but basic script work fine so I'm very confuse
I solved it by calling the two scripts instead of calling the script who execute the two "subscript". It's not elegant but it work.

How to set cron in cakephp in cpanel on linux server

How do i set the cron command in Cpanel in Linux server i use this it works for me is there any proper way
wget http://www.vloghit.com/crons/send_mail
You should use the full path for wget like /usr/bin/wget instead of just plain wget. Depending on the WHM server configuration the crons might be running as jailed so you might get an error stating that wget command was not found if you do not use the full path to the binary. You are also supposed to receive an email notification from that cron job. Are you geting it? I'm asking because in those email notifications you get also an error message that can help you to understand why the cron was not working.

cPanel cron job, no input file specified?

I've just set up my first cron-jon to run a stock script every night.
Running it manually works fine.
It's stored in /admin/stock_update.php
The command i'm running is /usr/bin/php -q /admin/stock_update.php
But I'm getting emails saying no input file is specified?
Any ideas?
Cheers
Network services almost never expose actual paths on the server's hard disk drive and even if they could it isn't a behaviour you can rely on. So the fact that your file is located at /admin/stock_update.php in the FTP server doesn't say much about actual location on disk, which is what local command-line utilities expect.
In PHP, you can find path on disk of current file with the __FILE__ magic constant. You can create a test script:
<?php
var_dump(__FILE__);
... upload it to the same FTP location and execute through the web server. If that's not an option because files in your FTP account in not visible from the web you can run the file from cron and check the email.
Do you have CloudLinux kernel installed on that server and CageFS filestyem? If yes try running this:
cagefsctl -w cpaneluser; cagefsctl -m cpaneluser
Then try running the cron again

Cronjob won't execute on 1and1 server

I have 1and1 web hosting. I am supposed to be able to set up cron jobs using crontab to execute on the server. I have a job set up as follows (including showing the full path to my PHP installation):
(uiserver):u*******:~ > which php5.4
/usr/local/bin/php5.4
(uiserver):u*******:~ > crontab -l
20 * * * * /usr/local/bin/php5.4 /kunden/homepages/40/d*******/htdocs/job.php
If I execute the command manually in the terminal, it runs fine. But the cron job never runs.
Am I missing something obvious?
I've tried checking the cron logs, but I just get permission denied, unfortunately, so that was no help for troubleshooting. The joys of being on somebody else's server, I guess...

Setting PATH environmental variables permanently Centos Web Panel Install... Works from SSH, not Webpage

My zip function isn't working when being called from a php script, but works straight from the SSH prompt.
code in the PHP file that returns nothing var_dump( exec('zip -r domains.zip "domains"') );
code in the php file which works as expected var_dump( exec('/usr/bin/zip -r domains.zip "domains"') );
I've added the path to /etc/profile, I've added it to my ~/.bashrc but can't get the web user to be able to use it.
I'm new to this and it's a VPS so I'm not sure where to go from here.
Ensure that permissions are adequate on the files being accessed - you want to ensure that the user accessing them is able to execute them.

Resources