一、原始碼安裝
1.編譯安裝
<code><span>.</span>/configure <span>--</span>prefix<span>=</span>/usr/<span>local</span>/php<span>\</span><span>--</span><span>with</span><span>-config</span><span>-file</span><span>-path</span><span>=</span>/usr/<span>local</span>/php/etc <span>--</span><span>with</span><span>-bz2</span><span>--</span><span>with</span><span>-curl</span><span>\</span><span>--</span>enable<span>-ftp</span><span>--</span>enable<span>-sockets</span><span>--</span>disable<span>-ipv6</span><span>--</span><span>with</span><span>-gd</span><span>\</span><span>--</span><span>with</span><span>-jpeg</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span><span>with</span><span>-png</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>\</span><span>--</span><span>with</span><span>-freetype</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span>enable<span>-gd</span><span>-native</span><span>-ttf</span><span>\</span><span>--</span><span>with</span><span>-iconv</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span>enable<span>-mbstring</span><span>--</span>enable<span>-calendar</span><span>\</span><span>--</span><span>with</span><span>-gettext</span><span>--</span><span>with</span><span>-libxml</span><span>-dir</span><span>=</span>/usr/<span>local</span><span>--</span><span>with</span><span>-zlib</span><span>\</span><span>--</span><span>with</span><span>-pdo</span><span>-mysql</span><span>=</span>mysqlnd <span>--</span><span>with</span><span>-mysqli</span><span>=</span>mysqlnd <span>--</span><span>with</span><span>-mysql</span><span>=</span>mysqlnd <span>\</span><span>--</span>enable<span>-dom</span><span>--</span>enable<span>-xml</span><span>--</span>enable<span>-fpm</span><span>--</span><span>with</span><span>-libdir</span><span>=</span>lib64 <span>--</span>enable<span>-bcmath</span></code>
<code><span>make</span> && <span>make</span> install</code>
2.錯誤處理
[ERROR]-1
<code>checking <span>for</span> ZLIB support... <span>no</span>checking <span>if</span> the location <span>of</span> ZLIB install directory <span>is</span> defined... <span>yes</span><span>configure</span>: <span>error</span>: Cannot find libz</code>
[ERROR]-2
<code>checking whether <span>to</span> enable JIS<span>-mapped</span> Japanese font support <span>in</span> GD<span>...</span> no <span>If</span> configure fails try <span>--</span><span>with</span><span>-vpx</span><span>-dir</span><span>=<</span>DIR<span>></span>configure: error: jpeglib<span>.</span>h <span>not</span> found<span>.</span></code>
<code>wget http://www<span>.boutell</span><span>.com</span>/gd/http/gd-<span>2.0</span><span>.33</span><span>.tar</span><span>.gz</span> tar zxvf gd-<span>2.0</span><span>.33</span><span>.tar</span><span>.gz</span> cd gd-<span>2.0</span><span>.33</span> ./configure --prefix=/usr/local/gd2 make make instal</code>[ERROR]-2
<code>./configure Make Make <span>install</span></code>
<code><span>If</span> configure fails try <span>--</span><span>with</span><span>-xpm</span><span>-dir</span><span>=<</span>DIR<span>></span>configure: error: freetype<span>-config</span><span>not</span> found<span>.</span></code>[ERROR]-3
<code>checking whether <span>to</span> enable JIS<span>-mapped</span> Japanese font support <span>in</span> GD<span>...</span> no configure: error: vpx_codec<span>.</span>h <span>not</span> found<span>.</span></code>[ERROR]-4
<code>tar -xzvf bzip2-<span>1.0</span><span>.6</span><span>.tar</span><span>.gz</span></code>[Bzip2 Install]
<code>make <span>-f</span> Makefile<span>-libbz2_so</span></code>
為編譯做準備,建立libbz2.so動態連結函式庫(這一步很重要,安裝python的時候如果沒有這一步,python安裝不上bz2模組):
<code>[root@kallen ~]<span># rpm -ivh php-common-5.4.40-1.el6.remi.x86_64.rpm </span> warning: php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID <span>00</span>f97f56: NOKEY Preparing... <span>########################################### [100%]</span><span>file</span> /etc/php.ini <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/curl.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/fileinfo.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/json.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/phar.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>file</span> /usr/lib64/php/modules/zip.so <span>from</span> install <span>of</span> php-common-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 conflicts <span>with</span><span>file</span><span>from</span> package php-common-<span>5.3</span><span>.3</span>-<span>26.</span>el6.x86_64 <span>error</span>: Failed dependencies: libmysqlclient.so<span>.18</span>()(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 libmysqlclient.so<span>.18</span>(libmysqlclient_16)(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64 libmysqlclient.so<span>.18</span>(libmysqlclient_18)(<span>64</span>bit) <span>is</span> needed <span>by</span> php-mysql-<span>5.4</span><span>.40</span>-<span>1.</span>el6.remi.x86_64</code>
、RPM安裝<pre class="brush:php;toolbar:false"><code>rpm -Uvh http://repo<span>.webtatic</span><span>.com</span>/yum/el6/latest<span>.rpm</span></code></pre>
三、YUM安裝
1.PHP-5.4
php5.4於2012年5月8號發布,從php5.4.0開始php加入了一些新特色如:ra”
支持附的php擴充清單:內建了一個簡單的Web伺服器
提供了數組簡短語法
- 直接對函數回傳值進行數組取值
- 最終刪除魔術方法及安全模式
- 來源.4,我們先安裝Webtatic EL6 YUM來源,關於YUM來源的安裝設定請參考《在RHEL6中設定YUM來源》一文;
- 如果安裝失敗,建議您先卸載先前的php再進行安裝,使用
<code>yum <span>-y</span> install php54w php54w<span>-bcmath</span> php54w<span>-cli</span><span>\</span> php54w<span>-common</span> php54w<span>-devel</span> php54w<span>-fpm</span> php54w<span>-gd</span><span>\</span> php54w<span>-imap</span> php54w<span>-ldap</span> php54w<span>-mbstring</span> php54w<span>-mcrypt</span><span>\</span> php54w<span>-mysql</span> php54w<span>-odbc</span> php54w<span>-pdo</span> php54w<span>-pear</span><span>\</span> php54w<span>-pecl</span><span>-igbinary</span> php54w<span>-xml</span> php54w<span>-xmlrpc</span><span>\</span> php54w<span>-opcache</span> php54w<span>-intl</span> php54w<span>-pecl</span><span>-memcache</span></code><code> yum <span>remove</span> php php-*</code><code>[root@kallen ~]# yum install php54w-gd.x86_64 Loaded plugins: product-id, security, subscription-manager This system <span>is</span><span>not</span> registered <span>to</span> Red Hat Subscription Management. You can <span>use</span> subscription-manager <span>to</span><span>register</span>. Setting up Install <span>Process</span> Resolving Dependencies <span>--> Running transaction check</span><span>---> Package php54w-gd.x86_64 0:5.4.41-1.w6 will be installed</span><span>--> Processing Dependency: libt1.so.5()(64bit)for package: php54w-gd-5.4.41-1.w6.x86_64</span><span>--> Finished Dependency Resolution</span> Error: <span>Package</span>: php54w-gd-<span>5.4</span><span>.41</span>-<span>1.</span>w6.x86_64 (webtatic) Requires:libt1.so<span>.5</span>()(<span>64</span><span>bit</span>) You could try using <span>--skip-broken to work around the problem</span> You could try running: rpm -Va <span>--nofiles --nodigest</span></code>
Package
php-cgi, php- pcntl, php-readline | |
php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-date php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib | |
php54w-devel | |
php54w-embedded | |
php_database, w-ldap | |
php54w-mbstring | |
php54w-mcrypt | |
php54w-mssql | |
-mm 54w-odbc | php-pdo_odbc, php_database |
php54w-pdo | |
php54w-pgsql | php-pdo_pgsql, php_database |
php 日 | |
php54w-snmp | |
php-dom , php-domxml, php-wddx, php-xsl | |
2.PHP-5.5 |
<code>[root<span>@kallen</span> ~]<span># rpm -ivh t1lib-5.1.2-6.el6_2.1.x86_64.rpm </span><span>warning</span>: t1lib-<span>5.1</span><span>.2</span>-<span>6.</span>el6_2<span>.1</span>.x86_64.<span>rpm</span>: Header V3 RSA/SHA1 Signature, key ID <span>c105b9de</span>: NOKEY Preparing... <span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span># [100%]</span><span>1</span>:t1lib <span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span>######</span><span># [100%]</span></code> <code>[root<span>@kallen</span> ~]<span># yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc</span></code> | 四、版本測試
<code>[root<span>@kallen</span> ~]<span># yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache</span></code> <code>kallen@kallen:~$ php <span>-v</span> PHP <span>5.5</span><span>.9</span><span>-</span><span>1</span>ubuntu4<span>.11</span> (cli) (built: Jul <span>2</span><span>2015</span><span>15</span>:<span>23</span>:<span>08</span>) Copyright (c) <span>1997</span><span>-</span><span>2014</span> The PHP <span>Group</span> Zend Engine v2<span>.5</span><span>.0</span>, Copyright (c) <span>1998</span><span>-</span><span>2014</span> Zend Technologies <span>with</span> Zend OPcache v7<span>.0</span><span>.3</span>, Copyright (c) <span>1999</span><span>-</span><span>2014</span>, <span>by</span> Zend Technologies </code> |
|
2.查看PHP已安裝模組 | 3.My連線測試 | 2.查看PHP已安裝模組
版權聲明:本文為部落客原創文章,未經部落客允許不得轉載|Copyright ©2011-2015, Kallen Ding, All Rights Reserved. | |
以上就介紹了LNMP環境建構-PHP篇,包含了面向的內容,希望對PHP教學有興趣的朋友有幫助。 |