I wrote a cron script and included at the top

require_once('/home/cli6951n3/domains/mydomain.com/public_html/wp-load.php');

In wp-config.php I added this line:

define('DISABLE_WP_CRON', true);

As result I get a huge amount of errors. See text below. A lot plugins and the Themes are mentioned in the error reports.
How can I solve this?

PHP Notice: Undefined index: SERVER_PORT in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1536

Notice: Undefined index: SERVER_PORT in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1536 PHP Notice: Undefined index: SERVER_NAME in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1537

Notice: Undefined index: SERVER_NAME in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1537 PHP Notice: Undefined index: SERVER_PORT in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1537

Notice: Undefined index: SERVER_PORT in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/wpFastestCache.php
on line 1537 PHP Notice: Undefined index: HTTP_HOST in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/inc/cache.php
on line 177

Notice: Undefined index: HTTP_HOST in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/wp-fastest-cache/inc/cache.php
on line 177 PHP Notice: Undefined index: HTTP_HOST in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/minimal-coming-soon-maintenance-mode/framework/public/init.php
on line 38

Notice: Undefined index: HTTP_HOST in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/minimal-coming-soon-maintenance-mode/framework/public/init.php
on line 38 PHP Warning: Cannot modify header information – headers
already sent by (output started at
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/rdp-plugin/rdp-plugin.php:1)
in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada-Child-Theme/functions.php
on line 13

Warning: Cannot modify header information – headers already sent by
(output started at
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/plugins/rdp-plugin/rdp-plugin.php:1)
in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada-Child-Theme/functions.php
on line 13 PHP Notice: Undefined index: REMOTE_ADDR in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada/includes/avadaredux/avadaredux-framework/AvadaReduxCore/inc/class.avadaredux_helpers.php
on line 69

Notice: Undefined index: REMOTE_ADDR in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada/includes/avadaredux/avadaredux-framework/AvadaReduxCore/inc/class.avadaredux_helpers.php
on line 69 PHP Notice: Undefined index: REMOTE_ADDR in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada/includes/avadaredux/avadaredux-framework/AvadaReduxCore/inc/class.avadaredux_helpers.php
on line 69

Notice: Undefined index: REMOTE_ADDR in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada/includes/avadaredux/avadaredux-framework/AvadaReduxCore/inc/class.avadaredux_helpers.php
on line 69 PHP Notice: Undefined index: REMOTE_ADDR in
/home/cli6951n3/domains/mydomain.com/public_html/wp-content/themes/Avada/includes/avadaredux/avadaredux-framework/AvadaReduxCore/inc/class.avadaredux_helpers.php
on line 69

1 Answer
1

You’re getting Undefined index errors because you’re loading the files directly and not rendered through the server. The server typically populates those values and it’s actually more secure to run with less elevated privileges (through an HTTP request).

Throw your manual cron to a curl or wget — whichever you have installed on your server.

curl -s -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64)" http://YourWebsiteURL.com/wp-cron.php?doing_wp_cron

OR

wget -O /dev/null http://www.YourWebsiteURL.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

This should trigger your cron and with www privileges instead of server root access.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *