From 74d8150c17e46e235390372e2d092b9d31255c08 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 18 Dec 2014 15:27:36 +0530 Subject: [PATCH] Added PHP configuration part --- ee/cli/plugins/stack.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 68951f37..191b7183 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -103,7 +103,40 @@ class EEStackController(CementBaseController): self.app.render((data), 'nginx-core.mustache', out=ee_nginx) ee_nginx.close() - pass + if set(EEVariables.ee_php).issubset(set(apt_packages)): + # Parse etc/php5/fpm/php.ini + config.read("/etc/php5/fpm/php.ini") + config['PHP']['expose_php'] = 'Off' + config['PHP']['post_max_size'] = '100M' + config['PHP']['upload_max_filesize'] = '100M' + config['PHP']['max_execution_time'] = '300' + config['PHP']['date.timezone'] = time.tzname[time.daylight] + with open('/etc/php5/fpm/php.ini', 'w') as configfile: + config.write(configfile) + + # Prase /etc/php5/fpm/php-fpm.conf + config = configparser.ConfigParser() + config.read('/etc/php5/fpm/php-fpm.conf') + config['global']['error_log'] = '/var/log/php5/fpm.log' + with open('/etc/php5/fpm/php-fpm.conf', 'w') as configfile: + config.write() + + # Parse /etc/php5/fpm/pool.d/www.conf + config = configparser.ConfigParser() + config.read('/etc/php5/fpm/pool.d/www.conf') + config['www']['ping.path'] = '/ping' + config['www']['pm.status_path'] = '/status' + config['www']['pm.max_requests'] = '500' + config['www']['pm.max_children'] = '' + config['www']['pm.start_servers'] = '20' + config['www']['pm.min_spare_servers'] = '10' + config['www']['pm.max_spare_servers'] = '30' + config['www']['request_terminate_timeout'] = '300' + config['www']['pm'] = 'ondemand' + config['www']['listen'] = '127.0.0.1:9000' + with open('/etc/php5/fpm/pool.d/www.conf', 'w') as configfile: + config.write() + if len(packages): if any('/usr/bin/wp' == x[1] for x in packages): EEShellExec.cmd_exec("chmod +x /usr/bin/wp")