Title: php error
Last modified: June 4, 2023

---

# php error

 *  Resolved [amslps](https://wordpress.org/support/users/amslps/)
 * (@amslps)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/)
 * WordPress version 6.1.2
   Active theme: Astra Child Theme (version 1.0)PHP version
   8.1.19
 * FastCGI sent in stderr: “PHP message: PHP Warning:  Array to string conversion
   in /usr/share/nginx/wordpress/wp-content/plugins/seo-by-rank-math/includes/opengraph/
   class-image.php on line 606PHP message: PHP Warning:  Array to string conversion
   in /usr/share/nginx/wordpress/wp-content/plugins/seo-by-rank-math/includes/opengraph/
   class-image.php on line 606” while reading response header from upstream,
 * Can you fix on this?

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/php-error-595/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/php-error-595/page/2/?output_format=md)

 *  Thread Starter [amslps](https://wordpress.org/support/users/amslps/)
 * (@amslps)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16796341)
 * Where is the support???? The error continue to promote. Can you fix on the next
   release????
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16799451)
 * Hello [@amslps](https://wordpress.org/support/users/amslps/),
 * Thank you for contacting us, and sorry for any inconvenience that might have 
   been caused due to that.
 * From the error code, this happens when the shop or archive page is not able to
   fetch the image from the first post/product of that archive to set it as the 
   og:image.
 * Please make sure that all the custom post types on the website have a fallback
   thumbnail for Facebook under **WordPress Dashboard > Rank Math > Titles & Meta**
   Settings to get rid of this warning.
 * Also, please note that this is simply a warning, so it won’t cause any issues
   with the normal functionality of the website, but it won’t include the metadata
   property.
 * Moreover, please check your wp-config.php file to see if the debug log is set
   to display the error. If so, you can disable it so the error will not be displayed
   on your shop page:
   [https://wordpress.org/support/article/debugging-in-wordpress/](https://wordpress.org/support/article/debugging-in-wordpress/)
 * Looking forward to helping you.
 *  Thread Starter [amslps](https://wordpress.org/support/users/amslps/)
 * (@amslps)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16799702)
 * Hello,
 * Can you elaborate the point – ‘Please make sure that all the custom post types
   on the website have a fallback thumbnail for Facebook under **WordPress Dashboard
   > Rank Math > Titles & Meta** Settings to get rid of this warning.’
 * I went to **Titles & Meta** that seems nowhere to set the a fallback thumbnail
   for Facebook?
 * Can you help me on this??
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16802870)
 * Hello [@amslps](https://wordpress.org/support/users/amslps/),
   You should see 
   something similar to this on the path of the setting we mentioned previously:
   [https://i.rankmath.com/i/3GllkU](https://i.rankmath.com/i/3GllkU)Hope this helps
   solve your issues.Don’t hesitate to get in touch if you have any other questions.
 *  Thread Starter [amslps](https://wordpress.org/support/users/amslps/)
 * (@amslps)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16808078)
 * Hi, I had upload facebook opengraph thumbnail image as fallback according to 
   your guide, but I still got the error
 * FastCGI sent in stderr: “PHP message: PHP Warning:  Array to string conversion
   in /usr/share/nginx/wordpress/wp-content/plugins/seo-by-rank-math/includes/opengraph/
   class-image.php on line 606PHP message: PHP Warning:  Array to string conversion
   in /usr/share/nginx/wordpress/wp-content/plugins/seo-by-rank-math/includes/opengraph/
   class-image.php on line 606
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/php-error-595/#post-16812761)
 * Hello [@amslps](https://wordpress.org/support/users/amslps/),
 * The solution worked for many of our users. Since it’s not working yet for you,
   please try clearing your site, plugin, or any server-level cache to see if that
   works for you.
 * If the issue persists, then** assuming you are using the latest version of all
   the plugins and the themes (please update if not yet)**, it would seem like a
   conflict with one of the plugins or themes you are using.
 * To determine that, please follow this troubleshooting guide:
   [https://rankmath.com/kb/check-plugin-conflicts/](https://rankmath.com/kb/check-plugin-conflicts/)
 * Here is a video you can follow as well:
   [https://www.youtube.com/watch?v=FcIWRhcUP2c&ab_channel=RankMathSEO](https://www.youtube.com/watch?v=FcIWRhcUP2c&ab_channel=RankMathSEO)
 * **Only the site admin would know, and your users won’t be affected by this troubleshooting.**
 * We really look forward to helping you.
 *  [Monirul](https://wordpress.org/support/users/dealmega/)
 * (@dealmega)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/php-error-595/#post-17038939)
 * This tips is not working..
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/php-error-595/#post-17040301)
 * Hello [@dealmega](https://wordpress.org/support/users/dealmega/),
 * Can you please share a screenshot of the error message you see from your end?
 * Preferably, please share your debugging log with the timestamp included so we
   can check when the last time the error message was recorded.
 * Lastly, please head over to your WordPress Dashboard > Rank Math > Status & Tools
   > Database Tools and click on the button “Remove Transients” and see if that 
   improves the situation.
 * Looking forward to helping you.
 *  [Jacopo Marrone (@tresorama)](https://wordpress.org/support/users/tresorama/)
 * (@tresorama)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-error-595/#post-17094175)
 * I’ve installed the plugin and this errors showed in archive page of a CPT.
   Doing
   debug the exception is due to this scenario
 *     ```wp-block-code
       // in /plugins/seo-by-rank-math/includes/opengraph/class-image.php 
       // line  602
   
       /**
          * Check if archive has an image and add this image.
          */
         private function set_archive_image() {
   
          // NOTE: 
          // request url: "my-site.com/my-cpt"
          // this url is the post archive page of "my-cpt"
   
           $post_type = get_query_var('post_type');
   
           // In my case, and i don't know why the returned value 
           // of "get_query_var" is not a string but an array of string 
           // $post_type = [ "my-cpt" ]
           // 
   
           // because of this in the next line (👇)
           // string interpolation  will fail
           // and trigger the exception "array to string conversion..." 
           //
           $image_id  = Helper::get_settings("titles.pt_{$post_type}_facebook_image_id");
           $this->add_image_by_id($image_id);
         }
       ```
   
 * I modified the code like this and it works
 *     ```wp-block-code
       private function set_archive_image() {
           $post_type = get_query_var('post_type');
   
           // sometimes "post_type" returns array of string 
           // instead of string
           if (is_array($post_type)) $post_type = $post_type[0];
   
           $image_id  = Helper::get_settings("titles.pt_{$post_type}_facebook_image_id");
           $this->add_image_by_id($image_id);
         }
       ```
   
 * But until you don’t include the same in the plugin code i cannot update it
    -  This reply was modified 2 years, 7 months ago by [Jacopo Marrone (@tresorama)](https://wordpress.org/support/users/tresorama/).
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-error-595/#post-17098353)
 * Hello [@tresorama](https://wordpress.org/support/users/tresorama/),
 * The `get_query_var` function should not return the post_type in array format.
   Please check if a plugin conflict is causing the issue: [https://rankmath.com/kb/check-plugin-conflicts/](https://rankmath.com/kb/check-plugin-conflicts/)
 * If the issue persists, please share the `register_post_type` function for the
   CPT showing this error.
 * Looking forward to helping you.
 *  [Jacopo Marrone (@tresorama)](https://wordpress.org/support/users/tresorama/)
 * (@tresorama)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-error-595/#post-17098802)
 * I used ACF to register CPT.
 * this is the JSON
 *     ```wp-block-code
       {
           "key": "post_type_64dea13278e29",
           "title": "Experiences",
           "menu_order": 0,
           "active": true,
           "post_type": "bookable-tour",
           "advanced_configuration": true,
           "import_source": "",
           "import_date": "",
           "labels": {
               "name": "Experiences",
               "singular_name": "Experience",
               "menu_name": "Experiences",
               "all_items": "All Experiences",
               "edit_item": "Edit Experience",
               "view_item": "View Experience",
               "view_items": "View Experiences",
               "add_new_item": "Add New Experience",
               "add_new": "",
               "new_item": "New Experience",
               "parent_item_colon": "Parent Experience:",
               "search_items": "Search Experiences",
               "not_found": "No experiences found",
               "not_found_in_trash": "No experiences found in Trash",
               "archives": "Experience Archives",
               "attributes": "Experience Attributes",
               "featured_image": "",
               "set_featured_image": "",
               "remove_featured_image": "",
               "use_featured_image": "",
               "insert_into_item": "Insert into experience",
               "uploaded_to_this_item": "Uploaded to this experience",
               "filter_items_list": "Filter experiences list",
               "filter_by_date": "Filter experiences by date",
               "items_list_navigation": "Experiences list navigation",
               "items_list": "Experiences list",
               "item_published": "Experience published.",
               "item_published_privately": "Experience published privately.",
               "item_reverted_to_draft": "Experience reverted to draft.",
               "item_scheduled": "Experience scheduled.",
               "item_updated": "Experience updated.",
               "item_link": "Experience Link",
               "item_link_description": "A link to a experience."
           },
           "description": "",
           "public": true,
           "hierarchical": false,
           "exclude_from_search": false,
           "publicly_queryable": true,
           "show_ui": true,
           "show_in_menu": true,
           "admin_menu_parent": "",
           "show_in_admin_bar": true,
           "show_in_nav_menus": true,
           "show_in_rest": true,
           "rest_base": "",
           "rest_namespace": "wp\/v2",
           "rest_controller_class": "WP_REST_Posts_Controller",
           "menu_position": "",
           "menu_icon": "",
           "rename_capabilities": false,
           "singular_capability_name": "post",
           "plural_capability_name": "posts",
           "supports": [
               "title",
               "excerpt",
               "revisions",
               "thumbnail"
           ],
           "taxonomies": "",
           "has_archive": true,
           "has_archive_slug": "",
           "rewrite": {
               "permalink_rewrite": "post_type_key",
               "with_front": "1",
               "feeds": "0",
               "pages": "1"
           },
           "query_var": "post_type_key",
           "query_var_name": "",
           "can_export": true,
           "delete_with_user": false,
           "register_meta_box_cb": "",
           "modified": 1695644506
       }
       ```
   
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathteam/)
 * (@rankmathteam)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/php-error-595/#post-17104967)
 * Hello [@tresorama](https://wordpress.org/support/users/tresorama/),
   We tried 
   to reproduce the issue on our setup with the JSON you shared but we are still
   getting the value from the `get_query_var` in string format.What we would ask
   is that you make a conflict test with only Rank Math, ACF, and a default theme
   and test the same.If that doesn’t help pinpoint the culprit please open a ticket
   in our forums so we can evaluate this further. To open a ticket you can follow
   the procedure here: [https://rankmath.com/kb/getting-support/](https://rankmath.com/kb/getting-support/)
   Thank you.
 *  [Sylvester](https://wordpress.org/support/users/sylwesterpresta/)
 * (@sylwesterpresta)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-595/#post-17413621)
 * **Quick-fix in `wp-config.php`**
 * The easiest way to hide those warnings and notices is to disable error reporting
   in the `wp-config.php` file:
 *     ```wp-block-code
       ini_set('display_errors','Off');
       ini_set('error_reporting', E_ALL );
       define('WP_DEBUG', false);
       define('WP_DEBUG_DISPLAY', false);
       ```
   
 *  Plugin Support [Rank Math Support](https://wordpress.org/support/users/rankmathsupport/)
 * (@rankmathsupport)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-595/#post-17417077)
 * Hello [@sylwesterpresta](https://wordpress.org/support/users/sylwesterpresta/),
 * Thank you for reaching out to our support.
 * We appreciate your suggestion with regard to hiding the warning.
 * Don’t hesitate to get in touch with us if you have any other questions.
 *  [loganless](https://wordpress.org/support/users/loganless/)
 * (@loganless)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-595/#post-17460183)
 * [@rankmathsupport](https://wordpress.org/support/users/rankmathsupport/) I get
   the same error on the **custom posts search page**. An example is [this page](https://www.ironmanager.academy/?post_type=guide&s=glutei)
   where get_query_var returns an array as a result:
 *     ```wp-block-code
       ["guide"]=> string(5) "guide"
       ```
   
 * The solution indicated by [@tresorama](https://wordpress.org/support/users/tresorama/)
   was only partially correct (the array also uses the custom post type slug as 
   an index and does not use a numeric value). To resolve the warning you need to
   add the following code before line 606:
 *     ```wp-block-code
       if ( is_array($post_type) ) $post_type = reset( $post_type );
       ```
   
 * which extracts the custom post type slug.

Viewing 15 replies - 1 through 15 (of 22 total)

1 [2](https://wordpress.org/support/topic/php-error-595/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/php-error-595/page/2/?output_format=md)

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

 * ![](https://ps.w.org/seo-by-rank-math/assets/icon.svg?rev=3438330)
 * [Rank Math SEO – AI SEO Tools to Dominate SEO Rankings](https://wordpress.org/plugins/seo-by-rank-math/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/seo-by-rank-math/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/seo-by-rank-math/)
 * [Active Topics](https://wordpress.org/support/plugin/seo-by-rank-math/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/seo-by-rank-math/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/seo-by-rank-math/reviews/)

 * 22 replies
 * 8 participants
 * Last reply from: [Rank Math Support](https://wordpress.org/support/users/rankmathsupport/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/php-error-595/page/2/#post-18179976)
 * Status: resolved