I need this to install phpspreadsheet. Here’s more detail php - Install phpspreadsheet on old version of Mac - Stack Overflow
Hi @braddalton
Are you having trouble getting this set up in Local?
Yes, i need to install PhpSpreadsheet but to do this, its asking me to install the PHP extension for local. How do i do this?
Hey @braddalton – the instructions for compiling additional PHP extensions that were linked in the associated StackOverflow thread are here:
Those instructions are for a much older version of Local (we sometimes call that “Local Classic”) and were specific to when Local used Docker to manage the PHP process.
Since the 5.x version, Local no longer uses Docker and there isn’t a good way to compile additional extensions for PHP that Local uses. This mostly has to due with the way that PHP is compiled for MacOS, and in particular the various code-signing steps that we’ve had to do to run PHP natively for Local.
Can you give us a little more detail about the phpspreadsheet
extension? Is this a requirement for a WP plugin you are using on a site?
Thanks. yes, i’m building a plugin which includes a MS Exel export option that requires php spreadsheet. This is the problem with my Mac :
-
The PHP zip extension is missing
-
Your PHP version (7.3.29) is too old for the latest version of PHPSpreadsheet
And these commands do not work with Mac :
apt-get update
apt-get install -y php7.3-zip
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires php >=8.1 but your php version (7.3.29) does not satisfy that requirement.
Problem 2
- Root composer.json requires phpoffice/phpspreadsheet ^1.29 → satisfiable by phpoffice/phpspreadsheet[1.29.0
, …, 1.29.10].
- phpoffice/phpspreadsheet[1.29.0, …, 1.29.10] require php ^7.4 || ^8.0 → your php version (7.3.29) does no
t satisfy that requirement.
Where exactly are you seeing this message?
Local has never released a 7.3.29
version – the latest we released for the 7.3 line was 7.3.5
.
That makes me think that maybe a different version of PHP was installed for another tool and is interfering with Local’s version of PHP.
Can you try creating a completely new site in Local, using the default preferred environment and verifying that you have the zip
extension? You can see the complete PHP configuration that Local is using for a site by clicking the “Details” button next to the PHP version of the site overview page:
This is my Mac PHP version. The problem is i’m trying to use Locals PHP version to install php spreadsheet as my machines PHP version cannot be updated.
I guess I don’t understand then – where is the WordPress site? If it’s managed with Local, then it should be using whatever version of PHP that was used to create the site and therefore should have the zip
extension.
If you create a new site in Local and build your plugin within that site, doesn’t that work for your needs?