Title: PHP Warning: Undefined array key &#8220;REQUEST_METHOD&#8221;
Last modified: December 26, 2022

---

# PHP Warning: Undefined array key “REQUEST_METHOD”

 *  Resolved [colinhrt](https://wordpress.org/support/users/colinhrt/)
 * (@colinhrt)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/)
 * Hello
 * I am running the latest WordPress on Apache 2.4 with PHP 8.1. I had the wordpress
   wp-cron.php file being called by a wget run by the host servers cron, with ‘DISABLE_WP_CRON’
   set true in the wp-config.php file, this was working fine.
 * I then decided to run the wp-cron.php directly from the servers cron file with
   a line like ‘cd /var/www/site.tld/www; php /var/www/site.tld/www/wp-cron.php’
   This runs the wp-cron.php but now I get a warning every time it runs
 * PHP Warning: Undefined array key “REQUEST_METHOD” in /var/www/site.tld/www/wp-
   content/plugins/pretty-link/app/controllers/PrliAppController.php on line 33
 * I guess this is something to do with not calling it via a http request, and running
   wp-cron.php like this is something of an edge case. Whilst this Warning is not
   a problem as such it is an irritation and puts unnecessary noise in the log files.

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

 *  [Skrlance](https://wordpress.org/support/users/seanlance/)
 * (@seanlance)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16325887)
 * Use PHP 8.0! Most plugins, themes and WordPress itself isn’t ready yet for PHP
   8.1. It is good to ask for support but I suggest also run your website on local
   and check every month with Query Monitor plugin if your website doesn’t throw
   error when using Php 8.1. If you don’t see any error or warnings then move to
   Php 8.1!!
 *  Thread Starter [colinhrt](https://wordpress.org/support/users/colinhrt/)
 * (@colinhrt)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16326519)
 * I just tried installing PHP 8.0.
 * PHP 8.0.26 (cli) (built: Dec 5 2022 21:59:43) ( NTS )
   Copyright (c) The PHP GroupZend
   Engine v4.0.26, Copyright (c) Zend Technologieswith Zend OPcache v8.0.26, Copyright(
   c), by Zend Technologies
 * And I see the same warning when running this, it does like when being run from
   the command line the PrettyLinks plugin is not handling the missing REQUEST_HEADER
   variable nicely.
 *  Thread Starter [colinhrt](https://wordpress.org/support/users/colinhrt/)
 * (@colinhrt)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16326529)
 * I have just tried this with PHP 7.4
 * PHP 7.4.33 (cli) (built: Nov 8 2022 11:36:34) ( NTS )
   Copyright (c) The PHP GroupZend
   Engine v3.4.0, Copyright (c) Zend Technologieswith Zend OPcache v7.4.33, Copyright(
   c), by Zend Technologies
 * And there is no warning then, so it seems it is something that came in with PHP
   8.0, possibly PHP 8.0 is being more strict or something.
 *  [Tyler](https://wordpress.org/support/users/tylerthedude/)
 * (@tylerthedude)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16339108)
 * Hi Colin,
 * This warning is something that our development team is aware of and are hoping
   to get fixed soon. In the meantime, you should be able to prevent that notice
   from occurring by editing the PrliAppController.php file located under wp-content/
   plugins/pretty-link/controllers/ and then on line 33 replace this line:
   `if($
   _SERVER["REQUEST_METHOD"] == 'GET' && !is_admin()) {`With this line:`if(isset(
   $_SERVER['REQUEST_METHOD']) && $_SERVER["REQUEST_METHOD"] == 'GET' && !is_admin()){`
   Kind regards,
 *  [Tyler](https://wordpress.org/support/users/tylerthedude/)
 * (@tylerthedude)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16355363)
 * Hi Colin,
 * I just wanted to follow up on this thread and let you know that we’ve released
   a new version of Pretty Links that includes a fix for this warning, so if you
   haven’t already please upgrade to this version (3.3.0) and the warning will no
   longer be logged going forward.
 * Kind regards,
 *  Thread Starter [colinhrt](https://wordpress.org/support/users/colinhrt/)
 * (@colinhrt)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16355632)
 * Thank you for that. I have tried the WordPress Cron job on PHP 7.4, 8.0, 8.1,
   8.2 with the updated Pretty Links Plugin installed and it works fine now with
   no warning messages.
 * Regards
 * Colin

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

The topic ‘PHP Warning: Undefined array key “REQUEST_METHOD”’ is closed to new replies.

 * ![](https://ps.w.org/pretty-link/assets/icon-256x256.png?rev=2503434)
 * [PrettyLinks - Affiliate Links, Link Branding, Link Tracking, Marketing and Stripe Payments Plugin](https://wordpress.org/plugins/pretty-link/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pretty-link/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pretty-link/)
 * [Active Topics](https://wordpress.org/support/plugin/pretty-link/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pretty-link/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pretty-link/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [colinhrt](https://wordpress.org/support/users/colinhrt/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/php-warning-undefined-array-key-request_method/#post-16355632)
 * Status: resolved