• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Schedule a Task-every 10 minutes: Fetch a URL 'https://site.com/folder/cron.php' fetched Status: 404 Output: File not found.

MoL

New Pleskian
Hello

I'm a beginner, I've been looking for solutions on the net, but I haven't succeeded

I rented the server recently. OS Ubuntu 18.04.5 LTS , Plesk Obsidian Version 18.0.32 i have a site
The company does not offer support.


I have sheduled task a domain:

Fetch a URL : https://site.com/folder/cron.php/

This URL (php script) works perfectly whith a browser.


But when i use the sheduled task, i have an error :

"
Task "https://site.com/folder/cron.php" completed with error in 0 seconds, output:

Url 'https://site.com/folder/cron.php' fetched
Status: 404
Output:
File not found.

"
the file is in:

/var/www/vhosts/site.com/httpdocs/folder/cron.php (same: File not found)

I tried several commands found on the net, but also can't find the file (File not found)

On the server crontab file, i have:

A) In file for site: /var/spool/cron/crontabs , I have no Path. I don't think it's normal, do I?

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/opt/psa/tmp/sssY3Y4RF installed on Sun Jan 10 06:48:03 2021)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
MAILTO=""
SHELL="/bin/sh"
10 * * * * /usr/bin/php -f '/var/www/vhosts/site.com/httpdocs/_cron/cron.php'

B) In the file for root: /etc/crontab , i have

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

I read on the internet that it is good to add the command. in the root file.

Can someone help me please ?
Ps: I have no experience. I searched the internet and found out more. I am an industrial programmer
but I still know something from college .

Thanks a lot :)
 
Hi all,
I'm resurrecting this old(ish) one because I have the exact same problem as OP on Plesk 18.0.47.

I have a website with a few scripts that are used as a cron job. And all of those are "404 not found". Doesn't matter if I use curl or wget or direct cron job in plesk via "Fetch URL".
Although all of them can be opened via browser, so there are no typos in URL.
And website is working OK if visited with browser - no problems there. The only problem is 404 not found if I try to fetch any URL of the website directly from server (cron job or via SSH terminal) via curl/wget/FetchURL.

On another website (same server, different domain) all is ok. Crons are found and working normally.

It's doing my head in for a few days now and I can't find the solution.

The only thing left that I'm curious about is that maybe the following got something to do with it:
1. The website domain that cron jobs are OK and accessible is NOT the same as full hostname on the plesk server.
2. The website domain that cron jobs are all 404 not found is the SAME as a full hostname on the server.

Can this be a problem? If yes, then how can I fix it?

Anyone has any idea about this?
Would be very much appreciated.
 
No ideas from anyone? Seems like a strange one.
One more info of interest is that I have the same configuration (same domain and full hostname) for the same project on a different server with older Plesk version and things are working perfectly, so I do believe it's a Plesk problem.

A workaround I found (for now) for those struggling with this issue. The only way I can actually run PHP script from cron tab in this situation is to use "Run a PHP script" option (and make sure you use full path to the script!).
This seems to be working ok now.
But I would still like to figure this one out, so ... any plesk geniuses out there willing to tackle this one? :)
 
If you haven't already, I'd would examine (and try to disable) any htaccess files and any additional apache and ngnix directives set for the domain. Second thing that comes to mind is that there might be something in the host file of your server that routes requests elsewhere. So examine your servers host file too.
 
If you haven't already, I'd would examine (and try to disable) any htaccess files and any additional apache and ngnix directives set for the domain. Second thing that comes to mind is that there might be something in the host file of your server that routes requests elsewhere. So examine your servers host file too.
I tried to remove htaccess files completely. Didn't make a difference.
I checked host file, but... don't really know what I'm looking for to be honest. And if there would be problem with host file, wouldn't that reroute all normal (through browser) traffic too then? Also, I never touched host file. I got server via the automatic LAMP + Plesk install and the modified date on the file is the date of the auto-system installation.
It's really strange this, everything works perfectly fine (web site). Only when you try to wget or curl any script/file from that domain (and only that domain - others work ok), you get 404 not found. Same as to what OP wrote.
If you try to access any of the scripts (or the web site itself) through browser, there are no problems at all. That's why I'm so puzzled.

Is it possible that the problem is connected to the fact that the "full hostname" for the server (you need to input that during the LAMP+Plesk install) is the same as this domain?

Oh, there are no additional Apache or Nginx directives entered - I checked again to be sure.
 
I checked host file, but... don't really know what I'm looking for to be honest.
Usually the host file only contains an entry with the host name of your server (and sometimes a separate localhost entry). So you'd be looking for anything other than that, but specifically for an entry that contains the (troubled) domain name. However since you stated that your domain name is the same as your servers host name, it's expected to have a entry containing the domain name.

And if there would be problem with host file, wouldn't that reroute all normal (through browser) traffic too then
On your own computer, yes. On your server, no.

Is it possible that the problem is connected to the fact that the "full hostname" for the server (you need to input that during the LAMP+Plesk install) is the same as this domain?
I am not sure, but I suppose it could be. Might be worth trying to change your servers hostname to something different. (In general it's recommended to use a sub domain as hostname for a server. Like server.example.com instead of just example.com).
 
Last edited:
Usually the host file only contains an entry with the host name of your server (and sometimes a separate localhost entry). So you'd be looking for anything other than that, but specifically for an entry that contains the (troubled) domain name. However since you stated that your domain name is the same as your servers host name, it's expected to have a entry containing the domain name.


On your own computer, yes. On your server, no.


I am not sure, but I suppose it could be. Might be worth trying to change your servers hostname to something different. (In general it's recommended to use a sub domain as hostname for a server. Like server.example.com instead of just example.com).
OK, thanks for the help. Much appreciated.

One last question. I did think about changing the server hostname, but after Googling, there are numerous warnings that Plesk might get "broken" and that server could start behaving strangely if you do that.
Is there any chance of Plesk/server problems if I change the hostname from www.example.com to server.example.com ?

I ask because, as I mentioned, I already have 1 live site on the server on different domain.
 
Changing your hostname should not cause any issues if you follow the steps in the documentation. Don't forget to create a DNS record for your new hostname. Of course an issue can always arise, so it's recommended to make a backup (either with the Plesk Backup manager or as a snapshot of your server instance).
 
If you use wget/lynx/curl/... from the shell, what IP does it say it connects to? The real IP or 127.0.0.1?
 
Back
Top