linux RedHat7LNMP構架搭建論壇三之源碼安裝PHP和Discuz論壇

PHP安裝
#cd ..
#tar zxvf yasm-1.2.0.tar.gz
#cd yasm-1.2.0
#./configure
#make
#make install
安裝 libmcrypt源碼
#cd ..
#tar zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install
安裝libvpx源碼包
#cd ..
這裏解壓方式爲:tar xjvf
#tar xjvf libvpx-v1.3.0.tar.bz2
#cd libvpx-v1.3.0
#./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
#make
#make install
安裝tiff源碼包
#cd ..
#tar zxvf tiff-4.0.3.tar.gz
#cd tiff-4.0.3
#./configure --prefix=/usr/local/tiff --enable-shared
#make
#make install
安裝libpng源碼包
#cd ..
#tar zxvf libpng-1.6.12.tar.gz
#cd libpng-1.6.12
#./configure --prefix=/usr/local/libpng --enable-shared
#make
#make install
安裝freetype源碼包
#cd ..
#tar zxvf freetype-2.5.3.tar.gz
#cd freetype-2.5.3
#./configure --prefix=/usr/local/freetype --enable-shared
#make
#make install
安裝jpeg源碼包
#cd ..
#tar zxvf jpegsrc.v9a.tar.gz
#cd jpeg-9a
#./configure --prefix=/usr/local/jpeg --enable-shared
#make
#make install
安裝libgd源碼包
#cd ..
#tar zxvf libgd-2.1.0.tar.gz
#cd libgd-2.1.0
#./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx
#make
#make install
安裝t1lib源碼包
#cd ..
#tar zxvf t1lib-5.1.2.tar.gz
#cd t1lib-5.1.2
把/usr/lib64目錄中的函數文件鏈接到/usr/lib目錄中,
#./configure --prefix=/usr/local/t1lib --enable-shared
#make
#make install
#ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so
#cp -frp /usr/lib64/libXpm.so* /usr/lib/
#cd ..
#tar -zvxf php-5.5.14.tar.gz
#cd php-5.5.14
定義一個名爲LD_LIBRARY_PATH的全局環境變量
#export LD_LIBRARY_PATH=/usr/local/libgd/lib
定義配置php服務程序配置文件的保存目錄、MySQL數據庫服務程序所在目錄、MySQL數據庫服務程序配置文件所在目錄,以及libpng、jpeg、freetype、libvpx、zlib、t1lib等服務程序的安裝目錄路徑,
#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
#make
#make install
需要刪除當前默認的配置文件
#rm -rf /etc/php.ini
將php服務程序目錄中相應的配置文件複製過來:
#ln -s /usr/local/php/etc/php.ini /etc/php.ini
#cp php.ini-production /usr/local/php/etc/php.ini
#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf
將配置文件中第25行左右的pid文件保存目錄,
#vim /usr/local/php/etc/php-fpm.conf
25 pid = run/php-fpm.pid
將第148和149行的user與group參數分別修改爲www賬戶和用戶組名稱:
148 user = www
149 group = www
用於管理php服務的腳本文件複製到/etc/rc.d/init.d
#cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
更改權限
#chmod 755 /etc/rc.d/init.d/php-fpm
把php-fpm服務程序加入到開機啓動項中
#chkconfig php-fpm on

編輯php.ini配置文件,在305行的disable_functions參數後面追加上要禁止的功能。
#vim /usr/local/php/etc/php.ini

305 disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restor e,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,g etservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,po six_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posixgetpwnam,posix getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posixsetgid,posix setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

#vim /usr/local/nginx/conf/nginx.conf
第2行#刪除
2 user www www;
在第45行的index參數後面寫上網站的首頁名稱
45 index index.html index.htm index.php;
修改第69行的腳本名稱路徑參數,
65 location ~ .php$ {
66 root html;
67 fastcgi_pass 127.0.0.1:9000;
68 fastcgi_index index.php;
路徑
69 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
70 include fastcgi_params;
71 }
重啓服務
#systemctl restart nginx
#systemctl restart php-fpm
搭建論壇步驟如前
#cd /usr/local/src/
#unzip Discuz_X3.2_SC_GBK.zip
#rm -rf /usr/local/nginx/html/{index.html,50x.html}
#mv upload/
/usr/local/nginx/html/
#chown -Rf www:www /usr/local/nginx/html
更改權限
#chmod -Rf 755 /usr/local/nginx/html
查看結果

linux RedHat7LNMP構架搭建論壇三之源碼安裝PHP和Discuz論壇

**

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章