Compile php5.4 and add extensions after installation
Today because the development needs php5.4 no corresponding RPM package, so only download the source package compiled
Download php5.4 Package: wget http://cn2.php.net/get/php-5.4.8.tar.gz/from/this/mirror
Tar zxvf php-5.4.8.tar.gz
PHP modules should not be installed at the time of compilation, so as not to upgrade trouble later,
./configure--prefix=/usr/local/webserver/php \
??????? --with-zlib \
??????? --with-mysql=/data/mysql \
??????? --with-jpeg-dir=/usr/local/jpeg \
??????? --with-png-dir=/usr/local/libpng \
??????? --with-freetype-dir=/usr/local/freetype \
??????? --with-libexpat-dir \
??????? --with-iconv \
??????? --WITH-TTF \
??????? --with-curl \
??????? --with-curlwrappers \
??? --disable-sqlite \
??????? --ENABLE-GD-NATIVE-TTF \
??????? --enable-mbstring \
??????? --enable-sockets \
??????? --ENABLE-FASTCGI \
??????? --enable-force-cgi-redirect \
??????? --enable-discard-path \
??????? --enable-safe-mode \
??????? --enable-sysvsem \
??????? --ENABLE-SYSVSHM \
??????? --ENABLE-SYSVMSG \
??????? --enable-inline-optimization \
??????? --disable-xmlreader \
??????? --disable-debug \
??????? --disable-rpath \
??? --disable-libxml \
??? --disable-dom \
??? --DISABLE-PDO \
??? --disable-simplexml \
??? --disable-xml \
??? --disable-xmlwriter \
??????? --without-pear \
??????? --ENABLE-FPM \
??????? --with-fpm-user=nobody \
??????? --with-fpm-group=nobody \
??????? --with-fpm-log=/var/log/php-fpm.log \
??????? --with-fpm-pid=/var/run/php-fpm/php-fpm.pid
Encountered Configure:error:Cannot find LIBZ solution on the way
Yum Install zlib.x86_64
Yum Install zlib-devel.x86_64
Compilation encountered again: Configure:error:Please Reinstall the Libcurl distribution-easy.h should solution
Yum-y Install Curl-devel
This compilation is finally a success.
Make &&make Install
When you are not familiar with the parameters behind the./configurg, you can use./configurg--help Look, there are more detailed instructions
Copy php.ini-production to PHP directory: CP php.ini-production? /usr/local/webserve/php/lib/php.ini
Modify PHP/ETC/PHP-FPM configuration file: MV Php-fpm.conf.default php-fpm.conf
Installing the extension pdo_mysql
This generally in the PHP source code package will have this extension: generally in the./ext/pdo_mysql/Directory
cd/php5.4/ext/pdo_mysql/
/usr/local/webserver/php/bin/phpize
Tip cannot find autoconf. Please check your autoconf installation and the
$PHP _autoconf environment variable. Then, rerun the this script.
Missing autoconf
This package is the GNU tool used to automatically configure the source code. Otherwise the Configure file will not be generated in the Pdo_mysql directory
Use everything again normal:/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config--with-pdo-config=/data/mysql/bin/mysql_ Config
Another error has been encountered: Configure:error:Cannot find Php_pdo_driver.h.
Find a bit of information, did not find someone encountered this problem, with locate Php_pdo_driver.h found in the PDO module directory has, checked the data found, to install Pdo_mysql must first install the PDO module, OK, first installed PDO module bar
Cd? php5.4/ext/pdo/
/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config? --enable-pdo=shared
Make &&make Install
CD php5.4/ext/pdo_mysql/
/usr/local/webserver/php/bin/phpize
./configure--with-php-config=/usr/local/webserver/php/bin/php-config--with-pdo-mysql=/data/mysql/bin/mysql_ Config
Make &&make Install
After compiling successfully, you will see the directory of the extension module in the PHP installation directory.
Add the following lines to the Php/lib/php.ini file
Extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20100525/"
Extension=pdo.so
Extension=pdo_mysql.so
Extension=memcache.so
[Root@localhost yum.repos.d]# Php-m
[PHP Modules]
Core
CType
Curl
Date
Ereg
FileInfo
Filter
Hash
Iconv
Json
Mbstring
Memcache
Mysql
Pcre
Pdo
Pdo_mysql
Phar
Posix
Reflection
Session
Sockets
Spl
Sqlite3
Standard
Sysvmsg
Sysvsem
Sysvshm
Tokenizer
Zlib
[Zend Modules]
Or:/usr/local/webserver/php/bin/php-r "phpinfo ();" | Grep-i Pdo_mysql
Finally succeeded.
?
Go to http://198555.blog.51cto.com/188555/1063199.