-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path08_set_php.sh
26 lines (21 loc) · 892 Bytes
/
08_set_php.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# Sets some php variables:
# The maximum upload size as set in the environment variable
# MAX_UPLOAD_SIZE in php.ini (default: upload_max_filesize = 2M).
# The maximum post size as set in environment variable
# POST_MAX_SIZE in php.ini (default: post_max_size = 8M)
MAXUPLOADSIZE=${MAX_UPLOAD_SIZE:-2M}
POSTMAXSIZE=${POST_MAX_SIZE:-8M}
CONFIG_FILE=/etc/php/8.3/apache2/php.ini
echo "Set max_upload_size."
#Check if not yet set, if file exists, do nothing
if [ -f "$CONFIG_FILE" ]; then
sed -i -r 's,upload_max_filesize[ ]*=[ ]*[a-zA-Z0-9:\/\.]*,upload_max_filesize = '"$MAXUPLOADSIZE"',g' "$CONFIG_FILE"
fi
echo "Set post_max_size."
#Check if not yet set, if file exists, do nothing
if [ -f "$CONFIG_FILE" ]; then
sed -i -r 's,post_max_size[ ]*=[ ]*[a-zA-Z0-9:\/\.]*,post_max_size = '"$POSTMAXSIZE"',g' "$CONFIG_FILE"
fi
rm -f "$CONFIG_FILE-E"
rm -f "$CONFIG_FILE-r"