Home php教程 php手册 Linux下利用phpize安装php扩展

Linux下利用phpize安装php扩展

Jun 06, 2016 pm 07:58 PM
linux php use Install Expand

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
Copy after login

即执行phpize工具,执行后,可以看到目录下生成了对应的configure文件:



5.现在就可以通过configure来配置,执行下面的命令:


./configure --enable-sockets --with-php-config=/home/vsrank/php/bin/php-config

make

make install
Copy after login

执行之后,可以看到下面的输出:


Installing shared extensions:     /home/vsrank/php/lib/php/extensions/no-debug-non-zts-20090626/
Installing header files:          /home/vsrank/php/include/php/
Copy after login

第一个就是扩展模块的生成目录,可以在对应目录下看到对应的sockets.so文件。


6.更改php.ini,增加下面的语句:

extension="/home/vsrank/php/lib/php/extensions/no-debug-non-zts-20090626/sockets.so"
Copy after login

可以看到和上面的输出是一致的。


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....

原因未明,解决方法,删掉源包,重新解压,全部重做一遍,问题解决.....好暴力。。。。。



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

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 permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

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...

Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Apr 01, 2025 pm 03:06 PM

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

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

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.

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

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,

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

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...

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

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...

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

See all articles