Following @Ugo Meda's comment, I want to share with you my solution to this problem. As he correctly pointed out, I could not set APC settings (i.e. apc.max_file_size ) via ini_set . It just returns false , while other settings (i.e. memory_limit ) work well!
So the only thing I could do was install it directly in apc.ini. Location of this file on Ubuntu:
/etc/php5/conf.d/apc.ini
Sometimes your APC settings are located in php.ini in the [APC] section - the location of this file on Ubuntu:
/etc/php5/apache2/php.ini
If you cannot find it, just run this command:
find / -name apc.ini
If there is no such file (apc.ini), try to find php.ini and [APC] there:
find / -name php.ini
Once you find the correct configuration file, you are ready to edit its parameters. I just added two lines there:
apc.shm_size=512 apc.max_file_size=128M
After editing, save it and just restart Apache (Ubuntu - /etc/init.d/apache2 restart ). If for some reason you cannot run this command or you do not have rights to the mentioned * .ini files, then add the sudo command at the beginning of each of the above commands.
One more note about apc.shm_size:
If your APC version is lower than 3.1.4, the value of this configuration parameter should be written in the same format as I wrote (" M " is not indicated at the end). If your version is 3.1.4 or higher, you need to specify it as follows: 512M .
Source: http://e-mats.org/2010/10/apc_mmap-mmap-failed-cannot-allocate-memory/
@Ugo Meda - thanks again for pointing this out!