My questions is how I can detect real memory limit on hosting? The php.ini settings do not always represent the true limits, for example, memory_limit of 512MB, the script might fail at 128MB, same for max_execution time.
My questions is how I can detect real memory limit on hosting? The php.ini settings do not always represent the true limits, for example, memory_limit of 512MB, the script might fail at 128MB, same for max_execution time.
2
Answers
you can not check the memory limit of the server using php you can just check the limit which is set by the server admin in php.ini file
If PHP exec commands are not blocked you could run a shell command like
and parse the result. Or directly for the parameter of your choice, e.g. get the real Gigabytes available from the /proc/meminfo output like