PECL Manual Install on Linux Centos

Just bought a VPS server hosting to play around from Media Temple. The Dedicated Virtual (DV) package come with Linux Centos, and all this while I’ve been a FreeBSD user, think it shouldn’t be hard to use Linux 😀 Sorry I’m a n00b on Linux.

yum is fun, I did yum install memcache and yum install php-pecl-memcache. memcache daemon service started successfully but php-pecl-memcache ain’t working.

memcache.ini is included in /etc/php.d/ and from phpinfo(), I can clearly seen memcache.ini is included as well. But, when I search for memcache module info, the module seem not loaded with into php.


I remove php-pecl-memcache and tried to install with pecl install memcache, not good, pecl install were not working and the error message;

shell> pecl install memcache
downloading memcache-2.2.5.tgz ...
Starting to download memcache-2.2.5.tgz (35,981 bytes)
..........done: 35,981 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         xxxxx
Zend Module Api No:      xxxxx
Zend Extension Api No:   xxxxx
 1. Enable memcache session handler support? : yes

1-1, 'all', 'abort', or Enter to continue: 
building in /var/tmp/pear-build-root/memcache-2.2.5
running: /var/cache/php-pear/memcache-2.2.5/configure --enable-memcache-session=yes
checking for egrep... grep -E
checking for a sed that does not truncate output... //bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/var/cache/php-pear/memcache-2.2.5/configure --enable-memcache-session=yes' failed

Search for the error message, and it seem like it’s something to do with mount point permission for /var or /var/tmp partition.

Not wanting to do much on un-mount and re-mount the drive, I tried to install php-pecl-memcache manually.

Manual Compile PECL Extension with phpize

I will take memcahe as PECL extension for example, first I need to download the package file from PECL website, untar it and start compiling

shell> wget
shell> tar zxfv memcache-2.2.5.tgz
shell> cd memcache-2.2.5 && phpize && ./configure && make && make install

After the installation, create memcahe.ini in /etc/php.d/

; Enable memcache extension module

; Options for the memcache module

; Whether to transparently failover to other servers on errors
; Defines how many servers to try when setting and getting data.
; Data will be transferred in chunks of this size
; The default TCP port number to use when connecting to the memcached server 
; Hash function {crc32, fnv}
; Hash strategy {standard, consistent}

Restart apache webserver with /etc/init.d/httpd restart and write a phpinfo() file, now I can see memcache module is loaded


Anyone have the same error like I do and you have other workaround, please do let me know. Or change the permission on /etc/mtab 🙂

Need to get familiar with Linux Centos…