+ # Set open_basedir so as to avoid leaks
+ open_basedir="$DocumentRoot:/etc/planetlab/php:/usr/share/plc_api/php:/var/log/myslice:/var/tmp/bootmedium:/var/log/bm:/tmp"
+ sed -i -e "s@[;]*open_basedir =.*@open_basedir = \"$open_basedir\"@" $php_ini
+
+ # for php-5.3 under fedora12, otherwise issues tons of warning messages
+ # Set timezone in php.ini if not already there
+ if grep '^;date.timezone' $php_ini >& /dev/null; then
+ dialog 'Setting PHP timezone to GMT'
+ sed -i -e 's,^;date.timezone.*,date.timezone = GMT,' $php_ini
+ fi
+
+ if grep '^short_open_tag = Off' $php_ini >& /dev/null; then
+ sed -i -e 's,^short_open_tag = Off,short_open_tag = On,' $php_ini
+ fi
+
+ ## patch php.ini
+ # memory limit
+ sed -i -e 's,^memory_limit = 32M *;,memory_limit = 80M ; patch myplc -- ,' $php_ini
+ # log_errors : is On by default
+ # error_log
+ if ! grep '^error_log *=' $php_ini > /dev/null ; then
+ echo 'error_log = /var/log/php.log' >> $php_ini
+ touch /var/log/php.log
+ chmod 666 /var/log/php.log
+ fi
+
+ # configure php-fpm as well if present (starting with f27)
+ if [ -d $php_fpm_dir ] ; then
+ cat > $php_fpm_conf << EOF
+[www]
+php_value[include_path] = $include_path
+php_value[open_basedir] = $open_basedir
+php_value[date.timezone] = GMT
+php_value[short_open_tag] = On
+php_value[memory_limit] = 80M
+EOF
+ # this is needed because otherwise, the first time
+ # we do this configuration, the service is already up
+ # and the config is usable only the second time
+ systemctl restart php-fpm
+ fi
+