phpmyadmin.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_phpMyAdmin() {
  11. if [ -e "${php_install_dir}/bin/phpize" ]; then
  12. pushd ${oneinstack_dir}/src > /dev/null
  13. PHP_detail_ver=`${php_install_dir}/bin/php-config --version`
  14. PHP_main_ver=${PHP_detail_ver%.*}
  15. if [[ "${PHP_main_ver}" =~ ^5.[3-6]$|^7.[0-1]$ ]]; then
  16. tar xzf phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz
  17. /bin/mv phpMyAdmin-${phpmyadmin_oldver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
  18. else
  19. tar xzf phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz
  20. /bin/mv phpMyAdmin-${phpmyadmin_ver}-all-languages ${wwwroot_dir}/default/phpMyAdmin
  21. fi
  22. /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
  23. mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save}
  24. sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  25. sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  26. sed -i "s@host'\].*@host'\] = '127.0.0.1';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  27. sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 32)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  28. chown -R ${run_user}:${run_group} ${wwwroot_dir}/default/phpMyAdmin
  29. popd > /dev/null
  30. fi
  31. }