0

I'm trying to set up a new dev environment to match a production system running PHP 5.4 on RHEL 6.5. Because PHP 5.4 is EOL and because I couldn't figure out which magic combination of repos were necessary to install PHP 5.4 on my new RHEL dev server, I opted to go to PHP 5.6 on the development server. I managed to install 5.6 and bring in my Laravel 4.1 project, but when I loaded it in my browser, I received the following: Mcrypt PHP extension required. I have verified that the php56u-mcrypt-5.6.14-1.ius.el6.x86_64 package is installed; I have verified that /etc/php.d/20-mcrypt.ini is loading the extension; I have verified that php -m | grep mcrypt shows that the module is loaded; I have verified that php -i | grep mcrypt shows that /etc/php.d/20-mcrypt.ini is in fact being loaded and that mcrypt support registers as enabled; I have restarted apache more times than I can remember; and I have even verified that /usr/lib64/php/modules/mcrypt.so exists. The strange thing is that I do NOT receive this message when trying to run composer commands, which seems to be a common thread elsewhere.

Where this leaves me is, I have a seemingly working installation of mcrypt on the command line but not through Apache, which suggests that the problem is there, not with my installation of mcrypt per se. But the apache config file I'm using on my new test server is no different from the one in use on my production server (thanks, Puppet!) and I never had this problem on the production server. I'm stumped. Any suggestions?

tmountjr
  • 163
  • 7

1 Answers1

0

Figures I'd find the answer after sleeping on it. As it turns out, I was running two different versions of PHP even though I'd only installed one. I discovered this by creating a page to show phpinfo() in the browser and comparing with the console output for php -v: the browser showed PHP 5.4.x while the CLI displayed 5.6.x. My puppet config was a little different (owning to the different PHP version install) and I hadn't installed the libphp5.so and libphp5-zts.so modules correctly (they were copied from an older installation). So Apache was using those modules and then complaining that mcrypt for php 5.4 wasn't installed, which was correct. But since the CLI version was 5.6, and mcrypt was installed correctly there, the CLI programs like artisan were working just fine. The solution, in my case, was to run yum reinstall php56u to get those correctly-versioned modules in place. Once I did that, apache and the CLI got on the same page and my application started working.

tmountjr
  • 163
  • 7