Change php.ini values from shell script

后端 未结 2 434
情歌与酒
情歌与酒 2021-02-06 11:47

I am new to shell scripts. I am running Vagrant, and find myself needing to adjust these setting in the php.ini:

upload_max_filesize 120M
post_max_size 120M
max_         


        
2条回答
  •  一整个雨季
    2021-02-06 12:07

    with below script, you can easily adjust php.ini values. Every time, just need update top 4 lines.

    make sure, your sed command supports -i option.

    #!/usr/bin/env bash
    
    upload_max_filesize=240M
    post_max_size=50M
    max_execution_time=100
    max_input_time=223
    
    for key in upload_max_filesize post_max_size max_execution_time max_input_time
    do
     sed -i "s/^\($key\).*/\1 $(eval echo = \${$key})/" php.ini
    done
    

提交回复
热议问题