Linux下利用phpize安装php扩展
php有很多扩展功能,我们在初次安装的时候并没有安装某些扩展,可能在使用的过程中,又需要用到这些扩展。php提供了一个phpize工具供我们安装需要的扩展。 下面我通过安装socket扩展来介绍phpize的使用: 1.找到自己的php安装目录,例如我的目录是home/vsran
php有很多扩展功能,我们在初次安装的时候并没有安装某些扩展,可能在使用的过程中,又需要用到这些扩展。php提供了一个phpize工具供我们安装需要的扩展。
下面我通过安装socket扩展来介绍phpize的使用:
1.找到自己的php安装目录,例如我的目录是home/vsrank/php,在该目录下,找到bin/phpize。如果没有这个工具,则说明没有安装该工具,那么需要安装php.dev,一般都会有这个工具。
2.要扩展的话,就需要有一个和当前已安装的php的版本一样的php的源包,当前php版本可以用过phpinfo()查看。就是初次安装后查看安装是否成功的那个test.php。
3.打开源包目录,进入到ext目录,例如我就进入到:/home/vsrank/php-5.3.10/ext下,ext下有各个php带有的扩展模块,进入到ext/sockets中。
4.cd到ext/sockets后,执行下面的命令:
/home/vsrank/php/bin/phpize
即执行phpize工具,执行后,可以看到目录下生成了对应的configure文件:
5.现在就可以通过configure来配置,执行下面的命令:
./configure --enable-sockets --with-php-config=/home/vsrank/php/bin/php-config make make install
执行之后,可以看到下面的输出:
Installing shared extensions: /home/vsrank/php/lib/php/extensions/no-debug-non-zts-20090626/ Installing header files: /home/vsrank/php/include/php/
第一个就是扩展模块的生成目录,可以在对应目录下看到对应的sockets.so文件。
6.更改php.ini,增加下面的语句:
extension="/home/vsrank/php/lib/php/extensions/no-debug-non-zts-20090626/sockets.so"
可以看到和上面的输出是一致的。
7.重启Apache,接下来就可以看看自己的socket是不是配置好了。。
参考资料:
phpize是什么?http://www.itokit.com/2012/0501/73714.html
http://blog.chinaunix.net/uid-405749-id-28319.html
http://topic.csdn.net/u/20100426/16/3dc3ca94-43b9-49a5-b509-43b56802f8e1.html?seed=1620302575&r=78631411#r_78631411
感谢各位网友的分享!!也希望本文能帮到其他的朋友。
注:初次安装扩展的时候,在make的时候,出现了如下错误:
sockets.lo is not a valid libtool....
原因未明,解决方法,删掉源包,重新解压,全部重做一遍,问题解决.....好暴力。。。。。

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



Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

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.

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,

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

Using python in Linux terminal...
