Insights

Running PHP file with crontab on 1and1

Over the last few weeks I’ve tried everything to get a simple cron job test running on 1and1 dedicated linux hosting. Although the test PHP file would run fine in the browser and again run fine from a SSL command it just would not run from crontab. All I kept getting was a “Could not open input file:” error.

I tried making sure the path to the php CLI/CGI/Executable was correct but that made no difference. I added #!/usr/bin/php to the top of the php file, still no joy. I tried adding the -q and -f commands, still nothing. I changed file permission, nowt. Everytime it ran it just gave the same “Could not open input file:” error until this morning I wanted to try and track everything that was happening when crontab tried to run the php script so I ended up trying to write the output to a cron.log file. The first thing I did was add an extra bit to the crontab entry that would save to the log file like this…


>> /home/######/cron.log

And suddenly it just worked! So, to make that clear, this wasn’t working…


45 1 * * * /usr/bin/php /home/#####/public_html/system/application/views/ImportRSS.php

But this did work…


45 1 * * * /usr/bin/php /home/#####/public_html/system/application/views/ImportRSS.php >> /home/######/cron.log

For some reason adding the log file entry after the script path got it going. Maybe crontab was expecting it to log something and without the reference to the log file it wasn’t running. Who knows. I’m just glad its working and hopefully this will save someone the hours and hours I’ve wasted over such a simple solution.

Got a question about
your website?

Ask anything — pricing, timelines, a slow site, a broken plugin. You’ll get a straight answer.

Prefer a person? Book a 20-minute call or ring 01227 860815

Insights

Straight answers for business owners.

All insights

October 21, 2026

Effective Design Strategies for Kent Businesses

Why Effective Design is Crucial for Kent Businesses In today’s competitive market, effective design plays a pivotal role in shaping brand identity and fostering trust. A well-crafted visual identity can set a business apart…