1. 错误 configure: error: Please reinstall the pkg-config distribution
wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
tar -zxvf pkg-config-0.28.tar.gz
cd pkg-config-0.28
./configure --with-internal-glib
make && make install
2. error: Either a previously installed pkg-config or “glib-2.0 >= 2.16” could not be found.
Check for pkg-config via $ which pkg-config, if not found you will want to install it:
$ curl https://pkg-config.freedesktop.org/releases/pkg-config-0.28.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.28
$ ./configure && make install If you run into an error like the following:
configure: error: Either a previously installed pkg-config or "glib-2.0 >= 2.16" could not be found. Please set GLIB_CFLAGS and GLIB_LIBS to the correct values or pass --with-internal-glib to configure to use the bundled copy. run `./configure --with-internal-glib && make install`
3. mac下安装php memecached扩展遇到的问题
1. memecached安装依赖libmemcached
直接使用brew安装(因为编译安装依赖别的库,一直编译不过去,所以就没有继续进行),安装路径返回来后运行下面的命令
./configure --with-memcached -with-php-config=/usr/bin/php-config --with-libmemcached-dir=/usr/local/Cellar/libmemcached/1.0.18_1 --enable-memcached
make
make install
2. 命令行模式下一直报错,PHP Fatal error: Uncaught Error: Class 'Memcached' not found in
这个很奇怪,在浏览器中访问phpinfo,明明安装memcached成功了,但是命令行下找不到,写了一个测试脚本,运行 php test.php
,仍然报错,但是在浏览器中运行就不报错。
后来找到原因,使用 php XX.php 这种方式,默认搜索到 /usr/bin/php 并使用它来执行,而我们真正编译安装的 PHP 则是在这里: /usr/local/bin/php。
所以运行
/usr/local/bin/php test.php