php的版本升級

來源:互聯網
上載者:User

標籤:php php擴充 php升級

為什麼要寫這篇文章也是源於我犯了一個錯誤,還是今天發現的。

今天我嘗試想把 php的redis 擴充升級為最新的

然後為了不影響本地開發環境的影響我傻傻的複製了一份

[[email protected] php]# ll

total 16

drwxr-xr-x 9 root root 4096 Nov 10  2015 5.4.45

drwxr-xr-x 9 root root 4096 Aug  3 10:37 5.4.45.bak

drwxr-xr-x 9 root root 4096 Aug  3 09:52 7.0.2

drwxr-xr-x 9 root root 4096 Jan 28  2016 7.0.2.bak

lrwxrwxrwx 1 root root   21 May 16 21:02 php -> /usr/local/php/5.4.45

[[email protected] php]# 


在這裡說明一下 對於php 的版本我採用的是軟串連

[[email protected] php]# which php

/usr/bin/php

[[email protected] php]# ll /usr/bin/php 

lrwxrwxrwx 1 root root 26 Jan 29  2016 /usr/bin/php -> /usr/local/php/php/bin/php

[[email protected] php]# 


為了靈活的更新php  使用ln 一直只對/usr/local/php/php 這個檔案做軟串連  這樣我想切換7.0.2
只需要 ln -snf /usr/local/php/7.0.2 /usr/local/php/php 即可

[[email protected] php]# ln -snf /usr/local/php/7.0.2 /usr/local/php/php

[[email protected] php]# php --version

PHP 7.0.2 (cli) (built: Jan 29 2016 01:31:08) ( NTS )

Copyright (c) 1997-2015 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

[[email protected] php]#


回到主題

我傻傻的複製了一份出來 本來想先升級 5.4.45.bak 但是不然。

more information, such as the ld(1) and ld.so(8) manual pages.

----------------------------------------------------------------------

Installing shared extensions:     /usr/local/php/5.4.45/lib/php/extensions/no-debug-non-zts-20100525/

[[email protected] redis-2.2.8]# 


不管是我定義 php-config  phpize 這兩個檔案在/usr/local/php/5.4.45.bak/bin下  依然更新到了 /usr/local/php/5.4.45  


然後進行測試  幹掉/usr/local/php/5.4.45 

後來就開始出問題了


[[email protected] redis-2.2.8]# /usr/local/php/5.4.45.bak/bin/phpize 

Cannot find build files at ‘/usr/local/php/5.4.45/lib/php/build‘. Please check your PHP installation.


[[email protected] redis-2.2.8]# 



第一反應就是/usr/local/php/5.4.45.bak/bin/phpize 這個指令碼有問題 

[[email protected] redis-2.2.8]# cat /usr/local/php/5.4.45.bak/bin/phpize|less

#!/bin/sh


# Variable declaration

prefix=‘/usr/local/php/5.4.45‘

datarootdir=‘/usr/local/php/5.4.45/php‘

exec_prefix="`eval echo ${prefix}`"

phpdir="`eval echo ${exec_prefix}/lib/php`/build"

includedir="`eval echo ${prefix}/include`/php"

builddir="`pwd`"

SED="/bin/sed"



果然 他在開始就定義了路徑 然後繼續測試 改路徑

我使用替換但是提示我有 3列被修改了

  $SED \

  -e "s#/usr/local/php/5.4.45.bak#$prefix#" \

  < "$phpdir/phpize.m4" > configure.in

}       

        

phpize_autotools()

{

  $PHP_AUTOCONF   || exit 1

  $PHP_AUTOHEADER || exit 1

}

  

# Main script


case "$1" in 

  # Cleanup

  --clean)

3 substitutions on 3 lines


然後我搜尋了一下  帶這個路徑的到底有多少

[[email protected] 5.4.45.bak]# grep -rl "5.4.45" .

./php/man/man8/php-fpm.8

./php/man/man1/php.1

./php/man/man1/phpize.1

./php/man/man1/php-config.1

./php/man/man1/phar.1

./bin/php

./bin/pear

./bin/phpize

grep: ./bin/phar: No such file or directory

./bin/php-config

./bin/pecl

./bin/phar.phar

./bin/php-cgi

./bin/peardev

./sbin/php-fpm

./include/php/main/php_version.h

./include/php/main/build-defs.h

./etc/php-fpm.conf.default

./etc/pear.conf

./lib/php/extensions/no-debug-non-zts-20100525/redis.so

./lib/php/extensions/no-debug-non-zts-20100525/libevent.so

./lib/php/extensions/no-debug-non-zts-20100525/swoole.so

./lib/php/pearcmd.php

./lib/php/peclcmd.php

./lib/php/.registry/console_getopt.reg

./lib/php/.registry/pear.reg

./lib/php/.registry/xml_util.reg

./lib/php/.registry/archive_tar.reg

./lib/php/.registry/structures_graph.reg

[[email protected] 5.4.45.bak]# 


我的天還有些多。。 我也只是個維護者  難道批量替換?  但是我覺得 還是老實 在安裝一套吧。。

php的版本升級

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.