In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to update PHP5 in the Shell script, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
I am obsessed with Shell and enjoy watching characters jump in the black Console interface. Oddly enough, instead of becoming a Linux/Unix programmer, I am just an unlucky guy who writes CGI programs. What do people call "PHP programmers"? By the way-grass roots ~ well, if they have been buried in the soil for too long, they may rot away one day!
May be spoiled by Windows, really do not want to change to an OS, fortunately there is Cygwin,MinGW … At the right time, you can take it out and put it in B and comfort yourself.
I always like to download the latest snapshot from windows.php.net, not because I want to experience the latest features, but because of obsessive-compulsive disorder. All the software and programs on my machine are up-to-date, most of them still have beta tags, and some of them are even trunk versions dragged directly from SVN,Git. If you climb these sites every day and check to see if there is a new version released, it will be crazy to satisfy your perverted mentality.
Don't do what the machine can do by hand, right? The following code automatically goes to check's latest snapshot and unzips it to the directory you want. And? Build a cron job and hang it up, then you can find new fun.
Download the None thead safe VC9 version in the code, and be careful to replace it with the version you can use. If you need to force an update, add the "- force" parameter.
The last line uses icacls to reset the permissions of the files in the php5-nts directory (notice how the path is written, icacls is windows's own program), because cygwin makes the permissions of NTFS disgusting.
PS: non-CGI/FCGI installation mode, remember to turn off Web Server.
#! / bin/bash INSTALL_PATH= "/ cygdrive/d/php5-nts" BUILD_TIME_FILE= "/ cygdrive/d/php5-nts/build-time" PACKAGE_URL= "http://windows.php.net/downloads/snaps/php-5.3-nts-win32-VC9-x86-latest.zip" function uprint {if [" ${1:0:1} "="-"] Then echo $1 "# $2" else echo "# $1" fi} # # If unzip available?UNZIP= `which unzip 2 > / dev/ null`if [- z $UNZIP]; then uprint "Could not find unzip, please install." Exit 1fi # # Test if build-time file exists, if not, create itif [!-f $BUILD_TIME_FILE]; then uprint-n "Build time file does not exists, created..." Touch $BUILD_TIME_FILE echo-e "\ e [32m [OK]\ e [0m" fi # # Get current build timeCURRENT_BUILD_TIME= `cat $BUILD_TIME_ FILE` # # Get latest build timeLATEST_BUILD_TIME= `curl-- silent http://windows.php.net/snapshots/ |\ grep "php-5.3-nts-VC9-x86" |\ grep "VC9 x86 Non Thread Safe (" |\ grep-o "(. *)" |\ sed's / [()] / / g`` # # Any update?package= `basename $PACKAGE_ URL`if ["$CURRENT_BUILD_TIME"! = "$LATEST_BUILD_TIME"] Then uprint-e "New version available, build time:\ e [36m $LATEST_BUILD_TIME\ e [0m" else if ["$1"! = "- force"]; then uprint "You are using the latest snapshot version." Exit 0 else uprint-e "\ e [31mForce to update local php version.\ e [0m" fifi # # Delete if file already existsls $package > / dev/null 2 > & 1if test $?-eq 0; then uprint-n "Performing: rm-f\ `ls $package\ `." Rm-f `ls $package` echo-e "\ e [32m [OK]\ e [0m" fi # # Get latest php5 binary packageuprint-n "Downloading latest php binary package..." wget-Q $PACKAGE_URLecho-e "\ e [32m [OK]\ e [0m" # # Extractingif [- f $package]; then # kill php processes for php_pid in `ps-as | grep php | awk'{print $1} '`do kill-9 $php_pid done uprint-n "Extracting." Unzip-o $package-x-d $INSTALL_PATH > / dev/null 2 > & 1 echo-e "\ e [32m [OK]\ e [0m" echo $LATEST_BUILD_TIME > $BUILD_TIME_FILE uprint-n "Cleaning up..." Rm-f $package echo-e "\ e [32m [OK]\ e [0m" fi # # Fixed cygwin permissionsicacls D:/php5-nts / reset / T > / dev/null # vim: set expandtab tabstop=4 shiftwidth=4: thank you for reading this article carefully. I hope the article "how to update PHP5 in the Shell script" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.