3
votes

I recently installed PhpRedis on a LAMP stack with the default PHP 5.3 install for Ubuntu 12.0.4. It worked great.

I subsequently installed the new PHP 5.5 beta 2 using phpbrew. Now when I attempt to run my project on PHP 5.5 I get the following error:

Fatal error: Class 'Redis' not found

I tried copying my php 5.3 redis.ini file to the php 5.5 config and restarting Apache:

$ sudo cp /etc/php5/conf.d/redis.ini /opt/phpbrew/php/php-5.5.0beta2/var/db/redis.ini
$ sudo /etc/init.d/apache2 restart

Now I get an additional error:

Warning: PHP Startup: redis: Unable to initialize module Module compiled with module API=20090626 PHP compiled with module API=20121212 These options need to match in Unknown on line 0

Again, PhpRedis works fine with the default Ubuntu php 5.3 install, which was done using apt-get/ APT.

Additional info:

I used to following online tut to install RedisPhp:

http://anton.logvinenko.name/en/blog/how-to-install-redis-and-redis-php-client.html

And I used the following to install php 5.5 via phpbrew:

https://gist.github.com/fluxsauce/5282006

As always, thanks in advance!!!

1
Just FYI, I fixed this last night. I updated my initial post to explain how I fixed itNeil Girardi
Just a note: Ubuntu version is 12.04 not 12.0.4, where 12=2012 and 04=april. So 12.04 means the version from April 2012. (The first official Ubuntu release Version 4.10, was launched in October 2004)Attila Fulop

1 Answers

2
votes

After much trial and error I fixed this. Apparently I needed to compile the extension with phpize5 as opposed to phpize. Phpize5 compiles extensions with the newer API used by PHP 5.5. Since I now have two PHP installs on my workstation, I also had to specify which version I was compiling the extension for. This is the exact syntax I used:

 $ phpize5 ./configure --with-php-config=/opt/phpbrew/php/php-5.5.0beta2/bin/php-config