In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you how to achieve php version switching, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The following is the existing php business and how the code is put online. Implementation: 4 sets of environment version switching.
[root@hz-web-01 htdocs] # cat release.shanzhao echo example: ${0,000,000,100 /} app environmentapp_env=$1# build release file pathbuild_file_path=$2 help () {echo echo usage: ${0,000,500 /} [app_env] [release] echo example: ${0,000,000,000 /} int lvanclub_int_build_20150731_170557.tar.gz echo exit 0} # check the app_env variable valuecase ${app_env} in dev) echo "ECHO: don't support dev environment present" help exit 1 ; int) user=apache group=apache;; sandbox) user=apache group=apache;; live) user=php-fpm group=php-fpm;; *) echo "ERROR: invalid app_env value, should be dev, int, sandbox orlive!" Help exit 1 Esac # check the build_file_path variable valueif [- z ${build_file_path}] then echo "ERROR: please specify the build file path" help exit 1elif [!-f ${build_file_path}] then echo "ERROR: specified build file'${build_file_path}'is notfound" help exit 1fi # reference: linux shell string operation (length, find Replace) details-http://www.cnblogs.com/chengmo/archive/2010/10/02/1841355.html# only keep the build folder namebuild_file_name=$ {build_file_path##*/} build_name=$ {build_file_name%.tar.gz} # if current build folder exists Justremove itrm ${work_dir} / ${build_name}-rvftar xzvf ${build_file_path}-- directory=$ {work_dir} / # make soft link for cpserver projectcd ${work_dir} / ${build_name} / sdkserver/webln-s. /.. / cpserver cpserver # copy log filescd ${work_dir} # appstorecp$ {release_dir} / ${app_env} / appstore/apps/api/var/logs ${work_dir} / ${build_name} / appstore / apps/api/var/-rvf# appstore dashboardcp$ {release_dir} / ${app_env} / appstore/apps/dashboard/var/logs$ {work_dir} / ${build_name} / appstore/apps/dashboard/var/-rvf# sdkservercp$ {release_dir} / ${app_env} / sdkserver/protected/logs$ {work_dir} / ${build_name} / sdkserver/protected/-rvfcp$ {release_dir} / ${app_env} / sdkserver/protected/runtime$ {work_dir } / ${build_name} / sdkserver/protected/-rvf# cpservercp ${release_dir} / ${app_env} / cpserver/logs$ {work_dir} / ${build_name} / cpserver/-rvf# change file owners and permissionschown ${user}: ${group} ${work_dir} / ${build_name}-Rchmod 775 ${work_dir} / ${build_name}-R # make build as current releaserm ${release_dir} / ${app_env} -vfln-s ${work_dir} / ${build_name} ${release_dir} / ${app_env} # restart php-fpm serviceservice php-fpm restart
The above script has less content and no comments. Let's read it.
The reason for this approach: Ali Cloud platform, the mount disk is assigned to the / mnt directory
Actual directory: / mnt/var/www/htdocs
Soft connection directory: / var/www/htdocs
As help said, dev environment, int environment, sandbox environment, live environment, version switching of four sets of environments. The live environment is an online formal environment.
I have shared my ideas, and I hope you can give us an improvement plan!
# 2015-08-26 the following are the implementation documents for each code launch
# this document is a temporary document. Jenkins replacement will be deployed later.
# 1 check the first-level menu content in the tar.gz file
# 2 rollback operation:
# according to step 3, select the recent upgrade version.
Step one:
Transfer the software package to be upgraded to the server: hz-bf-01
Code location: / mnt/word
The second cloth:
Distribute packages to the appropriate server
Sh / mnt/shell/fenfa.sh / mnt/word/lvanclub_live_build_20150826_111450.tar.gz / mnt/var/www/htdocs
Step 3:
Perform ansiable:
Ansible-I. / hosts web-m command-a "sh / mnt/var/www/htdocs/release.sh live / mnt/var/www/htdocs/lvanclub_live_build_20150827_153156.tar.gz"
The above is all the contents of the article "how to switch versions of php". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.