Bloc-note d'un développeur web
Dans : Snippets
6 mai 2010Sous Mac OS X Leopard, l’installation du système de cache APC via PECL est en carton. Pour faire simple, l’extension n’est disponible que pour la version CLI de PHP.
Il est cependant possible d’y remédier1 et ainsi disposer d’APC avec la configuration de base fourni par Apple.
$ curl http://pecl.php.net/get/APC -o ~/Downloads/APC-latest.tgz $ tar -zxf !$ -C ~/Downloads/ $ cd ~/Downloads/APC-3.1.3p1/
La version utilisée ici est la 3.1.3p1.
$ /usr/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519
Copier-coller dans la commande qui suit dans son intégralité. Attention à ne pas inclure de retours à la ligne.
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure
Puis un coup de make :
$ make
...
----------------------------------------------------------------------
Libraries have been installed in:
/Users/mehdi/Downloads/APC-3.1.3p1/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Et pour finir, on installe l’extension APC.
$ sudo make install Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/
Éditer le fichier php.ini pour ajouter la configuration qui suit :
extension = apc.so apc.enabled = 1 apc.enable_cli = 1 apc.mmap_file_mask = /tmp/apc.XXXXXX apc.num_files_hint = 1024 apc.shm_segments = 1 apc.shm_size = 128 apc.ttl = 7200 apc.user_ttl = 7200
Relancer Apache pour qu’il prenne en compte la nouvelle extension.
Merci pour le tuto Méhdi ! Connais-tu mon tutoriel pour installer eAccelerator sous OSX/PHP 5.3 ? http://blog.eexit.net/2009/09/installer-eaccelerator-pour-php-5-3-avec-osx.html
Non. Si je tombe dessus je ne manquerai pas de te le signaler
J’ai décroché à partir de /usr/bin/phpize Pour un projet Symfony, j’ai besoin de APC. L’article a l’air d’être sympa mais pour des personnes comme moi qui ont peut de connaissance de facon général ( mac os, apache et unix), c’est pas évident.