View PHP Modules
[Email protected] ~]# php-m
[PHP Modules]
bz2
Core
CType
Date
Dom
Ereg
Exif
FileInfo
Filter
Gd
Hash
Iconv
Json
Libxml
Mbstring
MCrypt
Mysql
Openssl
Pcre
Pdo
Pdo_sqlite
Phar
Posix
Reflection
Session
SimpleXML
Soap
Sockets
Spl
Sqlite3
Standard
Tokenizer
Xml
XmlReader
XmlWriter
Zlib
[Zend Modules]
If we find a module that is not compiled, there are two solutions: first, recompile, reconfigure, and second, compile the module separately and load the module with dynamic sharing. We're trying to compile a php dynamic sharing module ourselves.
The ext directory of the PHP installation package contains the source code for many modules:
[Email protected] ~]# cd/usr/local/src/php-5.4.36
[[Email protected] php-5.4.36]# CD ext
[[email protected] ext]# ls
Bcmath DBA FileInfo iconv mbstring ODBC pdo_mysql POSIX simplexml standard WDDX zlib
BZ2 DOM Filter IMAP mcrypt OpenSSL pdo_oci Pspell skeleton sybase_ct Xml
Calendar enchant FTP interbase MSSQL pcntl PDO_ODBC readline SNMP sysvmsg XmlReader
Com_dotnet ereg GD Intl MySQL pcre pdo_pgsql recode soap Sysvsem Xmlrpc
CType Exif GetText JSON mysqli PDO pdo_sqlite reflection sockets Sysvshm XmlWriter
Curl Ext_skel GMP LDAP MYSQLND pdo_dblib pgsql session SPL Tidy Xsl
Date ext_skel_win32.php Hash libxml oci8 pdo_firebird Phar Shmop sqlite3 tokenizer Zip
PHP does not have a Curl module installed by default, and the following command returns no results:
[Email protected] ext]# php-m |grep-i Curl
Let's take a sample of the Curl module that compiles and installs PHP: Enter the Curl directory
[[Email protected] ext]# CD Curl
[[email protected] curl]# ls
CONFIG.M4 config.w32 CREDITS curl.dsp interface.c multi.c package.xml php_curl.h streams.c tests
To generate configure related files:
[[email protected] curl]# Yum install-y M4 autoconf# install two auto-generated configure tools
[[email protected] curl]#/usr/local/php/bin/phpize# generate configure
Configuring for:
PHP Api version:20100412
Zend Module Api no:20100525
Zend Extension Api no:220100525
[[email protected] curl]# ls
ACINCLUDE.M4 config.h.in config.w32 ltmain.sh package.xml
ACLOCAL.M4 config.m4 CREDITS Makefile.global php_curl.h
Autom4te.cache config.sub curl.dsp Missing run-tests.php
Build Configure Install-sh Mkinstalldirs STREAMS.C
Config.guess configure.in interface.c MULTI.C tests
Configuration
[Email protected] curl]#/configure--with-php-config=/usr/local/php/bin/php-config
Error 1:configure:error:please Reinstall the Libcurl distribution-
Easy.h should is in <curl-dir>/include/curl/
FIX: [[email protected] curl]# yum-y install Curl-devel
Compile
[[email protected] curl]# make
[[email protected] curl]# echo $?
0
Installation
[[email protected] curl]# make install
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
[[email protected] curl]# echo $?
0
Module has been generated
[Email protected] curl]# ls/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
Curl.so
View Extension_dir
[Email protected] curl]# php-i |grep extension_dir
Extension_dir =/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 =/usr/local/php/lib/php/ extensions/no-debug-non-zts-20100525
Sqlite3.extension_dir = no value = no value
[Email protected] curl]# ls/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
Curl.so
You can also customize Extension_dir
[Email protected] curl]# Vim/usr/local/php/etc/php.ini
......
; Directory in which the loadable Extensions (modules) reside.
; Http://php.net/extension-dir
; Extension_dir = "./"
; On Windows:
; Extension_dir = "ext"
......
Configure Load Curl.so
......
; Extension=php_pgsql.dll
; Extension=php_pspell.dll
; Extension=php_shmop.dll
Extension=curl.so
......
To view dynamically loaded modules
[Email protected] curl]# php-m |grep Curl
Curl
Lamp build 18:php Install expansion module