php 编译安装
防报错依赖:
ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel openssl-devel libtool*zlib-devel libxml2-devel libjpeg-devel libpng-devel libtiff-devel fontconfig-devel freetype-devel libXpm-develgettext-devel curl curl-devel pam-devel e2fsprogs-devel krb5-devel libidn libidn-devel libxslt-devel readline-devel gmp-devel
编译安装:
# tar xf php-5.4.13.tar.bz2# cd php-5.4.13# ./configure --prefix=/usr/local/php \--with-apxs2=/usr/local/apache/bin/apxs \--with-config-file-path=/etc \--with-config-file-scan-dir=/etc/php.d \--with-mhash \--with-bz2 \--with-curl \--with-freetype-dir \--with-gd \--with-gettext \--with-gmp \--with-imap-ssl \--with-jpeg-dir \--with-mcrypt \--with-sqlite3 \--with-openssl \--with-png-dir \--with-readline \--with-xmlrpc \--with-xsl \--with-zlib \--with-mysql=/usr/local/mysql \--enable-bcmath \--enable-calendar \--enable-ctype \--enable-dom \--enable-exif \--enable-ftp \--enable-gd-native-ttf \--enable-intl \--enable-json \--enable-mbstring \--enable-pcntl \--enable-session \--enable-shmop \--enable-simplexml \--enable-soap \--enable-sockets \--enable-tokenizer \--enable-wddx \--enable-xml \--enable-zip \--enable-opcache \--enable-maintainer-zts
PS:
如果使用PHP5.3以上版本,为了链接MySQL数据库,可以指定mysqlnd,这样在本机就不需要先安装MySQL或MySQL开发包了。mysqlnd从php 5.3开始可用,可以编译时绑定到它(而不用和具体的MySQL客户端库绑定形成依赖),但从PHP 5.4开始它就是默认设置了。
例如: ./configure --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd
# make# make test # 时间巨长# make intall
为php提供配置文件:
# cp php.ini-production /etc/php.ini
编辑apache配置文件httpd.conf,以apache支持php
# vim /etc/httpd/httpd.confAddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phpsDirectoryIndex index.php index.html
而后重新启动httpd,或重读配置文件测试php是否正常使用
关键字:php, linux
版权声明
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!