linux(ubuntu14.04)安装配置php
2014-05-08 10:55
811 查看
1,下载并安装libxml2,php安装依赖
(1)下载地址:http://xmlsoft.org/
(2)#cp/home/xxx/Downloads/libxml2-2.7.2.tar.gz /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd/usr/local/src
(4)#tar-zxvf libxml2-2.7.2.tar.gz #解压
(5)#cdlibxml2-2.7.2
(6)#./configure --prefix=/usr/local/libxml2
(7)#make
(8)#makeinstall
2,安装re2c
(1)下载地址:http://re2c.org/
(2)#cp /home/xxx/Downloads/re2c-0.13.6.tar.gz /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd/usr/local/src
(4)#tar-zxvf re2c-0.13.6.tar.gz #解压
(5)#cd re2c-0.13.6
(6)#./configure --prefix=/usr/local/re2c
(7)#make
(8)#make install
3,安装php
(1)下载php5.4.28(之前在一页面上隐约看见有人说5.5以后不支持windows,为了保险兼容,安装5.4)
地址:http://www.php.net/downloads.php
(2)#cp /home/xxx/Downloads/php-5.4.28 /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd /usr/local/src
(4)#tar -zxvf php-5.4.28.tar.gz #解压
(5)#cd php-5.4.28
(6)#./configure
--prefix=/usr/local/php-5.4.28
--with-config-file-path=/usr/local/php-5.4.28/etc
--with-apxs2=/usr/local/apache2/bin/apxs
--with-libxml-dir=/usr/local/libxml2
--with-mysql=/usr
--with-mysqli
--with-pdo-mysql
--enable-soap
--with-gd
--enable-sockets
--enable-mbstring
--disable-ipv6
--enable-exif
--with-zlib
--with-curl
--with-curlwrappers
--enable-calendar
--with-gettext
--enable-gd-native-ttf
--with-bz2
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-iconv-dir
--with-snmp
--with-pear
--with-xpm-dir
--with-t1lib
--with-mcrypt
--with-mhash
--with-openssl
--with-xmlrpc
--with-xsl
--enable-exif
--enable-wddx
--enable-zip
--enable-bcmath
--enable-ftp
--enable-shmop
--enable-dba
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
点回车后出现错误:
configure: error:Cannot find MySQL header files under /usr/lib/mysql
Note that the MySQL Client library isnot boundled anymore.
#find / -name mysql.h #查找mysql头文件,没找到
#apt-get install libmysqlclient-dev #安装dev
#(注)red-hat下使用rpm -ivh MySQL-devel-4.1.12-1.i386.rpm安装(来自网络文章)
#find / -name mysql.h
/usr/include/mysql/mysql.h #找到呢
configureerror:please reinstall the libcurl distribution - easy.h should be in<curl-dir>/include/curl/
#apt-get install curl libcurl3 libcurl3-devphp5-curl
#安装完后重启apache2
#sudo service apache2 restart
#如果仍有问题,修改php.ini文件,在最后加上一行:extension=curl.so
configure: error: jpeglib.h not found.
#apt-get install libjpeg-dev
configure: error: png.h not found.
#apt-get install libpng-dev
configure: error: Please reinstall the BZip2distribution
在bzip.org下载最新的bzip2-1.0.6.tar.gz,解压并make &&make install
configure: error: libXpm.(a|so) not found.
#apt-get install libxpm-dev
继续执行,仍然报同样的错误。
可是明明已经安装了啊,
#find / -name libXpm.so
原来是安装在/usr/lib/i386-linux-gnu/libXpm.so下面。
#ln -s /usr/lib/i386-linux-gnu/libXpm.so/usr/lib/libXpm.so
configure: error: freetype.h not found.
#apt-get install libfreetype6-dev
configure: error: Your t1lib distribution is not installed correctly.Please reinstall it.
#apt-get install libt1-dev
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
#apt-get install libmcrypt-dev
configure: error: xslt-config not found. Please reinstall the libxslt>= 1.1.0 distribution
#apt-get install libxslt-dev
configure: error: Could not findnet-snmp-config binary, Please check your net-snmp installation.
重新安装net-snmp: http://www.net-snmp.org/wiki/index.php/Net-Snmp_on_Ubuntu
下载:http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/
先安装perl
#apt-get install libperl-dev
然后再装net-snmp
#tar -zxvf net-snmp-5.6.2.1.tar.gz
#cd net-snmp-5.6.2.1
#./configure --with-default-snmp-version="3"--with-sys-contact="@@no.where"--with-sys-location="Unknown"
--with-logfile="/var/log/snmpd.log"--with-persistent-directory="/var/net-snmp"
#make
#make install
(7)重新检查,全部通过
(8)#make
出现错误:
make: *** [sapi/cli/php] Error 1
google ,
网上解决方法:
方法一:
#vim Makefile
找到"EXTRA_LIBS"这一行,在最后加上"-liconv"
方法二:
make ZEND_EXTRA_LIBS='-liconv'
木用,
#find / -name libiconv.so.2
没找到,可能是没安装,
于是安装libiconv
下载地址: http://www.gnu.org/software/libiconv/ http://mirror.bjtu.edu.cn/gnu/libiconv/
#tar -zxvf libiconv-1.10.tar.gz
#./configure --prefix=/usr/local/libiconv
#make
#make install
(9)#./configure重新检查
(10)make
出现错误:
libxslt.so:undefined reference to ........
安装libxslt
#apt-get install libxslt1-dev
重新configure和make,仍然不能通过,
googlebaidu搜遍地球和宇宙,花了两天工夫,仍然不能解决这个xslt的错误。
无奈放弃,从configure参数里去掉--with-xsl,
#./configure .......
#make
成功
#make test
(11)#make install
(12)安装成功
4,配置php
(1)#cd /usr/local/php-5.4.28/etc
(2)#cp /usr/local/src/php-5.4.28/php.ini-production php.ini
(3)#vim php.ini
修改三个参数(drupal项目里已经出现的错误对应):
max_execution_time = 60
max_input_time = 120
upload_max_filesize=8M(默认为2M)
(4)修改apache配置文件以支持php
i,#cd /usr/local/apache2/conf
ii,#vim httpd.conf
iii,找到AddType application/x-gzip .gz .tgz 这一行,在下面加上
AddType application/x-httpd-php .php
iv,找到
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
这一节,
修改里面的这一行,在后面加上index.php,
DirectoryIndex index.html index.php
v,重启apache服务
vi,#cd /data/www 移到网站根目录
vii,#vim index.php 建立一个php文件
在里面输入
<?php phpinfo(); ?>
保存。
viii,切换到图形模式,打开浏览器,输入
http://localhost
vvi,如果能正常显示页面,出现配置信息,说明安装配置成功。
php安装可参见:http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi:troubleshoot
(1)下载地址:http://xmlsoft.org/
(2)#cp/home/xxx/Downloads/libxml2-2.7.2.tar.gz /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd/usr/local/src
(4)#tar-zxvf libxml2-2.7.2.tar.gz #解压
(5)#cdlibxml2-2.7.2
(6)#./configure --prefix=/usr/local/libxml2
(7)#make
(8)#makeinstall
2,安装re2c
(1)下载地址:http://re2c.org/
(2)#cp /home/xxx/Downloads/re2c-0.13.6.tar.gz /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd/usr/local/src
(4)#tar-zxvf re2c-0.13.6.tar.gz #解压
(5)#cd re2c-0.13.6
(6)#./configure --prefix=/usr/local/re2c
(7)#make
(8)#make install
3,安装php
(1)下载php5.4.28(之前在一页面上隐约看见有人说5.5以后不支持windows,为了保险兼容,安装5.4)
地址:http://www.php.net/downloads.php
(2)#cp /home/xxx/Downloads/php-5.4.28 /usr/local/src #把下载的压缩文件拷贝到src目录
(3)#cd /usr/local/src
(4)#tar -zxvf php-5.4.28.tar.gz #解压
(5)#cd php-5.4.28
(6)#./configure
--prefix=/usr/local/php-5.4.28
--with-config-file-path=/usr/local/php-5.4.28/etc
--with-apxs2=/usr/local/apache2/bin/apxs
--with-libxml-dir=/usr/local/libxml2
--with-mysql=/usr
--with-mysqli
--with-pdo-mysql
--enable-soap
--with-gd
--enable-sockets
--enable-mbstring
--disable-ipv6
--enable-exif
--with-zlib
--with-curl
--with-curlwrappers
--enable-calendar
--with-gettext
--enable-gd-native-ttf
--with-bz2
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-iconv-dir
--with-snmp
--with-pear
--with-xpm-dir
--with-t1lib
--with-mcrypt
--with-mhash
--with-openssl
--with-xmlrpc
--with-xsl
--enable-exif
--enable-wddx
--enable-zip
--enable-bcmath
--enable-ftp
--enable-shmop
--enable-dba
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
点回车后出现错误:
configure: error:Cannot find MySQL header files under /usr/lib/mysql
Note that the MySQL Client library isnot boundled anymore.
#find / -name mysql.h #查找mysql头文件,没找到
#apt-get install libmysqlclient-dev #安装dev
#(注)red-hat下使用rpm -ivh MySQL-devel-4.1.12-1.i386.rpm安装(来自网络文章)
#find / -name mysql.h
/usr/include/mysql/mysql.h #找到呢
configureerror:please reinstall the libcurl distribution - easy.h should be in<curl-dir>/include/curl/
#apt-get install curl libcurl3 libcurl3-devphp5-curl
#安装完后重启apache2
#sudo service apache2 restart
#如果仍有问题,修改php.ini文件,在最后加上一行:extension=curl.so
configure: error: jpeglib.h not found.
#apt-get install libjpeg-dev
configure: error: png.h not found.
#apt-get install libpng-dev
configure: error: Please reinstall the BZip2distribution
在bzip.org下载最新的bzip2-1.0.6.tar.gz,解压并make &&make install
configure: error: libXpm.(a|so) not found.
#apt-get install libxpm-dev
继续执行,仍然报同样的错误。
可是明明已经安装了啊,
#find / -name libXpm.so
原来是安装在/usr/lib/i386-linux-gnu/libXpm.so下面。
#ln -s /usr/lib/i386-linux-gnu/libXpm.so/usr/lib/libXpm.so
configure: error: freetype.h not found.
#apt-get install libfreetype6-dev
configure: error: Your t1lib distribution is not installed correctly.Please reinstall it.
#apt-get install libt1-dev
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
#apt-get install libmcrypt-dev
configure: error: xslt-config not found. Please reinstall the libxslt>= 1.1.0 distribution
#apt-get install libxslt-dev
configure: error: Could not findnet-snmp-config binary, Please check your net-snmp installation.
重新安装net-snmp: http://www.net-snmp.org/wiki/index.php/Net-Snmp_on_Ubuntu
下载:http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/
先安装perl
#apt-get install libperl-dev
然后再装net-snmp
#tar -zxvf net-snmp-5.6.2.1.tar.gz
#cd net-snmp-5.6.2.1
#./configure --with-default-snmp-version="3"--with-sys-contact="@@no.where"--with-sys-location="Unknown"
--with-logfile="/var/log/snmpd.log"--with-persistent-directory="/var/net-snmp"
#make
#make install
(7)重新检查,全部通过
(8)#make
出现错误:
make: *** [sapi/cli/php] Error 1
google ,
网上解决方法:
方法一:
#vim Makefile
找到"EXTRA_LIBS"这一行,在最后加上"-liconv"
方法二:
make ZEND_EXTRA_LIBS='-liconv'
木用,
#find / -name libiconv.so.2
没找到,可能是没安装,
于是安装libiconv
下载地址: http://www.gnu.org/software/libiconv/ http://mirror.bjtu.edu.cn/gnu/libiconv/
#tar -zxvf libiconv-1.10.tar.gz
#./configure --prefix=/usr/local/libiconv
#make
#make install
(9)#./configure重新检查
(10)make
出现错误:
libxslt.so:undefined reference to ........
安装libxslt
#apt-get install libxslt1-dev
重新configure和make,仍然不能通过,
googlebaidu搜遍地球和宇宙,花了两天工夫,仍然不能解决这个xslt的错误。
无奈放弃,从configure参数里去掉--with-xsl,
#./configure .......
#make
成功
#make test
(11)#make install
(12)安装成功
4,配置php
(1)#cd /usr/local/php-5.4.28/etc
(2)#cp /usr/local/src/php-5.4.28/php.ini-production php.ini
(3)#vim php.ini
修改三个参数(drupal项目里已经出现的错误对应):
max_execution_time = 60
max_input_time = 120
upload_max_filesize=8M(默认为2M)
(4)修改apache配置文件以支持php
i,#cd /usr/local/apache2/conf
ii,#vim httpd.conf
iii,找到AddType application/x-gzip .gz .tgz 这一行,在下面加上
AddType application/x-httpd-php .php
iv,找到
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
这一节,
修改里面的这一行,在后面加上index.php,
DirectoryIndex index.html index.php
v,重启apache服务
vi,#cd /data/www 移到网站根目录
vii,#vim index.php 建立一个php文件
在里面输入
<?php phpinfo(); ?>
保存。
viii,切换到图形模式,打开浏览器,输入
http://localhost
vvi,如果能正常显示页面,出现配置信息,说明安装配置成功。
php安装可参见:http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi:troubleshoot
相关文章推荐
- Ubuntu 默认壁纸历代记
- 关于Ubuntu 11.10启动提示waiting for the network configuration的问题
- 在 Ubuntu 桌面中使用文件和文件夹
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- ubuntu下chrome无法同步问题解决
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- 使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法
- 以Ubuntu 9.04为例 将工作环境迁移到 Linux
- Scientific Linux 5.5 图形安装教程