Title: Syntax error
Last modified: November 3, 2022

---

# Syntax error

 *  Resolved [Mario62rus](https://wordpress.org/support/users/mario62rus/)
 * (@mario62rus)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/)
 * Hello.
    The plugin v2.2.1 is installed on my website and in WordPress logs I 
   see the PHP Parse error: syntax error, unexpected ‘?’ in /public_html/wp-content/
   object-cache.php on line 1242. The following code is written in this line: },
   $tx->{$method}() ?? [] ); How to fix this error?

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

 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16161571)
 * What PHP version are you on?
 *  Thread Starter [Mario62rus](https://wordpress.org/support/users/mario62rus/)
 * (@mario62rus)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16161595)
 * 7.4.25
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16161674)
 * Are you sure you’re not running `5.6`?
 * Can you post your diagnostics from Settings > Redis > Diagnostics?
 * This snippet fails on PHP 5.6, but works on PHP 7.4:
 *     ```
       <?php
   
       class Test123 {
         public function test() {
           return 'hello';
         }
       }
   
       $method = 'test';
   
       $tx = new Test123;
   
       var_dump($tx->{$method}() ?? []);
       ```
   
 *  Thread Starter [Mario62rus](https://wordpress.org/support/users/mario62rus/)
 * (@mario62rus)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16161848)
 * Diagnostics from Settings > Redis > Diagnostics:
 *     ```
       Status: Подключено
       Client: PhpRedis (v5.0.2)
       Drop-in: Valid
       Disabled: No
       Ping: 1
       Errors: []
       PhpRedis: 5.0.2
       Relay: Not loaded
       Predis: Not loaded
       Credis: Not loaded
       PHP Version: 7.4.25
       Plugin Version: 2.2.1
       Redis Version: 6.2.4
       Multisite: No
       Metrics: Enabled
       Metrics recorded: 2038
       Filesystem: Working
       Global Prefix: "wp_"
       Blog Prefix: "wp_"
       Global Groups: [
           "blog-details",
           "blog-id-cache",
           "blog-lookup",
           "global-posts",
           "networks",
           "rss",
           "sites",
           "site-details",
           "site-lookup",
           "site-options",
           "site-transient",
           "users",
           "useremail",
           "userlogins",
           "usermeta",
           "user_meta",
           "userslugs",
           "redis-cache",
           "blog_meta"
       ]
       Ignored Groups: [
           "counts",
           "plugins",
           "themes"
       ]
       Unflushable Groups: []
       Groups Types: {
           "blog-details": "global",
           "blog-id-cache": "global",
           "blog-lookup": "global",
           "global-posts": "global",
           "networks": "global",
           "rss": "global",
           "sites": "global",
           "site-details": "global",
           "site-lookup": "global",
           "site-options": "global",
           "site-transient": "global",
           "users": "global",
           "useremail": "global",
           "userlogins": "global",
           "usermeta": "global",
           "user_meta": "global",
           "userslugs": "global",
           "redis-cache": "global",
           "counts": "ignored",
           "plugins": "ignored",
           "themes": "ignored",
           "blog_meta": "global"
       }
       Drop-ins: [
           "advanced-cache.php v by ",
           "Redis Object Cache Drop-In v2.2.1 by Till Krüss"
       ]
       ```
   
    -  This reply was modified 3 years, 7 months ago by [Mario62rus](https://wordpress.org/support/users/mario62rus/).
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16162205)
 * Is one of your CLI processes running 5.6?
 * How often are you seeing the `Parse error`?
 *  Thread Starter [Mario62rus](https://wordpress.org/support/users/mario62rus/)
 * (@mario62rus)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16162250)
 * > Is one of your CLI processes running 5.6?
 * I find it difficult to answer. I run a PHP script on the hosting using the shell_exec
   command. I think that it is at such moments that a failure occurs.
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16162427)
 * That would be the culprit then.
 * `echo shell_exec('php --version')`
 *  Thread Starter [Mario62rus](https://wordpress.org/support/users/mario62rus/)
 * (@mario62rus)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16164469)
 * You were right. The shell_exec() command runs under the old PHP version. To run
   this command under a new version of PHP, you need to do it like this:
    `shell_exec("/
   usr/local/bin/php7.4 path_to_script" );`
 * Thanks
 *  [thangtin](https://wordpress.org/support/users/thangtin/)
 * (@thangtin)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16290804)
 * My site got the same error. Can you help me fix it?
    This error happens very 
   often.

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

The topic ‘Syntax error’ is closed to new replies.

 * ![](https://ps.w.org/redis-cache/assets/icon-256x256.gif?rev=2568513)
 * [Redis Object Cache](https://wordpress.org/plugins/redis-cache/)
 * [Support Threads](https://wordpress.org/support/plugin/redis-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/redis-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redis-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redis-cache/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [thangtin](https://wordpress.org/support/users/thangtin/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/syntax-error-225/#post-16290804)
 * Status: resolved