I'm trying to glean a signal from the noise in debugging this.
When I run ./artisan make:middleware MyTools, I get:
Mcrypt PHP extension required
Solutions seem to revolve around setting a proper value in /etc/php5/mods-available/mcrypt.ini and then doing a php5enmod mcrypt and Apache restart. Sounds good, and a phpinfo() call shows it's there and that I'm running PHP 5.5.9-1ubuntu4.20. All peachy.
However, I'm not running php 5 on the command line for artisan! Typing php -v tells me I'm running php 7.0.14-2.
When I go to /etc/php/7.0/mods-available, indeed I do not see mcrypt.ini - my question is how to "get" a proper mycrypt.ini file in there, have Mcrypt running for the COMMAND LINE, and not have to change anything else - for example I want to leave the webserver as it is at 5.5.9. How do I do this?
-- UPDATE --
See the discussion/comments below, I was able to get around this by DOWNGRADING my CLI to 5.5.9 vs. installing mcrypt into php7. This is not likely the best solution and I welcome a better one.
Related
I am aware there are many other questions related to this error, but I have tried all the answers and nothing worked.
Full error
dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
Referenced from: /usr/local/opt/php#7.1/bin/php
Reason: image not found
Abort trap: 6
When did the error occur?
Right after updating Ruby to 2.6.3 via RVM.
Whenever I enter "php" into the terminal the error appears.
Steps taken
Basic steps: Restart Macbook, opened new terminal window.
Uninstall/Reinstall: Node, Openssl, libpng, Ruby
Update/Upgrade: brew
Unlinked/Linked: libidn, autoconf
Given myself all rights via chown -R /usr/local
OpenSSL: $ sudo rm /usr/bin/openssl, brew reinstall openssl#1.1
Brew cleanup
Reinstalled PHP
Versions
Mac OS Mojave 10.14.6
PHP 7.4
Ruby 2.6.3p62
RVM 1.29.9
When running Brew Doctor
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: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which 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:
/opt/local/bin/python2.7-config
/opt/local/bin/curl-config
/opt/local/bin/ncursesw6-config
/opt/local/bin/pcre-config
/opt/local/bin/ncurses6-config
/opt/local/bin/pcap-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:
(here it posts all the /usr/local/include/node files, but the list exceeds character limitations)
Any ideas on how to solve this error?
I had similar issue which I fixed this way:
brew reinstall php
I will answer my own question for others who might run into a similar issue
After having uninstalled and reinstalled every single keg of brew I found the following solution:
Uninstall PHP
Run brew cleanup
Check your /usr/local/opt folder for any folders named php
Delete the folder (in my case it was called 'php#7.1')
Open a new terminal window
Run 'brew search php' in the terminal and make sure no php keg is installed.
Simply type 'php -v' in the terminal. For me this showed a version number, indicating that php was (at one point) installed without brew. You can choose to uninstall this version or update it to the newest version.
Conclusion
In my case I believe it was simply that PHP 7.1 was already installed and I installed a 2nd version (7.4) via brew.
The error 'Referenced from: /usr/local/opt/php#7.1/bin/php' was obviously searching for something in this folder and after deleted it, the error stopped.
In my case, i had multiple version of php installed on my macOs, which was later remedies with laradock.
Primary problem:
❯ php -v
dyld[62395]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicuio.70.dylib
Referenced from: <31116583-6CB3-3C7B-AD46-52FF1431267E> /opt/homebrew/Cellar/php#7.4/7.4.30/bin/php
Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicuio.70.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicuio.70.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicuio.70.dylib' (no such file), '/usr/local/lib/libicuio.70.dylib' (no such file), '/usr/lib/libicuio.70.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.70.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.70.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.70.dylib' (no such file), '/usr/local/lib/libicuio.70.dylib' (no such file), '/usr/lib/libicuio.70.dylib' (no such file, not in dyld cache)
Also tried
❯ brew uninstall php
Warning: Calling plist_options is deprecated! Use service.require_root instead.
Please report this issue to the mongodb/brew tap (not Homebrew/brew or Homebrew/core), or even better, submit a PR to fix it:
/opt/homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongodb-community.rb:55
As indicated "Referenced from" a php version was still installed after mutliple attempts of brew uninstall php
Solution:
rm -rf /opt/homebrew/etc/php
After above brew install php without a problem.
Hope this helps.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/memcached.so' - /usr/lib/php/20131226/memcached.so: undefined symbol: php_msgpack_serialize in Unknown on line 0
Earlier today, I enabled forwarding of messages to root#localhost on my server to beam back to my personal email.
I have been receiving the above error message at 30 minutes intervals since. Of course, I checked and there's a PHP session cleaning script attached to cron to run at 30 minutes interval.
I have been searching around but couldn't find any specific solution.
My setup:
memcached 1.4.25
PHP 7.0
nginx/1.10.0
mysql Ver 14.14 Distrib 5.7.13
Ubuntu Server LTS 16.04
The closest I found to my issue above was this: http://community.rtcamp.com/t/php-warning-error-php-msgpack-serialize/6262 but there's no answer on that thread.
First you need to work out which PHP ini files are being loaded. From command line you can run php --ini. Technically apache/nginx can be running a different version, and you can look up using phpinfo(); exit(); test script if you want to view that one instead. As you're using cron, you're using the command line version anyway.
In one of these files you will find a line similar to:
extension="memcache.so"
If you don't need this extension at all, then just comment it out by prepending it with a ;:
;extension="memcache.so"
If you DO need the extension then it sounds like you need to rebuild this module. The easiest way is using PECL.
pecl install memcache
You might need to follow some instructions whilst running the install. Once it's done, you should be able to run php -v and it shouldn't output the same warning. If this has worked and you just see the php versions, you should restart nginx (if you need it on the website, the command line one should work instantly). :
sudo service nginx restart
I guess you can get a help from a similar topic on the site here.
But briefly, one of your extensions is loading memcache and the path in that is not correct.
You should find it in your php.ini and fix the path manually.
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
Check if msgpack extension is installed and enabled (php -i | grep msgpack).
It seems that PHP in Ubuntu is compiled with it by default.
If it's installed and enabled, then check you memcached extension. Maybe you are using it from a previous installation or something similar.
tl;dr: I eventually had to clear everything PHP that is less than php7.0 from my server manually, along with their related cron jobs.
Long story:
Going through my running process (ps -aux | grep 'php'), I realized php5 is still in there running. Everything on my server uses PHP7, so that lingering process was redundant, plus there was a cron job that runs a session cleaning job on the php5 somewhere, using a script which goes looking for the so-called missing Memcached file.
After removing all phps that are less than php7 from system via apt, I also went in to delete all the existing folders that are less than php7 in /usr/lib/php5 and or /usr/lib/php/ along with their cron related jobs found in /etc/cron.d/php5 and or /etc/cron.d/php/
No more whining warnings from PHP session cleaning about memcache
I was getting a similar error with memcache.so and I noticed there was a new version of memcache that was installed the moment the system ran 'pecl install memcache' (automatically that updated to the latest version). The new version caused that error so I had to change the version 1 version lower to pecl install memcache-4.0.5.2 and it worked. Thanks #Farkie for that insight, that's when I realized that there was a new version that just came out a few days ago and that was it!
Just install msgpack extension and the error message should disappear:
apt install php-msgpack
You might also be missing igbinary extension:
apt install php-igbinary
a few months ago, I installed php55 using homebrew. However, I don't need that anymore and want to use the php version that OS X ships itself.
So I uninstalled php55 using homebrew. When I run php -v now, the following error occurs:
/usr/local/bin/php: No such file or directory
When I run ls /usr/local/bin | grep php I see that no php executable is there anymore (as expected due to uninstalling the package).
When I run echo $PATH, it prints:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin
As far as I understand the usage of the PATH variable, the terminal should search in /usr/bin for an executable called php when there is no one in /usr/local/bin, but it doesn't. And removing /usr/local/bin from the PATH isn't an option as long as I have other homebrew packages installed on the system.
When running which php the output is as expected: /usr/bin/php, the php executable shipped by OS X.
Any suggestions why the shell doesn't find the php executable?
P.S. The details about the uninstalling of the php55 package:
I uninstalled php55, php55-intl and all of their dependencies that are not needed by any other package. Then I untaped homebrew-php.
My brew doctor output:
Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:
/usr/local/share/man/de
/usr/local/share/man/de/man1
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:
cloog018
gmp4
isl011
libmpc08
mpfr2
zlib
brew prune dit it ... Somewhere must have been a dead symlink that pointed to /usr/local/bin/php (which doesn't exist any more).
Even though the problem is solved now, I am really curious about why homebrew didn't do this during the uninstall process. Any suggestions?
When I try to install Laravel 4 via Composer, I get the following message in Terminal
Mcrypt PHP extension required. Script php artisan optimize handling
the post-install-cmd event returned with an error
The PHP version on my computer is 5.5.3 and when I run phpinfo it shows that mcrypt is enabled. When I run the which php command in Terminal it shows
/usr/bin/php
I therefore extended the $PATH with .bash_profile.
export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
Unfortunately, the which php command still shows /usr/bin/php after extending $PATH. And as a result the error is still there.
So I am out of ideas on how to solve this issue. Does anyone have an idea? Thanks!
There is difference between the MAMP PHP version and you "Terminal" PHP version. Therefore are you probably setting up the export path.
When you are changing the export path you have to restart your terminal before it will take effect on your computer.
I am not sure of this but when your error is appearing and older version of Laravel will be installed.
What do you get when you execute: php -v in your terminal?
i am trying to setup a new symfony framework project on ubuntu by following the documentation. But all the commands mentioned in the docs starting with 'php' give out the following error.
The program 'php' is currently not installed. You can install it by typing:
sudo apt-get install php5-cli
bash: php: command not found.
But php is installed and running on the system! How do i get past this error ?
Thanks in advance.
There are several different PHP packages; probably the one that is installed is the PHP module for Apache, not the command-line (CLI) version invoked as php.
Just run the command like it says, and you should be fine.
Is php on your path? (does it start if you just type in 'php' at the prompt or do you need to specify a path?)
If so, then its possible that the path is hardcoded to look elsewhere for your PHP executable. Try grepping the scripts to see where its looking.
If php is NOT on your path then try adding it, e.g. if php is in /usr/local/bin (and /usr/local/bin is not currently on your path)
export PATH=$PATH:/usr/local/bin
HTH
C.