1

I need to use different versions of lampp (xampp for linux).
I recently also need to use memcache with any version of lampp I might need to use.
Everything is going right if I use the last lampp version 1.7.7 which contains PHP 5.3.8 I simply do

sudo apt-get install php5-memcache
sudo cp -av '/usr/lib/php5/20090626+lfs/memcache.so' '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/memcache.so'

The problem is when I try to do the same with an older version of lampp.
For example, I uninstalled lampp 1.7.7 and php5-memcache, then I installed lampp 1.7.1, which contains PHP 5.2.9, but doing

sudo apt-get install php5-memcache

I get a newer version of memcache (20090626) for an older version of php (20060613). In fact if I try to copy

sudo cp -av '/usr/lib/php5/20090626+lfs/memcache.so' '/opt/lampp/lib/php/extensions/o-debug-non-zts-20060613/memcache.so'

I get this error while starting lampp:

Starting XAMPP for Linux 1.7.1...
PHP Warning:  PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20090626, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

If I uninstall php5-memcahe and remove memcache.so from lampp extension

sudo apt-get remove php5-memcache
sudo rm /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/memcache.so

if I try to do

sudo pecl i memcache

I get

pecl/memcache is already installed and is the same as the released version 2.2.6
install failed

So how can I install memcache.so version 20060613 when I'm using lampp 1.7.1?

Luca Borrione
  • 755
  • 2
  • 9
  • 16
  • run php_info and see if is memcache builtin. – Sacx Jan 24 '12 at 17:41
  • As far as I can understand it seems to me no. Also when running lampp 1.7.7 I need to install memcache.so manually as described above in order to have memcache running. The only doubt is that now I'm running phpinfo on lampp 1.7.1 and I read mod_mem_cache under Loaded Modules on apache2handler block .. but I think it might be something different from memcache. – Luca Borrione Jan 24 '12 at 17:47
  • mod_mem_cache is an apache module not a php one. – Sacx Jan 24 '12 at 17:57

2 Answers2

1

The simples solution. You need memcache.so build with API 20060613. This is pretty old, but if you go to http://packages.ubuntu.com/hardy/php5-memcache you will find both amd64 and i386 packages. Run

uname -m

to see what architecture you have and download the package accordingly. After you downloaded the package just go in mc open the package, get the memcache.so and copy it on /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/, and add in php.ini

extension=memcache.so

if is saying it doesn't find memcache.so probably you should adjust extensiondir accordingly.

Restart apache and look at php_info(); It should be there.

On future try to stick on ubuntu/debian versions of php/apache/mysql and don't use lampp. I know is much more easy with lampp, but after you understand what it happen "under the hood" will be more easy for you to build your applications and to understand linux. Another problem with lampp are the security updates. If you are using Ubuntu or Debian versions you will have all the upgrades with the OS and the entire process of upgrading it will take seconds not hours or days.

Sacx
  • 2,581
  • 16
  • 13
  • thank you for all your inputs. However I downloaded the i386 packages which is a deb and can't install it `Error: The dependency can not be satisfied: phpapi-20060613+lfs` .. I can I find those packages by myself? Here could be a solution? http://packages.debian.org/sid/phpapi-20060613+lfs – Luca Borrione Jan 25 '12 at 09:09
  • for the "future" part thank you for your advices, but we have for example a "project A" developed under Apache 2.2.11 with MySQL 5.1.33 and PHP 5.2.9 while a "project B" was developed under Apache 2.2.21 with MySQL 5.5.16 and PHP 5.3.8 .. I'm a developer so when they ask me to modify something I need to recreate quickly the correct environment for the project to modify. If they ask me to modify the "project A" I will install lampp 1.7.1 for example and lampp 1.7.7 for the "project B". **How could I install old versions of mysql php and apache using the repository otherwise?** – Luca Borrione Jan 25 '12 at 09:11
  • open the package, don't install it. Go in mc (Midnight commander) and select the deb file and press enter. navigate through it until find memcache.so. – Sacx Jan 25 '12 at 09:42
  • How could I install old versions of mysql php and apache using the repository otherwise? If your eally need that just keep that version of Debian/Ubuntu installed in a vmware or virtual box. Anyway, if the major version of the packages are not changeing, you can use the software as is it. For example you can use Apache 2.2.23 as compatible with Apache 2.2.11. I installed and worked with hundred of sites and I never need lampp or xampp installed. Also Ubuntu / Debian security upgrades will not break the compatibility with your applications. – Sacx Jan 25 '12 at 09:46
  • I guessed it so I've done it before by myself but I got an error. I thought it wouldn't be done like this, so I haven't mentioned it. I've done it again now under your advice and it worked! I don't know what I've done wrong before, it doesn't matter now. Thank you very much for your help .. for the compatibility part I'll better open a question regarding it, because I think it's OT here .. I'll advice you through here. A big thank again – Luca Borrione Jan 25 '12 at 10:04
  • I'm glad is working. :) – Sacx Jan 25 '12 at 12:26
0

When using the automated tools to install apache and php you are pretty limited to how much flexibility you have with running different versions of applications.

I would download the source for apache and php and install them via

./configure {with all the options and independent paths that you want} make ; make install

This will allow you to do two things.

  1. Keep your environment separate to automated tools such as yum and apt-get install
  2. It will allow you to install an independent version specific version of pecl addons

It may be a little more complicated to manage in the long run. But it will give you much more comparability as you grow and adapt.

Also you issue with pecl is you may have already installed it. Try running

[path]/pecl list

It will tell you what you already have installed. To remove you can use

pecl remove [product name]

To uninstall any plugins you don't want installed

J Baron
  • 338
  • 1
  • 7