php7 and php7.1 with homebrew in OSX - php

since the late upgrade of homebrew i started getting these warning in the terminal even though the libraries exist and the config point to the correct path
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-apcu/apcu.so' - dlopen(/usr/local/opt/php70-apcu/apcu.so, 9): Symbol not found: _zend_signal_globals
Referenced from: /usr/local/opt/php70-apcu/apcu.so
Expected in: flat namespace
in /usr/local/opt/php70-apcu/apcu.so in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-apcu/apcu.so' - dlopen(/usr/local/opt/php70-apcu/apcu.so, 9): Symbol not found: _zend_signal_globals
Referenced from: /usr/local/opt/php70-apcu/apcu.so
Expected in: flat namespace
in /usr/local/opt/php70-apcu/apcu.so in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/intl.so' - dlopen(/usr/local/opt/php70-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
Referenced from: /usr/local/opt/php70-intl/intl.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/intl.so' - dlopen(/usr/local/opt/php70-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
Referenced from: /usr/local/opt/php70-intl/intl.so
Reason: image not found in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
Warning: Module 'mcrypt' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File: /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.0/conf.d/ext-apcu.ini,
/usr/local/etc/php/7.0/conf.d/ext-igbinary.ini,
/usr/local/etc/php/7.0/conf.d/ext-intl.ini,
/usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.0/conf.d/ext-memcached.ini,
/usr/local/etc/php/7.0/conf.d/ext-oauth.ini,
/usr/local/etc/php/7.0/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
when executing which php
/usr/local/opt/php#7.0/bin/php
and here is the result of brew list
brew list  ✔  10956  12:18:48
apr libffi openssl#1.1 php#5.6
apr-util libmemcached pcre php#7.0
aspell libpng php55 php#7.1
autoconf libpq php55-intl pkg-config
automake libtool php55-mcrypt pv
composer libxml2 php56 python
dnsmasq libyaml php56-intl python#2
freetds libzip php56-mcrypt readline
freetype m4 php56-pcntl ruby
gdbm makedepend php70 sqlite
gettext mcrypt php70-apcu tmux
glib memcached php70-igbinary tree
gmp mhash php70-intl unixodbc
gnu-sed n98-magerun php70-mcrypt webp
heroku ncdu php70-memcached xz
icu4c nginx php70-oauth zsh
jpeg node php70-opcache zsh-syntax-highlighting
jq oniguruma php70-xdebug
libevent openssl php71
here is the output for brew doctor
brew doctor  ✔  10981  12:38:48
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/node/ares.h
/usr/local/include/node/ares_build.h
/usr/local/include/node/ares_rules.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/nameser.h
/usr/local/include/node/openssl/archs/BSD-x86/opensslconf.h
/usr/local/include/node/openssl/archs/BSD-x86_64/opensslconf.h
/usr/local/include/node/openssl/archs/VC-WIN32/opensslconf.h
/usr/local/include/node/openssl/archs/VC-WIN64A/opensslconf.h
/usr/local/include/node/openssl/archs/aix-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/aix64-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/darwin-i386-cc/opensslconf.h
/usr/local/include/node/openssl/archs/darwin64-x86_64-cc/opensslconf.h
/usr/local/include/node/openssl/archs/linux-aarch64/opensslconf.h
/usr/local/include/node/openssl/archs/linux-armv4/opensslconf.h
/usr/local/include/node/openssl/archs/linux-elf/opensslconf.h
/usr/local/include/node/openssl/archs/linux-ppc/opensslconf.h
/usr/local/include/node/openssl/archs/linux-ppc64/opensslconf.h
/usr/local/include/node/openssl/archs/linux-x32/opensslconf.h
/usr/local/include/node/openssl/archs/linux-x86_64/opensslconf.h
/usr/local/include/node/openssl/archs/linux32-s390x/opensslconf.h
/usr/local/include/node/openssl/archs/linux64-s390x/opensslconf.h
/usr/local/include/node/openssl/archs/solaris-x86-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc/opensslconf.h
/usr/local/include/node/openssl/des_old.h
/usr/local/include/node/openssl/dso.h
/usr/local/include/node/openssl/krb5_asn.h
/usr/local/include/node/openssl/kssl.h
/usr/local/include/node/openssl/pqueue.h
/usr/local/include/node/openssl/ssl23.h
/usr/local/include/node/openssl/ui_compat.h
/usr/local/include/node/pthread-fixes.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-experimental.h
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python#2
heroku
python
php55
Warning: Your Xcode (9.2) is outdated.
Please update to Xcode 9.4 (or delete it).
Xcode can be updated from the App Store.
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/bin/docker-credential-osxkeychain.backup
/usr/local/bin/hyperkit.backup
/usr/local/bin/notary.backup
/usr/local/bin/vpnkit.backup
any help on how to fix these warnings is appreciated

