ubuntu12上怎么安装php5

发布时间:2022-05-25 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了ubuntu12上怎么安装php5脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

Ubuntu12上安装php5的方法:1、创建用户;2、安装依赖包;3、编译安装php;4、修改配置文件并启动php。

ubuntu12上怎么安装php5

本文操作环境:Ubuntu12.04系统、PHP5.5版、DELL G3

ubuntu12上怎么安装php5?

ubuntu 12.04 安装php5.5:

1、创建用户

/usr/sbin/groupadd www
/usr/sbin/useradd -r www -g www

2、安装依赖包

apt-get install -y make gcc g++ curl libXMl2 libxML2-dev libssl-dev libcurl4-oPEnssl-dev libjpeg-dev libpng12-dev bzip2 libbz2-dev libxpm-dev libfreetype6-dev libedIT-dev libxslt-dev 
 
tar zxvf libmcrypt-2.5.8.tar.gz -C /home/tBT/src/
cd /home/tbt/src/libmcrypt-2.5.8/
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
cd ..
./configure
make && make install
 
tar zxvf libiconv-1.14.tar.gz -C /home/tbt/src/
cd /home/tbt/src/libiconv-1.14
sed -i -e '/gets is a security/d' ./srclib/stdio.in.h
./configure --PRefix=/usr/local
make && make install

3、编译安装php

tar zxvf php-5.5.14.tar.gz -C /home/tbt/src/
cd /home/tbt/src/php-5.5.14
./configure --prefix=/home/tbt/php \            
--with-MySQL=/home/tbt/mySQL \
--with-mysqli=/home/tbt/mysql/bin/mysql_config \
--with-pdo-mysql=/home/tbt/mysql \
--enable-FPM \
--with-fpm-user=www \
--with-fpm-group=www \
--with-curl \
--with-pear \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-xpm-dir \
--with-freetype-dir \
--with-mcrypt \
--with-mhash \
--with-openssl \
--with-xmlrpc \
--with-xsl \
--with-bz2 \
--with-gettext \
--disable-debug \
--enable-exif \
--enable-wddx \
--enable-zip \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-mbstring \
--enable-SOAp \
--enable-sockets \
--enable-shmop \
--enable-dba \
--enable-SysvSEM \
--enable-sysvshm \
--enable-sysvmsg \
--enable-pcntl \
--with-libedit \
--with-readline
make ZEND_EXTRA_LIBS='-liconv'
make install

注:如果mysql与php不在同一服务器,则需要将上面关于mysql的参数修改为如下

--with-mysql \
--with-mysqli \
--with-pdo-mysql \

4、修改配置文件并启动php

cp php.ini-production /home/tbt/php/lib/php.ini
cd /home/tbt/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd ..
sed -i 's/^;date.timezone =/date.timezone = PRC/' /home/tbt/php/lib/php.ini
chown -R www:www /home/tbt/php
cp php.ini-production /home/tbt/php/lib/php.ini
cd /home/tbt/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd ..
sed -i 's/^;date.timezone =/date.timezone = PRC/' /home/tbt/php/lib/php.ini
chown -R www:www /home/tbt/php
/home/tbt/php/sbin/php-fpm

推荐学习:《PHP视频教程》

以上就是ubuntu12上怎么安装php5的详细内容,更多请关注脚本宝典其它相关文章

脚本宝典总结

以上是脚本宝典为你收集整理的ubuntu12上怎么安装php5全部内容,希望文章能够帮你解决ubuntu12上怎么安装php5所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:php5php5