溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

PHP5.5安裝

發布時間:2020-07-08 08:48:54 來源:網絡 閱讀:470 作者:smile_青春 欄目:web開發


1.     install Development Environment (安裝開發環境)

yum install make gcc gcc-c++ -y

 

2.     install library(安裝php依賴庫)

a)  install jpegsrc(安裝jpeg庫,使php支持jpg、jpeg等圖片格式)

下載地址:http://ijg.org

 

wget http://ijg.org/files/jpegsrc.v9a.tar.gz

mkdir -p /usr/local/webserver/libs/

tar zxvf jpegsrc.v9a.tar.gz

cd jpeg-9a/

./configure --prefix=/usr/local/webserver/libs --enable-shared --enable-static

make

make install

cd ..

 

b)install libpng(安裝libpng庫,使php支持png等圖片格式)

下載地址:http://libpng.org/pub/png/libpng.html

 

wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.12.tar.gz

tar -zxvf libpng-1.6.12.tar.gz

cd libpng-1.6.12

./configure --prefix=/usr/local/webserver/libs

make

make install

cd ..

 

c)install freetype(安裝freetype庫,使php支持單色位圖、反走樣位圖的渲染)

下載地址:http://freetype.org/download.html

 

wget http://ncu.dl.sourceforge.net/project/freetype/freetype2/2.5.3/freetype-2.5.3.tar.bz2

tar -zxvf freetype-2.5.3.tar.bz2

cd freetype-2.5.3

./configure --prefix=/usr/local/webserver/libs

make

make install

cd ..

 

d)install libmcrypt(安裝mcrypt庫,使php實現加密解密功能)

下載地址:http://sourceforge.net/projects/mcrypt/

 

wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz

tar -zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure --prefix=/usr/local/webserver/libs

make

make install

 

cd libltdl/

./configure --prefix=/usr/local/webserver/libs--enable-ltdl-install

make

make install

cd ../..

 

e)install mhash(安裝mmhash庫,為PHP提供了多種哈希算法)

wget  http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2

tar xvf mhash-0.9.9.9.tar.bz2

cd mhash-0.9.9.9/

./configure --prefix=/usr/local/webserver/libs

make

make install

cd ..

 

echo /usr/local/webserver/libs/lib >>/etc/ld.so.conf

ldconfig

 

f)  install mcrypt(安裝mcrypt庫,使php實現加密解密功能)

下載地址:http://sourceforge.net/projects/mcrypt/

 

wgethttp://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz

tar -zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

export LDFLAGS="-L/usr/local/webserver/libs/lib-L/usr/lib"

export CFLAGS="-I/usr/local/webserver/libs/include-I/usr/include"

touch malloc.h

./configure --prefix=/usr/local/webserver/libs--with-libmcrypt-prefix=/usr/local/webserver/libs

make

make install

cd ..

 

g)  install libxml2、libcurl、gd and openssl

(使php支持curl重寫、支持xml語言、支持gd圖形處理庫和支持openssl加密)

yum install libxml2-devel -y

yum install libcurl-devel -y

yum install -y gd gd-devel

yum install openssl openssl-devel -y

 

3.install php(安裝php程序)

a)定義系統變量指定相關庫的位置

export LIBS="-lm -ltermcap -lresolv"

exportDYLD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"

exportLD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"

export LIBS=

export CFLAGS=

 

下載地址:http://php.net/downloads.php

 

wget http://cn2.php.net/get/php-5.5.16.tar.gz

tar -zxvf php-5.5.16.tar.gz

cd php-5.5.16

 

b)編譯安裝PHP

./configure --prefix=/usr/local/webserver/php--with-config-file-path=/usr/local/webserver/php/etc --with-iconv-dir--with-freetype-dir=/usr/local/webserver/libs--with-jpeg-dir=/usr/local/webserver/libs--with-png-dir=/usr/local/webserver/libs --with-zlib --with-libxml-dir=/usr--enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem--enable-inline-optimization --with-curl --enable-mbregex --enable-fpm--enable-mbstring --with-mcrypt=/usr/local/webserver/libs --with-gd--enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets--with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql

 

    --prefix=/usr/local/webserver/php

    php安裝位置