For anyone looking how to solve this issue, you have to delete the php and related libraries and install again as homebrew/php tap became deprecated and all of the libraries used to install became part of homebrew/core.
so by default you will php7.2 installed when you do $ brew install php but you can you install specific version manually like php#7.0. if you need xdebug you can install with pecl install xdebug and add the path in your php.ini

Related

PHP Startup: Unable to load dynamic library 'pdo_mysql' in linux mint 20.2 PHP8 [duplicate]

root#ip-10-131-9-200:/etc/php5/apache2# php -a
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo.so' - /usr/lib/php5/20090626+lfs/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Interactive shell
Even though several other answers suggest it, installing more unnecessary software is generally not the best solution. Instead, you should fix the underlying problem. The reason these messages appear is because you are trying to load those extensions, but they are not installed. So the easy solution is simply to tell PHP to stop trying to load them:
First, find out which files are trying to load the above extensions:
$ grep -Hrv ";" /etc/php5 | grep -E "extension(\s+)?="
Example output for Ubuntu:
/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/pdo_sqlite.ini:extension=pdo_sqlite.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/sqlite3.ini:extension=sqlite3.so
/etc/php5/conf.d/mcrypt.ini:extension=mcrypt.so
/etc/php5/conf.d/imagick.ini:extension=imagick.so
/etc/php5/apache2/php.ini:extension=http.so
Now just find the files that are loading the extensions that are causing the errors and comment out those lines with a ;. For some reason this happened to me with the default install of Ubuntu, so hopefully this helps someone else.
sudo apt-get install php5-mcrypt
sudo apt-get install php5-mysql
...etc resolved it for me :)
hope it helps
Look /etc/php5/cli/conf.d/ and delete corresponding *.ini files. This error happens when you remove some php packages not so cleanly.
Seems like you upgraded PHP to newer version and old .ini files are still pointing to old location.
The solution: find out where are modules located now
ls -l /usr/lib/php5
There should be a directory similar to old 20090626. In my case it is now 20131226
The .ini files giving you an error are located at /etc/php5/cli/conf.d/
Just edit those .ini files which module gives you an error. For example, in case the error is for mcrypt module:
sudo vi /etc/php5/cli/conf.d/20-mcrypt.ini
Change the line:
extension=/usr/lib/php5/20090626/mcrypt.so
to reflect the new path for .so file. In my case the correct path should be:
extension=/usr/lib/php5/20131226/mcrypt.so
That's it! The error is gone. Ofc you'd have to do it with each module giving you an error.
If you put the ; symbol, this action inactive the extension.
I had the same problem and did the following:
Uninstall php with purge parameter:
sudo apt-get --purge remove php5-common
And install again:
sudo apt-get install php5 php5-mysql
My problem was solved by the following command
sudo apt-get install php5-mcrypt
I have
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
Ubuntu Desktop 12.04
Mysql 5.5
I found this solution by blog.tordeu.com, and it's
sudo aptitude purge php5-suhosin
I'm not sure, but it seems that the suhosin is no longer needed, it worked for my, my PHP version:
PHP 5.4.34-1+deb.sury.org~lucid+1 (cli) (built: Oct 17 2014 15:26:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
If you are using 5.6 php,
sudo apt-get install php5.6-curl
Somehow the gmp.so file seems to have been deleted from my system. This is what fixed it for me:
sudo apt-get install --reinstall php5-gmp
Well for Ubuntu 14.04 I was getting that error just for mcrypt:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/mcrypt.ini' - /usr/lib/php5/20121212/mcrypt.ini: cannot open shared object file: No such file or directory in Unknown on line 0
If you have a closer look at the error, php is looking for mcrypt.ini and not for mcrypt.so at that location. I just copy mcrypt.so to mcrypt.ini and that's it, the warning is gone and the extension now is properly installed. It might look a bit dirty but it worked!
I had enabled the extension_dir in php.ini by uncommenting,
extension_dir = "ext"
extension=phpchartdir550.dll
and copying phpchartdir550 dll to the extension_dir (/usr/lib/php5/20121212), resulted in the same error.
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/phpchartdir550.dll' - ext/phpchartdir550.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/pdo.so' - ext/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/gd.so' - ext/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
As #Mike pointed out, it is not necessary to install all the stuff when they are not actually required in the application.
The easier way is to provide the full path to the extensions to be loaded after copying the libraries to the correct location.
Copy phpchartdir550.dll to /usr/lib/php5/20121212, which is the extension_dir in my Ubuntu 14.04 (this can be seen using phpinfo())
and then provide full path to the library in php.ini,
; extension=/path/to/extension/msql.so
extension=/usr/lib/php5/20121212/phpchartdir550.dll
restart apache: sudo service apache2 restart
even though other .so's are present in the same directory, only the required ones can be selectively loaded.
I had a similar problem, which led me here:
$ phpunit --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/profiler.so' - /usr/lib/php5/20131226/profiler.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
Unlike the above, installing the software did not resolve my problem because I already had it.
$ sudo apt-get install php5-uprofiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-uprofiler is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
I found my solution via : Debian Bug report logs
$ sudo vim /etc/php5/mods-available/uprofiler.ini
I edited the ini file, changing extension=profiler.so to extension=uprofiler.so .... the result, happily:
$ phpunit --version
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
i.e. no more warning.
(For Ubuntu users)
I had the same problem, but none of the answers above solved that. Here is how I solved the problem.
Open your php.ini file (mine was in /etc/php/7.3/cli/php.ini).
You may have something like this:
extension=pdo_mysql
Or maybe:
extension=/here/is/the/path/to/your/file/pdo_mysql.so
Add the following line before extension=pdo_mysql
extension=pdo
So, you will have:
extension=pdo
extension=pdo_mysql
It seems that the problem is (at least in my case) that we need to load pdo extension first to load the pdo_mysql extension.
Hope that helps!

MacOS Mojave + PHP 7.1.23 + IMAP configuration

I want to use imap_append command in my PHP code. But, when I enabled extension=php_imap.dll in the /etc/php.ini file on my Mac, I am seeing following warning when I fire any PHP command:
Example:
php --version
gives output:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20160303/php_imap.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/php_imap.dll, 0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-non-zts-20160303/php_imap.dll in Unknown on line 0
I have already tried installing following but no use:
brew tap kabel/php-ext
brew install php-imap
brew install php#7.1-imap
Any clue?

Unable to load dynamic library 'zip.so' on Centos 7.6.1810 using remi-php72 repo

I am having problems getting October CMS to update:
Update failed
"Class 'ZipArchive' not found" on line 51 of /var/www/html/jdd/htdocs/vendor/october/rain/src/Filesystem/Zip.php
And if I do php -m, i get the following warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_libzip_version), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Strange thing is, in my /etc/php.d/ folder, the zip.ini file contains the line: extension=zip.so. whereas all other .ini files in /php.d do not include the ".so" extension (eg: for the json.ini file, the line reads: extension=json). I have tried removing the ".so" from the zip.ini extension= line, but it still won't work.
As far as I know, the system is only running x86_64 executables (how do I check this with absolute certainty - all binaries are showing as .x86_64 or .noarch?).
I have tried other versions of php:
-php 5.4 installs zip.so fine (it loads correctly), except October requires at least php 7.0.
-php 7.0 to 7.3 all install zip.so, but the extension still does not load.
Can anyone help?
I've got the same problem and found following solution:
Search for installed php modules:
yum list installed | grep php*
Try to locate installed php-zip module:
rpm -ql php72-php-pecl-zip
You will see something like this:
/etc/opt/remi/php72/php.d/40-zip.ini
/opt/remi/php72/root/usr/lib64/php/modules/zip.so # <----
/opt/remi/php72/root/usr/share/doc/pecl/zip
Then just create symlink to this file in directory where php searches modules by default:
ln -s /opt/remi/php72/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so
After this steps I finally saw zip extension in php -m output and now can use class ZipArchive.
Also you should probably restart your httpd service.
1 - Download manually the last ZIP pecl lib at https://pecl.php.net/package/zip
2 - Install it with pecl in the downloaded file
sudo pecl install zip-1.19.1.tgz
3 Enable zip on php.ini
extension=zip
Please check you are using latest libzip5 version 1.5.1 from remi-safe repository (which is mandatory, and enabled by default)

Error Installing composer with Homebrew

I have just installed Composer on my mac OSX 10.12.1 using Homebrew:
brew install homebrew/php/composer
Then when I call
brew info homebrew/php/composer
It shows this:
homebrew/php/composer: stable 1.3.0 (bottled), HEAD
Dependency Manager for PHP
http://getcomposer.org
/usr/local/Cellar/composer/1.3.0 (5 files, 1.7M) *
Poured from bottle on 2017-01-08 at 16:33:31
From: https://github.com/Homebrew/homebrew-php/blob/master/Formula/composer.rb
==> Requirements
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so' - dlopen(/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so, 9): image not found in Unknown on line 0
Required: phpmeta ✔, phar ✔
How can this be fixed?
You have an issue with your PHP installation.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so' - dlopen(/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so, 9): image not found in Unknown on line 0
Check MongoDB extension. Maybe you've removed it, but the config still includes it (check all files in /usr/local/etc/php/7.1/conf.d/).
I fixed it. It wasn't a composer issue, Trying to install Composer just alerted me to the problem. As you say it was a PHP configuration problem with mongodb. I fixed it by removing the mongodb extension from my PHP.ini file.

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.

Categories