php.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. #move to script directory so all relative paths work
  3. cd "$(dirname "$0")"
  4. #includes
  5. . ./config.sh
  6. . ./colors.sh
  7. #send a message
  8. verbose "Install PHP and PHP-FPM"
  9. #set the version of php
  10. #yum-config-manager --enable remi-php70
  11. #yum-config-manager --enable remi-php71
  12. yum-config-manager --enable remi-php72
  13. #install dependencies
  14. yum -y install php-fpm php-gd php-pgsql php-odbc php-curl php-imap php-opcache php-common php-pdo php-soap php-xml php-xmlrpc php-cli php-gd
  15. #send a message
  16. verbose "Configuring php/nginx/php-fpm and permissions"
  17. #get the timezone
  18. TIMEZ=$(timedatectl | grep 'Time zone' | awk '{ print $3 }')
  19. #update the php configuration
  20. sed -ie "s#;date.timezone =#date.timezone = $TIMEZ#g" /etc/php.ini
  21. sed -ie 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php.ini
  22. sed -ie "s|listen = 127.0.0.1:9000|listen = /var/run/php-fpm/php-fpm.sock|g" /etc/php-fpm.d/www.conf
  23. sed -ie 's/;listen.owner = nobody/listen.owner = freeswitch/g' /etc/php-fpm.d/www.conf
  24. sed -ie 's/;listen.group = nobody/listen.group = daemon/g' /etc/php-fpm.d/www.conf
  25. sed -ie 's/group = apache/group = daemon/g' /etc/php-fpm.d/www.conf
  26. #update the php.ini
  27. #sed -ie 's/post_max_size = .*/post_max_size = 80M/g' /etc/php.ini
  28. #sed -ie 's/upload_max_filesize = .*/upload_max_filesize = 80M/g' /etc/php.ini
  29. #sed -ie 's/; max_input_vars = .*/max_input_vars = 8000/g' /etc/php.ini
  30. #make the session directory
  31. mkdir -p /var/lib/php/session
  32. #update permissions
  33. chmod -Rf 770 /var/lib/php/session
  34. #update the permissions
  35. find /var/www/fusionpbx -type d -exec chmod 770 {} \;
  36. find /var/www/fusionpbx -type f -exec chmod 664 {} \;
  37. #send a message
  38. verbose "php/nginx/php-fpm and permissions configured"