Title: Undefined array key “REQUEST_METHOD“
Last modified: January 27, 2022

---

# Undefined array key “REQUEST_METHOD“

 *  Resolved [ajtatum](https://wordpress.org/support/users/ajtatum/)
 * (@ajtatum)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-key-request_method/)
 * Whenever the cron job runs (which is called via crontab using php8 command line
   and not wget or curl), the following error gets logged:
 * Error (E_WARNING): “Undefined array key “REQUEST_METHOD““ at `./wp-content/plugins/
   wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:130`.
 * Just to clarify this is the line in my crontab file:
    */5 * * * * /usr/bin/php8.0/
   var/www/mysite.com/public/wp-cron.php >> /dev/null 2>&1

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-key-request_method/#post-15300902)
 * Hi [@ajtatum](https://wordpress.org/support/users/ajtatum/),
    huh! that is wired.
   Looked at the code of `wp-cloudflare-super-page-cache.php` on line no `130`. 
   So, that error is coming because when you are running the cron job for some reason`
   $_SERVER['REQUEST_METHOD']` does not exist. So, inside a if block we are checking
   if the request is GET request and to do that we are doing `strcasecmp($_SERVER['
   REQUEST_METHOD'], 'GET') == 0`.
 * But when you are running the cron job, for some reason the `$_SERVER` array does
   not have request method in it. Can you look further into why it is happening?
   As I am also running PHP 8 along with this plugin on many sites and have not 
   seen this issue.
 *  Thread Starter [ajtatum](https://wordpress.org/support/users/ajtatum/)
 * (@ajtatum)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-key-request_method/#post-15302707)
 * Could it be because of how I’m calling wp-cron since it’s not via a request (
   wget or curl)?
 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-key-request_method/#post-15310532)
 * It maybe. Hav4e you tried setting up the corn via WP CLI?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Undefined array key “REQUEST_METHOD“’ is closed to new replies.

 * ![](https://ps.w.org/wp-cloudflare-page-cache/assets/icon-256x256.gif?rev=3234997)
 * [Super Page Cache – Cloudflare Cache, Page Speed & Core Web Vitals](https://wordpress.org/plugins/wp-cloudflare-page-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cloudflare-page-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/reviews/)

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [cronjob](https://wordpress.org/support/topic-tag/cronjob/)
 * [crontab](https://wordpress.org/support/topic-tag/crontab/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 3 replies
 * 2 participants
 * Last reply from: [iSaumya](https://wordpress.org/support/users/isaumya/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/undefined-array-key-request_method/#post-15310532)
 * Status: resolved