Install PHP 8

Have found a few other threads asking about how to install a custom version of PHP, but no replies… maybe this can be the lucky one.

PHP 8 is due out very soon and so we are all gonna need to test our WP sites/plugins/etc. Is there a way to install PHP 8 so that Local will run with it?

https://feedback.localwp.com/feature-requests/p/php-8-support

1 Like

Wanted to drop a line in this topic saying that the latest Beta release of Local has PHP 8:

For more info about PHP 8 and how it relates to Local and WordPress, see this help doc:

@ben.turner Any thoughts on the modifications required to get VSCode working with xDebug 3.0 and Local Beta?

PHP 8 was a tricky thing to get to compile on all the OSes, and Xdebug wasn’t something that we heavily QA’d.

We wanted to get something in the hands of others to play with, so if you are tinkering and find something, can you post it here?

I haven’t had time to try it out yet, but I’ve carved out some time this sprint to take a closer look at Xdebug in general and will spend a bit of time testing on PHP 8 – anything I find, I’ll let you know!

1 Like

@ben.turner here’s what I found. The default PHP 8.0 php.ini.hbs must be set up as follows for the xDebug port.

I don’t think the xdebug.remote_port is used in xDebug 3.0 but it seems to be needed for switching the value from PHP 7.4.x or PHP 7.3.x where these values are set.

UPDATE - See below for current information.

1 Like

And now for some inexplicable reason it’s not copying over the xdebug.client_port="9003" when I switch PHP versions. :confused:

Actually, it’s not copying over any of the data in php-8-0-0/php.ini.hbs into php/php.ini.hbs

Also xdebug.start_with_request=trigger is more appropriate as running the step debugger even when it is not activated in the IDE will generate warnings.

In summary, what seems to work consistently is if I change the php.ini.hbs file inside of ~/Library/Application Support/Local Beta/lightning-services/php-8.0.0+1/conf/php.ini.hbs to contain the following.

xdebug.mode=debug
xdebug.client_port=9003
xdebug.start_with_request=trigger
xdebug.discover_client_host=yes

xdebug.client_port is an integer per https://xdebug.org/docs/all_settings#client_port

Looks like a great opportunity to test the lightning services updater :wink:

If you want the debugger always active as you have with xdebug.start_with_request=yes you should add xdebug.log_level=0 to eliminate the errors that show in the log as if the debugger in the IDE isn’t running.

3 Likes

This is awesome feedback, thanks for diving in an working with it!

Right now we don’t have a way of copying or merging in settings within the php.ini.hbs between different php services so common settings will need to be added manually between the different files.

1 Like

thanks @afragen
I got an timeout error on xdebug in my debug.log and it was solved by copying the above code in php/php.ini.hbs. The problem seems to have been that the client_port was set to 9000 instead of 9003. After changing that, I haven’t had the error again.

php 7.4.1 had :9000 too, but had no problem with it.

I run local on a windows 10 system.

I wanted to follow up in this thread to mention that PHP 8 is now an option in the latest Stable releases of Local (since 5.9.7)

PHP 8 has brought a lot of changes and WP core has done some amazing work getting things wired up, but the larger WordPress ecosystem should only be considered “Beta Compatible” with PHP 8.

Resharing this link from earlier in the thread, but if you’re wanting a more in-depth look at PHP 8 through the WordPress+Local lens, here’s a help doc to get you oriented:

The one main annoyance as @afragen has pointed out is the difference between Xdebug versions. I’ve created a story for the Local team to focus on getting things current, but no eta on when that will be done.

I’ll mark this feature requests as solved since it’s been released to stable, so be on the lookout for the improvements to come related to upgrading the PHP lightning service to Xdebug 3.0.

1 Like

Obviously, updating all of the PHP releases to use xDebug 3 would also simplify setup. :wink:

1 Like

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