New in CWP Edge-LatestFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers, and CWP Cage gives every user complete isolation. Available now in the CWP Edge-Latest version.

Get CWPpro ›

basic php setup

Started by Neo2SHYAlien, September 03, 2016, 08:42:48 AM

Previous topic - Next topic

Neo2SHYAlien

Because I'm too lazy to edit all my php ini files i wrote basic stupid script to edit them instead of me :) The script is with hard coded values because I did it for my environment but is pretty simple to make changes for yours.


#!/bin/bash

INI_FILES="$(ls /opt/alt/php*/usr/php/php.ini) /usr/local/php/php.ini"

#setup some basic variables
for ini in $INI_FILES
do
    #make backup just in case :)
    [[ -f $ini ]]  || cp $ini $ini.orig
    sed -i.bak "/upload_max_filesize/c\upload_max_filesize = 16M" $ini
    sed -i "/post_max_size/c\post_max_size = 32M" $ini
    sed -i "/memory_limit/c\memory_limit = 256M" $ini
    grep -q ^error_log $ini && sed -i "/^error_log/c\error_log = error_log" $ini || echo "error_log = error_log" >> $ini
    grep -q ^date.timezone $ini && sed -i "/^date.timezone/c\date.timezone = Europe\/Sofia" $ini || sed -i "/;date.timezone/c\date.timezone = Europe\/Sofia" $ini
    grep "upload_max_filesize\|post_max_size\|memory_limit\|error_log" $ini
done

service httpd restart


Any edits/updates are welcome  ;)

p.s Please dont comment the values of the ini files, because this is not the purpose of this thread
"Would you tell me, please, which way I ought to go from here?"
"That depends a good deal on where you want to get to," said the Cat.
"I don't much care where–" said Alice.
"Then it doesn't matter which way you go," said the Cat.
Neo2SHYAlien's Blog