Title: PHP Warning: Undefined array key &#8220;REQUEST_METHOD&#8221; &#8211; WP-Cron via PHP CLI
Last modified: July 16, 2026

---

# PHP Warning: Undefined array key “REQUEST_METHOD” – WP-Cron via PHP CLI

 *  [Kingyyyy](https://wordpress.org/support/users/kingyyyy/)
 * (@kingyyyy)
 * [5 days, 19 hours ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method-wp-cron-via-php-cli/)
 * Hi,
 * I’ve come across what appears to be a CLI compatibility issue with WPS Hide Login.
 * When running WordPress cron directly via PHP CLI, the following warning is generated:
   
   PHP Warning: Undefined array key “REQUEST_METHOD” in /wp-content/plugins/wps-
   hide-login/vendor/composer/autoload_real.php on line 59
 * My environment:
    - WordPress: Latest
    - WPS Hide Login: Latest
    - PHP-FPM: 8.2
    - PHP CLI: 8.2.32
    - Ubuntu 22.04 LTS
 * To reproduce: /usr/bin/php8.2 /var/www/example.com/wp-cron.php
   The cron completes,
   but this warning is displayed:`PHP Warning: Undefined array key "REQUEST_METHOD"`
   This appears to happen because `$_SERVER['REQUEST_METHOD']` is not defined when
   WordPress is executed via the PHP CLI, whereas it is always available during 
   normal web requests.
 * Running WP-Cron via HTTP (e.g. `curl https://example.com/wp-cron.php?doing_wp_cron`)
   works without any warnings.
 * Would it be possible to guard against the absence of `$_SERVER['REQUEST_METHOD']`
   when running under the CLI, for example by checking `PHP_SAPI === 'cli'` or using`
   isset($_SERVER['REQUEST_METHOD'])` before accessing it?
 * This would improve compatibility for sites that execute WP-Cron directly via 
   PHP CLI.
 * Thank you!

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-undefined-array-key-request_method-wp-cron-via-php-cli%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/wps-hide-login/assets/icon-256x256.png?rev=1820667)
 * [WPS Hide Login](https://wordpress.org/plugins/wps-hide-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wps-hide-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wps-hide-login/)
 * [Active Topics](https://wordpress.org/support/plugin/wps-hide-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wps-hide-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wps-hide-login/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [Kingyyyy](https://wordpress.org/support/users/kingyyyy/)
 * Last activity: [5 days, 19 hours ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method-wp-cron-via-php-cli/)
 * Status: not resolved