i tried installing phpoffice/phpspreadsheet(im using windows) but i receive some errors, i'm on organization VPN( idk if this may be the problem but i know this was relevant for installing composer)
i tried those commands
php --version
PHP 8.2.0 (cli) (built: Dec 6 2022 15:31:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
composer -V
Composer version 2.5.4 2023-02-15 13:10:06
composer require phpoffice/phpspreadsheet
Cannot use phpoffice/phpspreadsheet's latest version 1.27.1 as it requires ext-gd * which is missing from your platform.
Installation failed, deleting ./composer.json.
In RequireCommand.php line 225:
No composer.json present in the current directory (./composer.json), this may be the cause of the following excepti
on.
In PackageDiscoveryTrait.php line 317:
Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer v
ersion:
- phpoffice/phpspreadsheet 1.27.1 requires ext-gd * but it is not present.
- phpoffice/phpspreadsheet 1.27.1 requires ext-zip * but it is not present.
Related
Solution: I've updated my OS to the latest version where the latest PHP was supported.
I've got a new laravel project
When I run php artisan serve
it shows:
MacBook-Pro% php artisan serve
Warning: require(/Users/username/Desktop/code/argon/vendor/autoload.php): failed to open stream: No such file or directory in /Users/username/Desktop/code/argon/artisan on line 18
Fatal error: require(): Failed opening required '/Users/username/Desktop/code/argon/vendor/autoload.php' (include_path='.:') in /Users/username/Desktop/code/argon/artisan on line 18
composer update shows
MacBook-Pro% composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.2.5 but your PHP version (7.1.23) does not satisfy that requirement.
Problem 2
- laravel/tinker v2.2.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.1.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.0.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker 2.x-dev requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- Installation request for laravel/tinker ^2.0 -> satisfiable by laravel/tinker[2.x-dev, v2.0.0, v2.1.0, v2.2.0].
MacBook-Pro% php -v
PHP 7.1.23 (cli) (built: Nov 7 2018 18:20:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
also
MacBook-Pro% brew unlink php#7.1
Error: No such keg: /usr/local/Cellar/php#7.1
MacBook-Pro% brew unlink php71
Error: No such keg: /usr/local/Cellar/php71
also
MacBook-Pro% which php
/usr/bin/php
Any ideas how to remove php 7.1.23 ?
php -v gives the following response:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
The release notes for Catalina contain the following remark:
Info here
Scripting Language Runtimes Deprecations Scripting language runtimes
such as Python, Ruby, and Perl are included in macOS for compatibility
with legacy software. Future versions of macOS won’t include scripting
language runtimes by default, and might require you to install
additional packages. If your software depends on scripting languages,
it’s recommended that you bundle the runtime within the app.
In short: macOS continues to include 'legacy' versions of things like Python, Ruby, Perl, and indeed PHP, so that existing code won't break, but Apple is leaving it to the user to install the versions that they want to use.
Found a solution !
brew install php72
brew switch php#7.2 7.2.25
https://laravel.com/docs/6.x/homestead
I'm using macOS Catalina version 10.15. At the beginning, I was able to use MAMP PRO with Port 80. However, after I failed to run composer install inside a project at /applications/mamp/htdocts/project/ because of a missing extension ext-zip of PHP as below:
Problem 1
- Installation request for phpoffice/phpspreadsheet 1.10.0 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
Problem 2
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- maatwebsite/excel 3.1.17 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- Installation request for maatwebsite/excel 3.1.17 -> satisfiable by maatwebsite/excel[3.1.17].
I decided to install php via homebrew in Terminal. After successfully installed by the following commmand
brew install php#7.3
# php -v
PHP 7.3.8 (cli) (built: Aug 24 2019 19:38:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
#which php
/usr/bin/php
As a result, I cannot use MAMP PRO with Port 80 anymore nor does it resolve the missing extension ext-zip problem.
I have a couple questions that cannot wrap my head around:
If the built-in php has been always there, how could I use the Port 80 in the beginning?
is the built-in php with macOS always running? How to know inside of a project that which php is being used? (macOS or MAMP)??
What I have tried:
- Attempt to uninstall php version that I have installed by brew uninstall php#7.3 --force.
Ports from 1 to 1024 cannot be used by normal users without root credentials.
You would be able to use sudo to bind to port 80, but be aware, there could be some security risks when starting a program with root credentials, so use a wrapper which binds to your privileged port and relaxes the user credentials to a normal user.
I have a problem with installing some of the composer packages on my project.
Problem 1
- Installation request for spatie/image-optimizer 1.1.5 -> satisfiable by spatie/image-optimizer[1.1.5].
- spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 2
- Installation request for spatie/laravel-feed 2.2.1 -> satisfiable by spatie/laravel-feed[2.2.1].
- spatie/laravel-feed 2.2.1 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 3
- Installation request for spatie/laravel-newsletter 4.5.0 -> satisfiable by spatie/laravel-newsletter[4.5.0].
- spatie/laravel-newsletter 4.5.0 requires php ~7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 4
- Installation request for spatie/laravel-referer 1.4.0 -> satisfiable by spatie/laravel-referer[1.4.0].
- spatie/laravel-referer 1.4.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 5
- Installation request for spatie/laravel-sitemap 5.3.0 -> satisfiable by spatie/laravel-sitemap[5.3.0].
- spatie/laravel-sitemap 5.3.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 6
- spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
- spatie/image 1.7.2 requires spatie/image-optimizer ^1.0 -> satisfiable by spatie/image-optimizer[1.1.5].
- Installation request for spatie/image 1.7.2 -> satisfiable by spatie/image[1.7.2].
Even though my PHP version is 7.2.1 these packages are not passing the composer.json validation i.e. cannot be installed. The PHP CLI version is 7.2.1 as well. (checked them all with using the standard procedures phpinfo() and php -v.
I am using MAMP PRO version 4.4.1 and the latest configurable PHP version from the listed versions is 7.2.1 (which is okay since the requirements for these packages ranges from 7.1 to 7.2.
https://github.com/spatie/image-optimizer/blob/master/composer.json#L19
https://github.com/spatie/laravel-newsletter/blob/master/composer.json#L20
https://github.com/spatie/laravel-feed/blob/master/composer.json#L33
https://github.com/spatie/laravel-referer/blob/master/composer.json#L19
https://github.com/spatie/laravel-sitemap/blob/master/composer.json#L19
As I already said the PHP versions are looking good both on the Apache side and CLI side and from the MAMP PRO GUI as well.
PHP 7.2.1 (cli) (built: Jan 15 2018 12:20:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
MAMP PRO config:
MAMP PRO host related config:
Upgrading PHP to version 7.3 might resolve this issue but I would like to skip that because it has to be done manual without the help of MAMP PRO (since my MAMP PRO version is licensed and I'll need another license to get the built-in PHP versions in it).
Thanks!
Not sure what would cause this except a custom version defined in your composer.json:
{
"config": {
"platform": {
"php": "7.1.14"
}
},
To work around this problem you could tell composer to ignore the version:
composer require spatie/image-optimizer --ignore-platform-reqs
There is only a handful of threads on installing gearman on Windows, especially the gearman PHP extension. I have not found a solution yet. If anyone found a solution to get gearman PHP extension working on Windows, please comment on this thread.
I came across this thread on pecl install gearman. When attempting to install Gearman PHP extension through cygwin using pecl, the installation failed with the following error.
$ pecl search gearman
Retrieving data...0%
Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
gearman 1.1.2 (stable) PHP wrapper to libgearman
$ pecl install gearman
pecl/gearman requires PHP (version >= 5.1.0, version <= 6.0.0, excluded versions: 6.0.0), installed version is 7.1.12
No valid packages found
install failed
I checked PHP version and it is 5.6.3. Where is that installed version 7.1.12 coming from?
$ php -v
PHP 5.6.31 (cli) (built: Jul 5 2017 22:24:51)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Related thread: How can i install gearman php extension on Windows OS?
When i'm trying to install composer
i got following error.Actually all modules are installed.
As per my knowledge there will be two configuration files(apache2 & cli).
in both of the configuration files modules are enabled.still I'm facing this issue.
Problem 1
- The requested PHP extension ext-gd * is missing from your system.
Problem 2
- The requested PHP extension ext-mcrypt * is missing from your system.
Problem 3
- The requested PHP extension ext-curl * is missing from your system.
Problem 4
- The requested PHP extension ext-intl * is missing from your system.
Problem 5
- The requested PHP extension ext-xsl * is missing from your system.
Problem 6
- The requested PHP extension ext-mbstring * is missing from your system.
Problem 7
- Installation request for braintree/braintree_php 2.39.0 -> satisfiable by braintree/braintree_php[2.39.0].
- braintree/braintree_php 2.39.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 8
- Installation request for pelago/emogrifier v0.1.1 -> satisfiable by pelago/emogrifier[v0.1.1].
- pelago/emogrifier v0.1.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
when i'm trying to update/install
sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-curl is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-46 linux-headers-3.13.0-46-generic
linux-image-3.13.0-46-generic linux-image-extra-3.13.0-46-generic
sendmail-base sendmail-cf sensible-mda
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 54 not upgraded.
update:
php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll' - /usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll' - /usr/lib/php/extensions/no-debug-zts-20121212/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.5.9 (cli) (built: Sep 8 2015 18:01:37)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
Try using php -m to make sure the modules have been enabled in your php installation.
If they are not in the list, you will have to add them in your php.ini.