How to install php's gmp for windows? - laravel

Root composer.json requires PHP extension ext-gmp * but it is missing from your system. Install or enable PHP's gmp extension.
I'm getting this error, so can anyone tell me how to resolve this error?

If you are using XAMPP:
;extension=gmp
Uncomment(remove ; from ;extension=gmp) this line in your php.ini file!

Related

Call to undefined function CodeIgniter\locale_set_default() - Xampp

I'm trying to set up Codeigniter4 with Xampp but when calling the public address http://localhost/projectfolder/public/index.php as stated in the README.md file of the CodeIgniter4 framework, the next error appears:
<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() in
C:\xampp\htdocs\codeigniter4\system\CodeIgniter.php:184
Stack trace:
#0 C:\xampp\htdocs\codeigniter4\system\bootstrap.php(181): CodeIgniter\CodeIgniter->initialize()
#1 C:\xampp\htdocs\codeigniter4\public\index.php(36): require('C:\\xampp\\htdocs...')
#2 {main}
thrown in <b>C:\xampp\htdocs\codeigniter4\system\CodeIgniter.php</b> on line <b>184</b><br />
I've tried this solution but it didn't work for me.
Does anybody know how to solve it?
The root of the issue is that you have a missing PHP extension.
In particular:
intl
Keep in mind that this is clearly stated in the frameworks' repository README.md file.
Server Requirements
PHP version 7.4 or higher is required, with the following extensions
installed:
intl
libcurl if you plan to use the HTTP\CURLRequest library
mbstring
Additionally, make sure that the following extensions are enabled in
your PHP:
json (enabled by default - don't turn it off)
xml (enabled by default - don't turn it off)
mysqlnd
In addition, it's also pointed out here:
Bug: Missing function locale_set_default(...) #3171
Please install intl extension - this is a required component.
I found my temporary solution in here, without updating de PHP Version in Xampp.
Go to C:\xampp\htdocs\projectfolder\system\CodeIgniter.php - line 184 and change the next line.
Before:
locale_set_default($this->config->defaultLocale ?? 'en');
After:
if( function_exists('locale_set_default' ) ) :
locale_set_default($this->config->defaultLocale ?? 'en');
endif;
Once I updated Xampp to the 7.4 version (download here), I just needed to enable the extension=intl in the xampp\php\php.ini file. As it is explained here, you just have to uncomment the line from ;extension=intl to extension=intl.
Then you can leave the C:\xampp\htdocs\projectfolder\system\CodeIgniter.php - line 184 as it was in the beginning.
locale_set_default($this->config->defaultLocale ?? 'en');
Install it via linux
sudo apt-get install php-intl
or for a PHP Version
sudo apt install php7.4-intl
if you are on xampp (windows) update the php.ini
php.ini path = C:\xampp\php\php.ini
;extension=intl
to
extension=intl

CMake is throwing an error while Installing OpenCV

I am using this document as a guide
and i ran through this error
Install the project...
-- Install configuration: "RELEASE"
CMake Error at cmake_install.cmake:36 (file):
file cannot create directory: /installation/OpenCV-/share/licenses/opencv4.
Maybe need administrative privileges.
I just encountered the same problem as you. I found out that it is not a permission problem, but a path problem of OpenCV installation.
I use the following method for successfully installing OpenCV4.2.0 to my computer.
Change the path:
-D CMAKE_INSTALL_PREFIX = $cwd/installation/OpenCV-4.2.0
To
-D CMAKE_INSTALL_PREFIX = /usr/local

Using Composer to install mailparser, why am I getting an error that allow_url_fopen must be enabled when it already is enabled?

I am trying to install this PHP mailparser. I have Composer installed and the required mailparse extension is also installed. However, when I run:
composer require php-mime-mail-parser/php-mime-mail-parser
I get the following error:
[Composer\Downloader\TransportException] The
"https://repo.packagist.org/packages.json" file could not be
downloaded : allow_url_fopen must be enabled in php.ini (https://
wrapper is disabled in the server configuration by allow_url_fopen=0
failed to open stream: no suitable wrapper could be found)
However, I've checked php.ini and it clearly says it's enabled, i.e.
allow_url_fopen = On
How could I get that specific of an error about needing to enable allow_url_fopen even though it definitely IS enabled?
Run this command:
php -d allow_url_fopen=on <composer_path> <composer_arguments>
Replace <composer_path> with the direct path to the composer executable (e.g. /opt/cpanel/composer/bin/composer) and <composer_arguments> with the arguments you are passing to composer (e.g. require php-mime-mail-parser/php-mime-mail-parser).
This works for me:
php -d allow_url_fopen=1 /opt/cpanel/composer/bin/composer install

How to fix fatal error: zlib.h: no such file or directory?

I'm trying to compile miniSAT on Kali Linux 64 bits but I keep getting the error message:
fatal error: zlib.h: no such file or directory
I have read that there might be a linking problem that makes the compiler unable to find the header files, but I'm new to Linux and do not know how to solve that.
You should install the development support files for zlib, try:
sudo apt-get install libz-dev
Other package names: zlib1g-dev.
If you've already zlib library, make sure you're compiling your code sources with -lz. See: missing zlib.h in ubuntu.
Install zlib from it's source, solve my similar error.
Download last version from this then:
configure
make -j4
make install

PHPUnit instllation broken since Mountain Lion upgrade

I upgraded my Mac from Lion to Mountain Lion a few months ago.
I previously had PHPUnit working with my Zend Framework 1.11 without issue but had not used it much.
I now have Zend Framewoprk 2 running on a Quick Start website but I simply cannot gwet PHPUnit to work.
I've searched numerous questions related to this on Stackoverflow and tried reinstalls and path changes to php.ini without success.
I have also checked that my PEAR install is working fine, which it is but the error is the same when I try "phpunit --version"
PHP Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43
PHP Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear') in /usr/bin/phpunit on line 43
Attempts to reinstall phpunit results in me been told phpunit is already installed and its version current.
$ sudo pear install phpunit/PHPUnit
phpunit/PHPUnit is already installed and is the same as the released version 3.7.10
install failed
Trying to uninstall fails as phpunit is a dependancy in other items/applications.
Is there anyway I can fix this or completely remove it and reinstall fresh?
include_path in my php.ini is:
include_path=".:/Users/johnadmin/pear/share/pear/PEAR:/Users/johnadmin/pear/share/pear:/usr/bin/phpunit:/Users/johnadmin/pear/share/pear/PHPUnit:/usr/bin/phpunit:/Users/johnadmin/pear/bin/pear"
Additional info in case its relevant:
> which phpunit
/usr/bin/phpunit
> which pear
/Users/johnadmin/pear/bin/pear
> which php
/usr/bin/php
Autoload.php is located in
/Users/johnadmin/pear/share/pear/PHPUnit
Additionally, the folder '/usr/lib/php/' exists but the PHPUnit directory is not under that, it is under /Users/johnadmin/pear/share/pear/PHPUnit
bash_profile content/paths
PATH=$PATH:/usr/local/Cellar/imagick/3.0.1:/usr/local/sbin:/Users/johnadmin/pear/share/pear:$
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-04-17_at_08:37:29: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-10-09_at_16:09:32: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
##
# Your previous /Users/johnadmin/.bash_profile file was backed up as /Users/johnadmin/.bash_$
##
# MacPorts Installer addition on 2012-12-06_at_13:40:25: adding an appropriate PATH variable$
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
At my wits end as I do not know what else to check frankly and any help would be a big help. Ta
John
Nevermind after hours of trying various solutions I found that creating a simlink to the PHPUnit folder worked.
Command I used was
sudo ln -s /Users/johnadmin/pear/share/pear/PHPUnit /usr/lib/php/PHPUnit
Seriously, this helped me a lot:
Install Composer (http://getcomposer.org)
composer require phpunit/phpunit 3.7.*
composer update
Three simple steps to pull PHPUnit source, and binary to your project.

Resources