Pro pHp Version

Hi Support,

I have several sites using Pro and was wondering the recommended pHp Version?

My SG Optimiser is flagging Pro as incompatible with pHp 7.1

Could you advise on the recommended version in running Pro and X?

Please see detailed error attached.

Hello Jay,

Thanks for asking. :slight_smile:

As of now WordPress recommends you to have PHP version 7.2 or greater. Having said that I suggest you to use at least PHP version 7 to avoid any compatibility issues. https://wordpress.org/about/requirements/

Thanks.

Hi Prasant,

Thank you for your answer.

I am fully aware of security and speed issues before 7.2 which is recommended by wordpress, woocommerce along with many key things for wordpress sites to run smoothly. I have built many.

What I’m asking is which is the latest pHp version “Pro” built to work on?

I do not require any third party advice right now.

As of yesterday pHp 5.6 has become unsupported so even Woocommerce which previously required no higher than 5.6 has moved to 7.2 and really works so much better hence why anyone should be reluctant using anything lower. Not to mention Cloudflare and other Caching tools who flag anything less than 7.2 to be not good enough.

I went through the effort of sending you a report on the incompatibility errors that Pro has with 7.2 yesterday.

I am asking what the latest pHp version PRO can work on?

Hi Jay,

The SG Optimizer always do that, and it’s not really based on the actual error (false positive). Please check this https://theme.co/apex/forum/t/woocommerce-php-errors-when-updating-to-php7/32411/7. I explained it on that old thread :slight_smile:

That tool is basically flagging this line

setup_postdata( $GLOBALS['post'] =& $post_object );

And just because & is front of $post_object

And I updated the Woocommerce plugin and the code is still the same for \wp-content\plugins\woocommerce\templates\cart\cross-sells.php

<?php
/**
 * Cross-sells
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/cart/cross-sells.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see 	    https://docs.woocommerce.com/document/template-structure/
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     3.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( $cross_sells ) : ?>

	<div class="cross-sells">

		<h2><?php _e( 'You may be interested in&hellip;', 'woocommerce' ) ?></h2>

		<?php woocommerce_product_loop_start(); ?>

			<?php foreach ( $cross_sells as $cross_sell ) : ?>

				<?php
				 	$post_object = get_post( $cross_sell->get_id() );

					setup_postdata( $GLOBALS['post'] =& $post_object );

					wc_get_template_part( 'content', 'product' ); ?>

			<?php endforeach; ?>

		<?php woocommerce_product_loop_end(); ?>

	</div>

<?php endif;

wp_reset_postdata();

You can verify that by editing the same file of your updated Woocommerce. If that causes a performance issue, then Woocommerce should too even if they moved to 7.2 (since it’s the same file).

And yes, Pro works on 7.0, 7.1, and even 7.2. The recommendation is just 5.6 or greater but not exactly as 5.6.

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.