Reputation: 2037
I've installed mcrypt using Homebrew but it doesn't seem to be loading. I installed by running:
brew install php70-mcrypt
When I run phpinfo() in a browser I don't see mcrypt installation details (apart from the module authors).
Is nginx using the same php that I get from the command line? Or am I not installing / enabling mcrypt properly?
phpinfo tells me the .ini path:
If I check the /usr/local/etc/php/7.0/conf.d directory, there are two .ini files:
but they don't appear to have been parsed. The mcrypt one (the one I'm trying to get working) contains:
and /usr/local/opt/php70-mcrypt is a symlink to the Cellar location /usr/local/Cellar/php70-mcrypt/7.0.27_19, which contains the mcrypt.so file.
I've tried adding the extension to the php.ini file directly, both with and without the path. Each time I save the file then restart php (not sure if necessary...) and nginx:
brew services restart php70
brew services restart nginx
Still not loading.
If I run this from the terminal:
php -i | grep mcrypt
I get:
/usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13,
string.toupper, string.tolower, string.strip_tags, convert.*, consumed,
dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
There appears to be more detail here.
Is nginx using a different php from the command line? How can I make sure nginx is using the php I see at the command line if this is the problem? Or alternatively, how can I install php to the "other" php that nginx uses?
The underlying reason for this is to load Magento 2, which is giving me this error which I think confirms that mcrypt really isn't loading properly:
Exception #0 (Exception): Notice: Use of undefined constant MCRYPT_BLOWFISH - assumed 'MCRYPT_BLOWFISH' in /[MY DOC ROOT]/magento2/vendor/magento/framework/Encryption/Encryptor.php on line 397
What am I doing wrong here?
Upvotes: 1
Views: 2483
Reputation: 2037
I got mcrypt installed. As I suspected, nginx was using a different php version (7.0.26) because the new version (7.0.27) wasn't able to listen to port 9000 since it was already in use. For reference, I found this by checking the php-fpm.log file.
To fix this, I used the answer here to find and kill the processes.
I found the processes running:
ps aux | grep php
Then killed them (there were four):
kill [PID]
Then started php:
brew services php70 start
Now my phpinfo page shows that 7.0.27 is running and mcrypt was installed:
Its worth noting the comment from @zaph - mcrypt is deprecated. I'm only getting it running so that I can use Magento as it is a dependency.
Upvotes: 0