--with-config-file-path=/usr/local/webserver/php/etc

php配置文件位置

--with-iconv-dir

啟用字符轉換

--with-freetype-dir=/usr/local/webserver/libs

使支持freetype

--with-jpeg-dir=/usr/local/webserver/libs

使支持jpeg等圖片格式

--with-png-dir=/usr/local/webserver/libs

使支持png等圖片格式

--with-zlib

--enable-zip

支持zlib\zip壓縮

--with-libxml-dir=/usr

--enable-xml

--with-xmlrpc

使支持xml語言

--disable-rpath

--enable-bcmath

使支持整型

--enable-shmop

允許PHP讀,寫,創建和刪除UNIX共享內存段

--enable-sysvsem

--enable-inline-optimization

使用inline優化

--with-curl

使支持curl重寫功能

--enable-mbregex

--enable-mbstring

支持mbregex、mbstring字符編碼

--enable-fpm

支持PHPFastCGI管理器

--with-mcrypt=/usr/local/webserver/libs

--with-gd

--enable-gd-native-ttf

支持mcrypt、GD庫

--with-openssl

支持openssl加密

--with-mhash

支持hash算法

--enable-pcntl

--enable-sockets

支持套接字

--enable-soap

支持簡單對象訪問協議

--enable-opcache

 

make

make install

 

cp php.ini-development /usr/local/webserver/php/etc/php.ini

ln -s/usr/local/webserver/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib

mv /usr/local/webserver/php/etc/php-fpm.conf.default/usr/local/webserver/php/etc/php-fpm.conf

 

4.     安裝php其它擴展

a)install autoconf(Autoconf是一個用于生成可以自動地配置軟件源代碼包以適應多種Unix類系統的 shell腳本的工具)

tar -zxvf autoconf-latest.tar.gz -C ../tmp

cd ../tmp/autoconf-2.69/

./configure --prefix=/usr/local/webserver/libs

make

make install

cd ../../soft

 

b)install memcache(使支持memcache)

tar -zxvf memcache-2.2.7.tgz -C ../tmp

cd ../tmp/memcache-2.2.7/

exportPHP_AUTOCONF="/usr/local/webserver/libs/bin/autoconf"

exportPHP_AUTOHEADER="/usr/local/webserver/libs/bin/autoheader"

/usr/local/webserver/php/bin/phpize

./configure --with-php-config=/usr/local/webserver/php/bin/php-config

make

make install

cd ../../soft

 

5.     start whith onboot(設置開機啟動PHP

$ cp<php-5.3.3-source-dir>/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm

$ chmod 755 /etc/init.d/php-fpm

 

vim /etc/init.d/php-fpm

設置以下內容:

php_fpm_BIN=/usr/local/webserver/php/sbin/php-fpm

php_fpm_CONF=/usr/local/webserver/php/etc/php-fpm.conf

php_fpm_PID=/var/run/php-fpm.pid

 

cp /usr/local/webserver/libs/etc/php-fpm.conf.default /usr/local/webserver/libs/etc/php-fpm.conf

 

cp php.ini-production /usr/local/webserver/php/lib/php.ini

 

可以通過以下控制:

$ /etc/init.d/php-fpm start

$ /etc/init.d/php-fpm stop

$ /etc/init.d/php-fpm reload

 

開機啟動

$ chkconfig php-fpm on

 

使用killall php-fpm也可以殺死所有進程

 

6.Nginx啟動php驗證

nginx.conf的server中加入如下配置,并重啟:

location ~ \.php$ {

           root /opt/www/bi;                                                                                                                                                        

           fastcgi_pass  127.0.0.1:9000;                                                                                                                                              

           fastcgi_index  index.php;                                                                                                                                                   

           fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;                                                                                                        

           include       fastcgi_params;                                                                                                                                              

        }

 

在指定的root目錄下,寫入一個

<?php

    echo phpinfo();

?>

文件進行測試。

 


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

php
AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女