Enable phar extension in old php installation in windows 10 - php

$ php composer.phar install
PHP's phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.
I trying the extension html2wiki (Unsupported) of mediawiki, where I need to install the composer to make it work.
My php version is: 7.0.13 and my question is
How to enable this extension https://pecl.php.net/package/phar

Related

I have face a problem to install maatwebsite/excel on laravel 8 | php 8?

I have face this problem to install maatwebsite/excel on laravel 8. How can I fix it?
NB: PHP version running 8.
I solved the problem with
I just enable PHP gd extension from php.ini file
installing PHP package PhpSpreadsheet
The problem is about Laravel Excel requirements. It seems PhpSpreadsheet: ^1.15 is not installed. Here is the list of requirements for Laravel-Excel 3.1,
PHP: ^7.2\|^8.0
Laravel: ^5.8
PhpSpreadsheet: ^1.15
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled
PHP extension php_iconv enabled
PHP extension php_simplexml enabled
PHP extension php_xmlreader enabled
PHP extension php_zlib enabled
Make sure these are installed and enabled on your php.ini. Also make sure your php version on composer.json is set like this:
"require": {
"php": "^7.2|^8.0",
},
Instead of something like this "php": ">=7.2". Check this out for more information. Please let me know if it worked.
I just want share another answer related here. If you run on unix (linux), try install php-gd using command line. Try check other answer related to your system.
sudo apt-get update
sudo apt-get install php8.0-gd
related:
How to install PHP GD in Ubuntu
install php-gd ext on Debian
Issue with enabling GD in PHP
If you using windows. Use this command.
composer require maatwebsite/excel --ignore-platform-reqs
This problem happen only on php 8.x! perhaps on lastest php 7. The problem same as above and still failed even php-gd is active. When type
composer require maatwebsite/excel
the error still the same. When checking using
php -i
(basicly same as phpinfo in console). We can see php gd is active. This answer is not recommended at the moment. Fixed still on the way related to this issue.
related link:
https://github.com/Maatwebsite/Laravel-Excel/discussions/3191
PHP8 is supported, make sure to use 3.1.30 of the package as mention above. To see other issue, please read this link.
https://github.com/Maatwebsite/Laravel-Excel/issues/2936
I solved using
Enable zip and gd extension in php.ini
or install using sudo apt-get install php8.0-gd
sudo apt-get install php8.0-zip
use composer require maatwebsite/excel:^3.1 -W
-W is for with-all-dependencies
I have just used composer require maatwebsite/excel -W --ignore-platform-req=ext-zip and this has worked for me on linux ubuntu 20 with php 8.1
delete composer.lock (json)
then run below command
composer require phpoffice/phpspreadsheet
composer require maatwebsite/excel
it is working

How can I install PHP extensions to satisfy composer?

I am creating a app and am trying to install a library into my project though composer.
Composer has given me the error:
Problem 1
- The requested PHP extension ext-gmp * is missing from your system. Install or enable PHP's gmp extension.
Ok, it seems like I need to gmp extension.
I am using a Mac, and using a local test server with XAMPP.
Now this is where it starts getting confusing. I went to my XAMPP php.ini and remove the ";" from gmp extension like this:
xampp attempt
I retried composer installation with no luck. My next thought was that the extension needs to be installed on the global PHP Mac installation... I removed the ";" for gmp on that php.ini, but no luck. How can I solve this?
-if you need it for php 5 use
brew install homebrew/php/php55-gmp
-if you need it for php 7 use
brew install homebrew/php/php70-gmp
-and if you don't have homebrew, you can install it using this command
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
OR you can jsut run
brew install php#7.1
since it have all the packages you need for php 7.1

How to install mcrypt extension in xampp

how to install mcrypt in xampp on windows?
My PHP Version 7.0.5 and xampp pack have not mcrypt extension so how can i install mcrypt on xampp ?
First, you should download the suitable version for your system from here: https://pecl.php.net/package/mcrypt/1.0.3/windows
Then, you should copy php_mcrypt.dll to ../xampp/php/ext/ and enable the extension by adding extension=mcrypt to your xampp/php/php.ini file.
The recent versions of XAMPP for Windows runs PHP 7.x which are NOT compatible with mbcrypt.
If you have a package like Laravel that requires mbcrypt, you will need to install an older version of XAMPP. OR, you can run XAMPP with multiple versions of PHP by downloading a PHP package from Windows.PHP.net, installing it in your XAMPP folder, and configuring php.ini and httpd.conf to use the correct version of PHP for your site.
you should install mcrypt with pecl on your xampp server:
./bin/pecl install mcrypt
then add to php.ini this code (extension block):
extension=mcrypt.so
Right from the PHP Docs:
PHP 5.3 Windows binaries uses the static version of the MCrypt library, no DLL are needed.
http://php.net/manual/en/mcrypt.requirements.php
But if you really want to download it, just go to the mcrypt sourceforge page
http://sourceforge.net/projects/mcrypt/files/?source=navbar

installing composer on centos

I'm trying to install composer on my server (centos) but I keep getting this error :
The phar extension is missing.
Install it or recompile php without --disable-phar
ps:I am trying to install composer to work with laravel
Specifically for CentOS
Edit the file /etc/php.d/20-phar.ini and remove the ; character in front of the line:
extension=phar.so
Now the phar extension is enabled.
Composer is provided as a phar as that extension is a standard part of PHP 5.3 which is also the minimum required version for running Composer at all.
If you have a weird version of PHP 5.3+ without the phar extension you could also convert it to a zipball or tarball via online tools, unpack it to /usr/local/share/composer, and then symlink manually from /usr/local/bin/composer to /usr/local/share/composer/bin/composer. Assuming no other settings are preventing installation that should work as well.
PHAR is part of the PHP core since some years now. Its already installed as dynamic/shared extension, but probably and simply not activated in your case
Please check your php extension folder for a file "phar.so".
To enable the extension:
Go to your php.ini and enable extension = phar.so
Check the loaded PHP Extensions with php -m and look for "Phar"
Then re-run the Composer install
First, you need to get composer.phar by doing :
curl -sS https://getcomposer.org/installer | php
And move the composer.phar for using globally :
mv composer.phar /usr/local/bin/composer

Installing PHP CLI Extensions in Windows

I have PHP5 installed under Windows and IIs but now I find I need to install some additional extensions, but I have been having difficulty finding the specifi dll files for the extensions I need to install.
Specifically trying to install:
PHP CLI Extension
PHP MCrypt Extension
PHP Curl Extension
Curl
PHP documentation sates the dlls need to go into the C:\PHP\ext directory but I can not find the DLLs anywhere on the internet in order to install them.
Found similar question with other extension here Installing PHP extensions on Windows
But can not find any specifics for the extensions I need.
PHP Installation of extensions on Windows
PHP Manual
PHP CLI Extension Installation Command Line PHP on Microsoft Windows
PHP MCrypt Extension PHP Mcrypt
PHP Curl Extension PHP cURL

Categories