Centos 7 Crontab

Hello Guys ,
i Installed Nextcloud 23 On Centos 7
PHP 7.4
i Facing Problem With Crontab , how can i Make it work ?!
i set user apache for apache and i changed “chown” to apache
Thanks u Guys

sudo -u apache crontab -e

and in crontab
" */5 * * * * php -f /var/www/nextcloud/cron.php" Or Need to change something ?
and How can i testing it

You might need an absolute path to the php executable.
-f parameter is not needed.

In nextcloud web interface, go to settings → Administration → Basic settings and see beside “Background jobs” should be a green dot and saying “Last job ran _____ ago”. Hover over that and it should tell you the exact time of last run.

absolute path of PHP in etc u men?
and i need to change permission of cron.php?

You seem like you’re pretty new to this.

Absolute path means including the full location within the filesystem to the executable. The apache user, which has to run the cronjob, may not have a PATH variable set up telling it where to find common binary executables.

So in your cron, instead of */5 * * * * php -f /var/www/nextcloud/cron.php you will need something more like */5 * * * * /usr/bin/php /var/www/nextcloud/cron.php — but you will have to verify the correct path yourself.

1 Like

i Success to Get it accept cron.php
By " */5 * * * * php /var/www/nextcloud/cron.php "
i Checked it With " sudo -u apache php /var/www/nextcloud/cron.php"
but i got error of memcache idk i set it on config.php but idk why tell me this

Bytheway i was working on ubuntu im new in centos try to figure where is store file like php.ini cuz its different from ubuntu to centos :smiley:
Thanks for Helping

You should consider centos as pretty much dead now actually. Since redhat acquired it, they’ve changed it from being a downstream of RHEL to being an UPSTREAM, lying somewhere in between Fedora and RHEL. Its basically a more “experimental” version of RHEL now as of version 8. Your centos 7, while it is still a downstream distro from RHEL7, is getting a bit long of tooth and you should think about upgrading soon, especially if your server isn’t finalized yet.

The replacement for it that you should be considering is Rocky Linux. Rocky Linux 9 is a downstream of RHEL 9.

Now regarding the php.ini, I can’t speak for centos 7, but in Rocky Linux 8, you would be looking in /etc/php.d/ and /etc/php-fpm.d/

1 Like

Thanks :slight_smile: For info
so Rocky linux 8 is now better then centos 7,8 ?! u men
so need to move From centos to it Or Back to ubuntu ?!

Rocky Linux 9 is the current version that I would use for new installs. I haven’t done any installs of it yet though, it came out just a couple of weeks ago.

I would NEVER use ubuntu.

1 Like

cron.php does NOT need to be executable.
The file needs to be readable by the apache user.

so i need to back normal ? Right

I don’t know. You need to look at your filesystem and figure out what’s going on.

1 Like

Good Morning , Thanks For Help
i Got it Work :slight_smile: Centos 7
thnx
By Edit /etc/php.ini Add at end " apc.enable_cli=1"
And Enable " apc.enable_cli=1" in " /etc/php-zts.d/40-apcu.ini"
:slight_smile: