Ubuntu 16.04 下源码配置LNMP开发环境(2)

./configure --prefix=/usr/local/nginx --with-openssl=/usr/local/src/openssl-1.0.2g --with-pcre=/usr/local/src/pcre --with-zlib=/usr/local/src/zlib --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-http_stub_status_module 

make && make install

启动nginx服务

/usr/local/nginx/sbin/nginx  

查看nginx进程

ps -ef | grep nginx

关闭,重启服务

/usr/local/nginx/sbin/nginx -s stop, quit, reopen, reload

cp /usr/local/nginx/sbin/nginx  /etc/init.d/nginx

更新权限

sudo chmod 755 /etc/init.d/nginx

sudo sysv-rc-conf nginx on

配置环境变量

sudo  ~/.bashrc

export PATH="/usr/local/nginx/sbin/:$PATH"

配置nginx 支持 php

vim /usr/local/nginx/conf/nginx.conf

location / {

root /www;

index index.html index.htm index.php;

}

location ~ \.php$ {

root /www;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name;

include fastcgi_params;

}

//注:黑体www为web根目录,改成对应目录即可

PHP 

apt-get 安装php 7 php5.6 

php 7

apt-get install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache  php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext

php 5.6

sudo apt install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update 

sudo apt-get install php5.6

sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml

5.6.25编译安装 安装必要的依赖

t1lib(php字体类扩展)  版本t1lib-5.1.2.tar.gz  

解压

tar zxvf t1lib-5.1.2.tar.gz -C /usr/local/src

cd /usr/local/src t1lib-5.1.2

./configure 

提示错误 : X11/Xaw/Label.h: No such file or directory

缺少libxaw库

sudo apt-get install libxaw7-dev 

./configure && make without_doc && make install

官网下载php5.6.25源码包

tar zxvf php-5.6.23.tar.gz -C /usr/local/src

cd /usr/local/src/

编译安装

./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/usr/local/mysql/data/mysql.sock   --enable-mbstring  --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysqli=mysqlnd  --with-pdo-mysql=mysqlnd --enable-fpm   --with-fpm-group=www  --with-fpm-user=www  --enable-bcmath  --enable-bcmath  --enable-soap --enable-calendar    --with-pcre-dir=/usr/local/src/pcre   --with-mcrypt --enable-xml  --with-xmlrpc  --with-xsl --enable-sockets  --enable-opcache --with-gd  --with-jpeg-dir  --with-png-dir  --with-xpm-dir  --with-freetype-dir   --enable-gd-native-ttf  --enable-dtrace  --with-openssl --with-kerberos --with-openssl-dir=/usr/local/src/openssl-1.0.2g   --enable-zip --with-zlib-dir=/usr/local/src/zlib --with-t1lib=/usr/local/share/t1lib  --with-libxml-dir --with-iconv-dir --with-libzip  --enable-intl --with-curl=DIR  --enable-ftp

提示Cannot find sys/sdt.h which is required for DTrace support  

根据官方提示dTrace某些开发版需要安装 SystemTap SDT 开发包

apt-cache search SystemTap SDT

apt-get install systemtap-sdt-dev

提示curl 编译失败

apt-get install  libcurl4-gnutls-dev

apt-get install curl php5.6-curl

提示重新安装libzip

apt-get install libzip-dev

清除之前编译的可执行文件及配置文件,再次编译

make clean

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/b920ab7d1888b0a01926f49352cd0605.html