Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
13e0d121
Commit
13e0d121
authored
Dec 09, 2014
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rc: prune rc.php_ini_setup
* Avoid warnings for PDO and SimpleXML. * APC and ioncube are dead.
parent
8172b037
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
125 deletions
+3
-125
rc.bootup
etc/rc.bootup
+0
-2
rc.php_ini_setup
etc/rc.php_ini_setup
+3
-123
No files found.
etc/rc.bootup
View file @
13e0d121
#!/usr/local/bin/php -f
<?php
ini_set
(
'apc.enabled'
,
'0'
);
/* $Id$ */
/*
rc.bootup
part of pfSense by Scott Ullrich
...
...
etc/rc.php_ini_setup
View file @
13e0d121
...
...
@@ -27,7 +27,6 @@
# Set our operating platform
PLATFORM
=
`
/bin/cat /etc/platform
`
MIN_REALMEM_FOR_APC
=
512
if
[
-d
/usr/local/lib/php/20131226
]
;
then
# PHP 5.6
...
...
@@ -40,49 +39,6 @@ else
exit
1
fi
# Grab amount of memory that is detected
if
[
-f
/var/log/dmesg.boot
]
;
then
AVAILMEM
=
`
/bin/cat /var/log/dmesg.boot |/usr/bin/awk
'/avail memory/ { memory=($4 / 1048576); printf("%0.0f\n", memory); exit}'
`
else
AVAILMEM
=
`
/sbin/dmesg
-a
|/usr/bin/awk
'/avail memory/ { memory=($4 / 1048576); printf("%0.0f\n", memory); exit}'
`
fi
if
[
-z
"
$AVAILMEM
"
]
;
then
MEM
=
`
/sbin/sysctl hw.physmem |
cut
-d
':'
-f2
`
AVAILMEM
=
`
/bin/expr
$MEM
/ 1048576
`
fi
# Get amount of ram installed on this system
REALMEM
=
`
/sbin/sysctl hw.realmem | /usr/bin/awk
'{print $2/1048576}'
| /usr/bin/awk
-F
'.'
'{print $1}'
`
export
REALMEM
export
LOWMEM
if
[
${
REALMEM
}
-lt
$MIN_REALMEM_FOR_APC
]
;
then
LOWMEM
=
"TRUE"
echo
">>> Under
$MIN_REALMEM_FOR_APC
megabytes of ram detected. Not enabling APC."
echo
">>> Under
$MIN_REALMEM_FOR_APC
megabytes of ram detected. Not enabling APC."
| /usr/bin/logger
-p
daemon.info
-i
-t
rc.php_ini_setup
else
# Calculate APC SHM size according
# to detected memory values
if
[
"
$AVAILMEM
"
-gt
"135"
]
;
then
APCSHMEMSIZE
=
"10M"
fi
if
[
"
$AVAILMEM
"
-gt
"256"
]
;
then
APCSHMEMSIZE
=
"20M"
fi
if
[
"
$AVAILMEM
"
-gt
"384"
]
;
then
APCSHMEMSIZE
=
"25M"
fi
if
[
"
$AVAILMEM
"
-gt
"512"
]
;
then
APCSHMEMSIZE
=
"30M"
fi
if
[
"
$AVAILMEM
"
-gt
"784"
]
;
then
APCSHMEMSIZE
=
"50M"
fi
fi
# Set upload directory
if
[
"
$PLATFORM
"
=
"nanobsd"
]
;
then
UPLOADTMPDIR
=
`
/usr/bin/grep upload_path /etc/inc/globals.inc | /usr/bin/cut
-d
'"'
-f4
`
...
...
@@ -93,12 +49,9 @@ fi
# Define php modules. Do not add .so, it will
# be done automatically by the script below.
PHPMODULES
=
"standard"
if
[
"
$LOWMEM
"
!=
"TRUE"
]
;
then
PHPMODULES
=
"
$PHPMODULES
apc"
fi
# Config read/write
PHPMODULES
=
"
$PHPMODULES
xml libxml dom"
PHPMODULES
=
"
$PHPMODULES
simplexml
xmlreader xmlwriter"
PHPMODULES
=
"
$PHPMODULES
SimpleXML
xmlreader xmlwriter"
# Downloading via HTTP/FTP (pkg mgr, etc)
PHPMODULES
=
"
$PHPMODULES
curl date"
# Internationalization
...
...
@@ -126,12 +79,10 @@ PHPMODULES="$PHPMODULES shmop"
PHPMODULES
=
"
$PHPMODULES
zlib"
# SQLlite & Database
PHPMODULES
=
"
$PHPMODULES
spl"
PHPMODULES
=
"
$PHPMODULES
pdo
"
PHPMODULES
=
"
$PHPMODULES
PDO
"
PHPMODULES
=
"
$PHPMODULES
sqlite3"
# RADIUS
PHPMODULES
=
"
$PHPMODULES
radius"
# ZeroMQ
PHPMODULES
=
"
$PHPMODULES
zmq"
# SSH2
PHPMODULES
=
"
$PHPMODULES
ssh2"
# pfSense extensions
...
...
@@ -143,23 +94,6 @@ PHPMODULES="$PHPMODULES bcmath"
# filter
PHPMODULES
=
"
$PHPMODULES
filter"
PHP_ZEND_MODULES
=
"ioncube_loader"
PHP_ZEND_MODULES_TS
=
"ioncube_loader_ts"
# Modules previously included.
# can be turned on by touching
# /etc/php_dynamodules/$modulename
# sysvmsg \
# sysvsem \
# sysvshm \
# bcmath \
# tokenizer \
# uploadprogress \
# sockets \
# Reflection \
# mysql \
# bz2 \
# Clear the .ini file to make sure we are clean
if
[
-f
/usr/local/etc/php.ini
]
;
then
/bin/rm /usr/local/etc/php.ini
...
...
@@ -204,7 +138,6 @@ extension_dir=${EXTENSIONSDIR}
date.timezone="
${
TIMEZONE
}
"
; Extensions
EOF
# Copy php.ini file to etc/ too (cli)
...
...
@@ -227,18 +160,6 @@ if [ -d /etc/php_dynamodules ]; then
PHPMODULES
=
"
$PHPMODULES
$DYNA_MODULES
"
fi
# Read in zend modules
if
[
-d
/etc/php_dynamodules_zend
]
;
then
DYNA_MODULES
=
`
/bin/ls /etc/php_dynamodules_zend/
`
PHP_ZEND_MODULES
=
"
$PHP_ZEND_MODULES
$DYNA_MODULES
"
fi
# Read in zend threaded modules
if
[
-d
/etc/php_dynamodules_zend_ts
]
;
then
DYNA_MODULES
=
`
/bin/ls /etc/php_dynamodules_zend_ts/
`
PHP_ZEND_MODULES_TS
=
"
$PHP_ZEND_MODULES_TS
$DYNA_MODULES
"
fi
# Loop through and generate modules to load.
# Take into account modules built into php.
for
EXT
in
$PHPMODULES
;
do
...
...
@@ -257,37 +178,7 @@ for EXT in $PHPMODULES; do
fi
done
# Zend modules
for
EXT
in
$PHP_ZEND_MODULES
;
do
# Ensure extension exists before adding.
if
[
-f
"
${
EXTENSIONSDIR
}
/ioncube/
${
EXT
}
.so"
]
;
then
echo
"zend_extension=
${
EXTENSIONSDIR
}
/ioncube/
${
EXT
}
.so"
>>
/usr/local/lib/php.ini
fi
done
# Zend threaded modules
for
EXT
in
$PHP_ZEND_MODULES_TS
;
do
# Ensure extension exists before adding.
if
[
-f
"
${
EXTENSIONSDIR
}
/ioncube/
${
EXT
}
.so"
]
;
then
echo
"zend_extension_ts=
${
EXTENSIONSDIR
}
/ioncube/
${
EXT
}
.so"
>>
/usr/local/lib/php.ini
fi
done
if
[
"
$LOWMEM
"
!=
"TRUE"
]
;
then
/bin/cat
>>
/usr/local/lib/php.ini
<<
EOF
; APC Settings
apc.enabled="1"
apc.enable_cli="0"
apc.shm_size="
${
APCSHMEMSIZE
}
"
EOF
fi
/bin/cat
>>
/usr/local/lib/php.ini
<<
EOF
/bin/cat
>>
/usr/local/lib/php.ini
<<
EOF
[suhosin]
suhosin.get.max_array_depth = 5000
suhosin.get.max_array_index_length = 256
...
...
@@ -302,10 +193,8 @@ suhosin.request.max_array_index_length = 256
suhosin.request.max_vars = 5000
suhosin.request.max_value_length = 500000
suhosin.memory_limit = 512435456
EOF
# Copy php.ini file to etc/ too (cli)
/bin/cp /usr/local/lib/php.ini /usr/local/etc/php.ini
...
...
@@ -327,15 +216,6 @@ for EXT in $PHPMODULESLC; do
SHOULDREMOVE
=
"false"
fi
done
# Handle low memory situations
if
[
"
$LOWMEM
"
=
"TRUE"
]
;
then
if
[
"
$EXT
"
=
"apc"
]
;
then
SHOULDREMOVE
=
"true"
fi
if
[
"
$EXT
"
=
"xcache"
]
;
then
SHOULDREMOVE
=
"true"
fi
fi
if
[
"
$SHOULDREMOVE
"
=
"true"
]
;
then
if
[
-f
"
${
EXTENSIONSDIR
}${
EXT
}
.so"
]
;
then
echo
">>>
${
EXT
}
did not load correctly. Removing from php.ini..."
>>
/var/run/php_modules_load_errors.txt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment