OK, I have seen many posts about this, and I have spent the entire day working through them to solve this issue, with no success.
I am trying to create a Laravel project. I am using a Mac (Yosemite), which is running PHP 5.5.14. There is also an older version of PHP on the machine. When I try to create a project from the command line using "laravel new projectname", no errors are reported, but the command just creates an empty folder named with the project name. I get the "Crafting application..." and "Application ready! Build something amazing" messages but, again, only an empty folder.
If I try to use this command:
composer create-project laravel/laravel projectname
I get this:
Installing laravel/laravel (v5.0.16)
- Installing laravel/laravel (v5.0.16)
Downloading: 100%
Created project in projectname
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16].
- laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
In the terminal, if I enter this:
which php
I get: /usr/bin/php
/usr/bin/php -v
I get:
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
I used homebrew to install autoconf and mcrypt with this command:
brew install autoconf mcrypt
If I run that command again, I get:
Warning: autoconf-2.69 already installed
Warning: mcrypt-2.6.8 already installed
Since I kept getting the error, I assumed it was installed in the wrong place so, I compiled and installed mcrypt myself using these instructions:
[Install mcrypt php extension][1]. I used PHP version 5.5.14 during the install. Mcrypt was installed in this directory: /usr/lib/php/extensions/no-debug-non-zts-20121212/
I have restarted Apache. I have checked my .bash_profile to make sure /usr/bin is in my Path.
If I create a page with phpinfo() and view it in my browser, I see that mcrypt is listed in the "Module Authors" section of the page. It just lists the names of the people who created the module.
I am stumped. I look forward to any suggestions that people might offer (I really don't want to install a virtual box, or anything like that. Surely, I can get this module installed in the right place!)
Thanks very much!
I got this exact same problem too.
You have to find php.ini for php cli and add extension=mcrypt.so
My system is running LAMPP server with preinstalled PHP. So, here's what I do:
Install mcrypt extension
I tried both:
sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt
Configure php.ini for CLI
Then, edit php.ini located in /opt/lampp/etc/php5/cli/php.ini add extension=mcrypt.so on Dynamic Extension section (anywhere is fine I think). Don't forget to restart your server.
Try using composer to install laravel
Now, you can run whatever method you want to install laravel. I download Laravel 5 manually, unzip, then install using composer install command. I think your command composer create-project laravel/laravel projectname would've run smoothly too.
References:
here
mac users install brew and then enter
brew install php56-mcrypt
in terminal
EDIT
if you get any error using above line then try this command
brew install homebrew/php/php56-mcrypt
Please following the step :
cd /etc/php5/cli/conf.d
ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini
Worked for me.
For MAC users,
brew install homebrew/php/php56-mcrypt
Related
I'm attempting to upgrade a very old (version 5.0) Laravel application to the current version, and I'm getting an error when running composer install because I don't have box/spout. So I tried composer require box/spout, and got the following:
Package box/spout has requirements incompatible with your PHP version,
PHP extensions and Composer version:
- box/spout v3.3.0 requires ext-zip * but it is not present.
I'm working on RHEL server 7.9, with PHP 8.0.22 and composer 2.3.10. I ran:
sudo yum install php80-php-pecl-zip.x86_64
then created a zip.ini file in my /etc/php.d directory with "extension=zip.so" in it, and restarted apache, but I'm still getting the same error. Is pecl-zip the right package? I did try "sudo yum install php8.0-zip" but it told me there is n such package. How do I resolve this dependency?
I have found the problem and fixed it. By running
rpm ql php80-php-pecl-zip.x86_64
I discovered that yum installed the extension into the /opt/remi/php80/root/usr/lib64/php/modules directory, while PHP was loading from /usr/lib64/php/modules/. I copied over the zip.so file, and that fixed the problem.
I have php 7.4 installed on my macbook pro m1
% php -v
PHP 7.4.15 (cli) (built: Feb 26 2021 09:28:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.15, Copyright (c), by Zend Technologies
I'm trying to install the mongodb driver running:
sudo pecl install mongodb
But fails after a while:
mp/pear/temp/mongodb/src/contrib/ -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/mongodb/php_phongo.c -fno-common -DPIC -o .libs/php_phongo.o
In file included from /private/tmp/pear/temp/mongodb/php_phongo.c:29:
In file included from /opt/homebrew/Cellar/php#7.4/7.4.15_1/include/php/ext/spl/spl_iterators.h:24:
/opt/homebrew/Cellar/php#7.4/7.4.15_1/include/php/ext/pcre/php_pcre.h:25:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
I tried with
arch -x86_64 sudo pecl install mongodb
but results in the same error.
Somebody knows how can I solve this please? Or if I can install the mongodb driver without using pecl. Thanks in advance.
I have finally solved my problem.
I followed these steps from https://github.com/mongodb/mongo-php-driver/issues/1159
After installing a newer PHP version where previously I used 7.3.24 and updated to 7.4.16.
Still had the same issue but diffrent file:
fatal error: 'pcre2.h' file not found #include "pcre2.h"
From this error I tried to check the files in the MacOs Big Sur File system and in the end I found where the pcre2.h is located, and oddly it was being called in the pcre folder, so I manually copied from the pcre2 folder to pcre
The solution that I used:
$cp /opt/homebrew/Cellar/pcre2/10.36/include/pcre2.h /opt/homebrew/Cellar/php\#7.4/7.4.16/include/php/ext/pcre/pcre2.h
Then, I installed mongodb using
$brew install mongodb
After that, I once again tried
$sudo pecl install mongodb
Finally, it worked. However, I'm not sure if this is a good way to solve the problem by manually adding a header file to the directory.
(Sorry I'm still new to the MacOs Environment, just bought a mac mini m1 last week for developing my programming skills)
If you were to install php multiple versions from homebrew make sure you are using the current version as you wanted to. You could check the version by using which php.
To switch from 7.4 to 5.6
$brew unlink php#7.4
$brew link php#5.6 --force
credits: https://www.markhesketh.com/switching-multiple-php-versions-on-macos/
New error
Success Installation:
There is a simpler way to fix the installation issue than symlinking the header file into PHP sources. When running pecl install, you can provide additional compile arguments via the CFLAGS environment variable. So, on the Apple Silicon platform, you can use the following command to get the extension to compile:
CFLAGS=-I/opt/homebrew/include pecl install mongodb
Note that this is only necessary on Apple Silicon, not on x64. It also works for other extensions that fail because of similar errors (e.g. apcu)
I had the same issue with PHP 7.3, I solved it just by running the following commands:
cp /opt/homebrew/Cellar/pcre2/10.38/include/pcre2.h /opt/homebrew/Cellar/php#7.3/7.3.31/include/php/ext/pcre/pcre2.h
Then installed it successfully:
sudo pecl install mongodb
I have finally solved my problem. I used PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)
My errors: fatal error: 'pcre2.h' file not found
The solution that I used:
1. brew install pcre2
2. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/Cellar/php/8.1.7/include/php/ext/pcre/pcre2.h
Please check your path again when use `ln -s`
3. sudo pecl install mongodb
See more: Install pecl pear on MacOs - Link
Success Installation:
Hope it help you :) Thanks
cp /Applications/MAMP/Library/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/pcre2.h
then run
sudo pecl install mongodb
If you use MAMP,
Based on #Kelwin Tantono's answer follow instructions to install mongodb then,
Firstly, check for the location of pcre2.h file by
cd /opt/homebrew/Cellar/pcre2/
In this directory find the folder with ls command, in my case it was 10.40 .
Change 10.40 value in the below code with the result of ls command.
Then, check your php version with moving to php directory at MAMP by
cd /Applications/MAMP/bin/php/
Change php8.0.8 value in the below code with your desired php version.
cp /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre
Now you can install mongodb extension with below command after changing your working directory to
cd /Applications/MAMP/bin/php/php8.0.8/bin
sudo pecl install mongodb
Now, you should add extension=mongodb.so to php.ini file with
echo "extension=mongodb.so" > /Applications/MAMP/bin/php/php8.0.8/conf/php.ini
Do not forget to change php version.
I am trying to install zeromq on a mac running Sierra. According to the installation guide http://zeromq.org/intro:get-the-software, you can install zeromq library by running:
brew install zmq
After successfull installation I proceded with adding "react/zmq": "0.2.*|0.3.*" to the require section of the composer.json and running composer install
Problem 1
- react/zmq v0.3.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system.
- react/zmq v0.2.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system.
- Installation request for react/zmq 0.2.*|0.3.* -> satisfiable by react/zmq[v0.2.0, v0.3.0].
I think this has to do with macs having default php already installed and brew installing zeromq for the wrong php version. How should I debug this problem further?
php -m shows no libzmg package. php -i shows version PHP Version => 5.6.30. Inspecting phpinfo() in a browser also returns version 5.6.30
Well. I had finally found a way to do it.
$ git clone git://github.com/mkoppanen/php-zmq.git
$ cd php-zmq
$ phpize && ./configure
$ make && make install
Now you need find out which php.ini file is loaded on your CLI
$ php --ini
or you can find out by typing following command
$ php -i | grep 'Configuration File'
If not anything please add on on "/etc/php.ini". I have added one, generally you have php.ini.default is present on "/etc" make a copy of that place in to "/etc/php.ini"
then you need find out the zmq.so file, you can find that by typing
$ sudo find / -name zmq.so
In case it is /Library/WebServer/Documents/drupal/php-zmq/.libs/zmq.so
So it will be "Path/TO/php-zmq/.libs/zmq.so"
Then edit your php.ini file and add the exact path of zmq.so
in my case "extension=/Library/WebServer/Documents/drupal/php-zmq/.libs/zmq.so"
extension=/$PATH_TO/php-zmq/.libs/zmq.so
All the best...
The answer provided by Rakesh is correct but the repository no longer works, use https://github.com/alexat/php-zmq instead.
I am new on this editor and I would like to try it for php project.
I am trying to configure this package php-integrator-base in my atom ide, but I have this error:
The socket connection with the PHP server could not be established.
This means the PHP server could not be spawned. This is most likely an
issue with your setup, such as your PHP binary not being found, an
extension missing on your system, ...
This is my setup for this package:
This my php verion on my ubuntu distrib:
Anyone else have the same issue with this package ? Where am I wrong ?
EDIT
Since I have make the update of the package today I always have the same error but another one occured.
Indeed, an error message appears to notice that:
Core installed failed
When I start the atom editor I have this message too:
If you are on Unix system then go to :
cd $HOME/.atom/packages/php-integrator-base/core/
then you should have a directory with num version as name like 2.X.X. So :
cd 2.1.0 and ../composer.phar install
I am relevantly new to this IDE as well and had errors with installation of php-integrator-base. I am using Windows and it turned out that it was an issue with my environmental path. Try the following steps:
Add your Git binary path to your environmental path
Enable sqlite on your php.ini file by adding these: extension=php_sqlite3.dll and extension=php_pdo_sqlite.dll
If above steps do not work, try posting an issue at their GitHub repo.
There is a better solution, which solves this "identified" issue and others only visible when running Atom in --dev mode.
Sadly nobody ever pointed to the fact (or noticed) this issue is caused by packages differences in between PHP 7.0 and PHP 7.1. For some reason, for PHP 7.1 some packages still reference items related to PHP5.6, while some other packages are expecting everything to be PHP 7.x related.
The solution is to upgrade the PHP 7.0x to PHP 7.1.
In Ubuntu environments you can do that by running these commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt remove php7.0 (optional, only if you want to uninstall PHP7.0)
sudo apt install php7.1
Simply restart Apache by running:
sudo service apache2 restart
Then check your PHP version to confirm it has been upgraded:
php -v
You should get an output like this:
PHP 7.1.8-2+ubuntu16.04.1+deb.sury.org+4 (cli) (built: Aug 4 2017 13:04:12) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.8-2+ubuntu16.04.1+deb.sury.org+4, Copyright
(c) 1999-2017, by Zend Technologies
You may have to re-enable some extensions after upgrading to PHP 7.1. Atom may complain about these in specific (mbString, SQLite and DOM). Simply run these commands to install/activate them:
sudo apt install php7.1-mbstring
sudo apt install php7.1-sqlite
sudo apt install php7.1-xml
Don't forget to reactivate your old extensions as well (if any). For PHP 7.1 in most cases it is the same "command" just changing "php7" (or "php") to "php7.1".
Once you are done with PHP, navigate to Atom's PHP Integrator folder and check if the folder "3.0.0" exist:
.atom/packages/php-integrator-base/core/3.0.0/
If it doesn't exist go to https://gitlab.com/php-integrator/core/tree/3.0.0, download it and extract the contents of the compressed file in the 3.0.0 folder (you may have to create it):
Then, from inside .atom/packages/php-integrator-base/core/ you run:
composer install
Now, finally, Composer will be able to find the right packages and install all required dependencies.
Simply say "good bye" to the PHP Integrator errors that have been haunting you lately and enjoy your Atom, once again fully functional as it should be.
I hope it helps some fellow friends stop wasting time with lots of proposed solutions that exist online which in reality won't fix the real core of the problem. ;)
Following #Rei suggestion, I make an issue on theri github repo here.
To solve my problem, I follow step by step a manual installation of the package and then use composer inside the package itself to install the core folder.
If ./composer.phar install fails with a "missing sqlite extension", install php-sqlite extension:
sudo apt-get install php-sqlite3
The problem:
I have installed Composer and followed the Quick start guide in the Laravel 4 documentation.
I get the following error when I run composer install or composer update:
Script php artisan optimize handling the post-install-cmd event
returned with an error...
I tried to run the following composer command:
composer create-project laravel/laravel myproject --prefer-dist
Or use their laravel.phar:
laravel new myproject
Or get the zip version from git: https://github.com/laravel/laravel?source=c
And I still fail to update via composer.
Additional information:
My PHP version on my Mac is:
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0,
Copyright (c) 1998-2013 Zend Technologies
PHP version on MAMP: 5.4.10
I found some solutions on Google / Stack Overflow but those did not work well in my case.
It says:
MCrypt PHP extension required
So it looks like you're missing the Mcrypt extension, which is required by Laravel (actually, I think it's used only by the Authentication class for password handling, not for the rest of the components of the framework).
I haven't got a Mac, but the command to install it should be something like this, using Homebrew
brew tap josegonzalez/php
brew install mcrypt php54-mcrypt
These links might help you:
http://www.jorble.com/2013/04/install-php-mcrypt-in-macosx/
http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/
Having the setting xdebug.scream = 1 in the configuration was the cause of the problem for me. I fixed it by doing the following:
Find XDebug configuration file.
$ sudo find / -name xdebug.ini
Edit file using any text editor.
$ sudo vi /your_path/xdebug.ini
Set xdebug.scream = 0
Reload the server (Apache/Nginx/whatever).
$ sudo service nginx reload
You might have Mcrypt installed already on your computer, if you are using MAMP or any other application. So, you don't need to install Mcrypt again. Add the following code to a php file and place it in your htdocs directory. See the info about the PHP you are running. You can see whether Mcrypt is already installed or not.
<?php
phpinfo();
If it shows Mcript, then do the following:
Check which PHP version you are using. You can see different directories for different PHP versions in this directory: /Applications/MAMP/bin/php/.
Move to the user's home directory. Use this command on terminal: cd ~.
Edit (or create a new one if not exists) .bash_profile file.
Add the following line:
where php5.5.10 is the directory of the PHP version you are using.
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
Now restart your computer. And you can use php artisan command of Laravel.
Source of information: Laravel requires the Mcrypt PHP extension