这篇文章主要为大家展示了“ubuntu12上如何安装php5”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“ubuntu12上如何安装php5”这篇文章吧。
ubuntu12上安装php5的方法:1、创建用户;2、安装依赖包;3、编译安装php;4、修改配置文件并启动php。
本文操作环境:Ubuntu12.04系统、PHP5.5版、DELL G3电脑
ubuntu12上怎么安装php5?
ubuntu 12.04 安装php5.5:
创建用户
/usr/sbin/groupadd www/usr/sbin/useradd -r www -g www
安装依赖包
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/ldconfigcd libltdl/./configure --enable-ltdl-installmake && make installcd .../configuremake && make install tar zxvf libiconv-1.14.tar.gz -C /home/tbt/src/cd /home/tbt/src/libiconv-1.14sed -i -e '/gets is a security/d' ./srclib/stdio.in.h./configure --prefix=/usr/localmake && make install
编译安装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-readlinemake ZEND_EXTRA_LIBS='-liconv'make install
注:如果mysql与php不在同一服务器,则需要将上面关于mysql的参数修改为如下
--with-mysql \--with-mysqli \--with-pdo-mysql \
修改配置文件并启动php
cp php.ini-production /home/tbt/php/lib/php.inicd /home/tbt/php/etc/cp php-fpm.conf.default php-fpm.confcd ..sed -i 's/^;date.timezone =/date.timezone = PRC/' /home/tbt/php/lib/php.inichown -R www:www /home/tbt/phpcp php.ini-production /home/tbt/php/lib/php.inicd /home/tbt/php/etc/cp php-fpm.conf.default php-fpm.confcd ..sed -i 's/^;date.timezone =/date.timezone = PRC/' /home/tbt/php/lib/php.inichown -R www:www /home/tbt/php/home/tbt/php/sbin/php-fpm
以上是“ubuntu12上如何安装php5”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注编程网行业资讯频道!