debian下安装php的一些扩展geoip,mongo,redis,libevent,proctitl
因为项目的关系,需要安装一些新的扩展 debian xfce 7.2 x64 下面3个都是通过apt-get安装的。 PHP 5.4.4-14deb7u5 (cli) nginx1.2.1 apache 2.2.22 1: 通过默认的方法安装(最优),大部分常用的都在debian的仓库里面,可以下载到注意,#是代表root 可通过su -
因为项目的关系,需要安装一些新的扩展
debian xfce 7.2 x64 下面3个都是通过apt-get安装的。
PHP 5.4.4-14+deb7u5 (cli)
nginx1.2.1
apache 2.2.22
1: 通过默认的方法安装(最优),大部分常用的都在debian的仓库里面,可以下载到 注意,#是代表root 可通过su - 输入密码后进入root
#apt-get install php5-geoip #apt-get install php-apc #apt-get install libevent-dev
2:通过pecl 安装(其次)
#pecl install mongo #pecl install channel://pecl.php.net/libevent-0.1.0 #pecl install channel://pecl.php.net/proctitle-0.1.2 #pecl install inotify #pecl install yaf
比如上面的3个扩展,pecl后
在debian的
/usr/lib/php5/20100525/mongo.so /usr/lib/php5/20100525/libevent.so /usr/lib/php5/20100525/proctitle.so /usr/lib/php5/20100525/inotify.so /usr/lib/php5/20100525/yaf.so
php5在/etc/php5 执行下面的shell命名,这是建立一些配置文件,debian的php的php.ini 把配置文件分散到了/etc/php5/conf.d, 而conf.d 的内容都来自/etc/php5/mods-available/ 为了debian包的严谨,我们这里就作两次链接,而不是直接去conf.d 建对应的.ini 文件.
#echo "extension=mongo.so" > /etc/php5/mods-available/mongo.ini #echo "extension=libevent.so" > /etc/php5/mods-available/libevent.ini #echo "extension=proctitle.so" > /etc/php5/mods-available/proctitle.ini #echo "extension=inotify.so" > /etc/php5/mods-available/inotify.ini #echo "extension=yaf.so" > /etc/php5/mods-available/yaf.ini #ln -s /etc/php5/mods-available/mongo.ini /etc/php5/conf.d/mongo.ini #ln -s /etc/php5/mods-available/libevent.ini /etc/php5/conf.d/libevent.ini #ln -s /etc/php5/mods-available/proctitle.ini /etc/php5/conf.d/proctitle.ini #ln -s /etc/php5/mods-available/inotify.ini /etc/php5/conf.d/inotify.ini #ln -s /etc/php5/mods-available/yaf.ini /etc/php5/conf.d/yaf.ini
3:通过扩展的源码安装(编译安装,对于debian不是很推荐,前提是仓库没有) 安装的是php-redis 扩展
(redis server需要你自己安,编译的环境这些软件参考我前面的文章安装就行了,gcc之类的
#wget https://redis.googlecode.com/files/redis-2.6.14.tar.gz #tar -zxvf redis #make
)
#tar -zxvf nicolasff-phpredis-2.1.3-124-gd4ad907.tar.gz #cd nicolasff-phpredis-00233a3 #phpize #./configure --with-php-config=/usr/bin/php-config
#make && make install #echo "extension=redis.so" > /etc/php5/mods-available/redis.ini #ln -s /etc/php5/mods-available/redis.ini /etc/php5/conf.d/redis.ini
同上,需要重启server
4:通过php源码安装(开关某些php默认安装了但是关闭的扩展,这里我们要开启的是pcntl)
#mkdir php #cd php #apt-get source php5
这里我们进去 php5-(版本号)/ext/pcntl
#cd php5-5.4.4/ext/pcntl #phpize #./configure #make && make install #echo "extension=pcntl.so" > /etc/php5/mods-available/pcntl.ini #ln -s /etc/php5/mods-available/pcntl.ini /etc/php5/conf.d/pcntl.ini
同上,重启server就可以了
如果php报错,PHP Warning: Module ‘pcntl’ already loaded in Unknown on line 0
那就说明已经装上了,现在是重复装的,需要把上面添加的两个pcntl.ini文件删除掉。 然后去把php.ini 文件里面的
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
加 ; 注释掉。重启server就可以了, 注意,php.ini 在apache2,nginx里面都不同的, apache2的在/etc/php5/apache2/php.ini nginx我指定的是cgi里面的/etc/php5/cgi/php.ini
看你server用的哪个,就去注释掉哪个就可以了
5. 通过git clone来安装uv(需要你有git环境)
#git clone https://github.com/chobie/php-uv.git --recursive #cd php-uv #cd libuv && make #cd .. #phpize #./configure
如果phpize报错说找不到config.m4 说明你用的是64位的, 需要执行下面的几个步骤
#make clean #cd ./libuv #make clean
然后修改下php-uv/libuv/Makefile
#vim Makefile
大概是改27行的位置, 加上-fPIC
ifdef MSVC uname_S := MINGW endif CPPFLAGS += -Iinclude -Iinclude/uv-private -fPIC CARES_OBJS = CARES_OBJS += src/ares/ares__close_sockets.o
#make #cd .. #phpize #./configure #make && make install
即可, 然后就
#echo "extension=uv.so" > /etc/php5/mods-available/uv.ini #ln -s /etc/php5/mods-available/uv.ini /etc/php5/conf.d/uv.ini

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
