Laravel and Brew installation with PHP and PDO - php

I have just moved from linux to mac and am having some issues installing PHP with the right drivers for Laravel.
I ran brew install homebrew/php/php56-mysqlnd_ms
but now I keep getting this error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php56-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php56-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0
phpinfo()
PHP Version => 5.6.21
Does anybody know how to fix this error? I am at a loss

You are missing mcrypt . You can try ,
brew install php54-mcrypt --without-homebrew-php
And then , in /etc/php.ini add,
extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"
I hope this will help , please let us know

Seems that you have to install the module mcrypt of php.
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
sudo composer update
Other thing that if you want to use mac and linux you can use Vagrant, is really nice how it works with virtualbox + vagrant you can have stack on other OS.
https://www.vagrantup.com/
And this is a nice project with vagrant for install all the the technologies you need.
https://github.com/fideloper/Vaprobash

Related

PHP 8.1 - Mac M1 - brew - MongoDB error "symbol not found in flat namespace '_u_strFromUTF8_67'"

I'm facing this error
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /opt/homebrew/lib/php/pecl/20210902/mongodb.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/mongodb.so, 0x0009): symbol not found in flat namespace '_u_strFromUTF8_67'), /opt/homebrew/lib/php/pecl/20210902/mongodb.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/mongodb.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/mongodb.so.so' (no such file))) in Unknown on line 0
I'm on on Mac with Apple Silicon, php 8.1 installed with "brew tap shivammathur/php".
I'm trying to use php with mongodb, installed with "pecl install mongodb".
When I add extension=mongodb.so or extension="mongodb.so" to my php.ini, I receive this error.
I try to follow another post with a similar error, but with no different result.
"symbol not found in flat namespace '_PHP_MD5Init' " Error encountered in loading redis dynamic library
The same approach I used to install xdebug and no problem occoured.
Any help?
What I missed?
Just for info, pecl list print out:
Package Version State
mongodb 1.14.2 stable
Other things maybe can be useful:
macOs 12.6
php 8.1.11
mongodb 1.14.2
mongocli 1.27.0
Xdebug is also installed by pecl and it works, so I guess it must be something wrong with mongodb's package or something
You compiled mongodb with icu4c 67.1 as dependency and brew most likely updated it.
To fix this make sure icu4c is the latest version and compile the MongoDB
extension again.
brew update
brew upgrade icu4c
pecl install -f mongodb
Alternatively, you can remove the extension installed using pecl and use the homebrew tap I maintain.
https://github.com/shivammathur/homebrew-extensions
pecl uninstall mongodb
brew tap shivammathur/extensions
brew install shivammathur/extensins/mongodb#8.1

Does the Redis PHP extension installed through PECL work on Mac M1?

The Redis server is running successfully using Homebrew with brew services start redis.
The PECL Redis installer appears to work with sudo pecl install redis , giving the following output:
Build process completed successfully
Installing '/opt/homebrew/Cellar/php#7.4/7.4.28/pecl/20190902/redis.so'
install ok: channel://pecl.php.net/redis-5.3.7
Extension redis enabled in php.ini
If I use php --ini, this is the output:
Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /opt/homebrew/lib/php/pecl/20190902/redis.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/redis.so' (no such file), '/usr/lib/redis.so' (no such file)), /opt/homebrew/lib/php/pecl/20190902/redis.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so.so' (no such file), '/usr/local/lib/redis.so.so' (no such file), '/usr/lib/redis.so.so' (no such file))) in Unknown on line 0
The redis.so library is in /opt/homebrew/lib/php/pecl/20190902.
Is there any way to get this library working on Mac M1?
You can run pecl with arch to ensure that the architecture is arm64.
arch -arm64 sudo pecl install redis
Alternatively, you can use a brew tap I maintain (shivammathur/extensions).
brew tap shivammathur/extensions
brew install redis#7.4
I had the same problem.
Basically, I have done the same like accepted answer
arch -arm64 sudo pecl install redis
But that didn't work for me immediately. I needed to reinstall redis.
pecl uninstall redis
pecl install redis
And after that it finally worked. I hope that it will help somebody, I spent on this problem few hours.

Mac os X PHP56 ApcU via Brew - Symbol not found: _zend_signal_globals

When trying to install APCu via brew I get the error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-apcu/apcu.so' - dlopen(/usr/local/opt/php56-apcu/apcu.so, 9):
Symbol not found: _zend_signal_globals
Referenced from: /usr/local/opt/php56-apcu/apcu.so
Expected in: flat namespace
in /usr/local/opt/php56-apcu/apcu.so in Unknown on line 0
This occurs no matter how I install APCu
brew install php56-apcu
brew install --build-from-source php56-apcu
brew install php56-apcu --enable-apc-bc
APC fails to appear in phpinfo too.
Opcache is install fine, as is php-intl
the executable in /usr/bin/php would necessarily be the apple distribution php on El-Capitan (cant be certain about previous versions, OSX is such a moving target).
Try to add /usr/local/bin as top dog in your path (in file .bash_profile) and retry in a newly instantiated terminal window.

PHP: Unable to load dynamic library intl.so (OSX)

I am trying to run a CakePHP app. I've been working for a while in this app and recently I had to install a new dependency (using composer). Once I installed it this error came up and I can't run the app anymore:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.56.dylib
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20121212/intl.so Reason: image not found in Unknown on line 0
When I open that folder I can see a different version of that library:
libicui18n.57.dylib
But the system is looking for
libicui18n.56.dylib
How can I install the 56 version of that library or upgrade the intl so it uses version 57?
Is that what I need to do?
Thanks!!
I have the same question when i upgrade node to v8.x.
After i run brew upgrade node,the icu4c was updated.
I solve the problem by under command:
brew unlink php56-intl
brew remove php56-intl
brew install php56-intl
so, i feel you should reinstall intl extension.

laravel installation mcrypt unable to initialize module

im trying to install laravel 4 on my mac mavericks os with xampp server.
I solved several problems but a cant With This:
Warning: PHP Startup: mcrypt: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
i understund the problem , but i dont know how to fix it.
thanks a lot !
brew reinstall mcrypt --build-from-source php56-mcrypt --build-from-source
You may only need the php56-mcrypt module.
Are you using Homebrew? If so, you need to brew tap homebrew/php and then brew install php55-mcrypt.
If you're not using Homebrew, then you really should be. (Xampp probably isn't the way to locally develop Laravel either...) Check out Jeffrey Way's http://laracasts.com. There are a couple of free videos in the series Laravel From Scratch that should answer some installation questions.

Categories