Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4CookBook: PHPExcel : Allowed memory size of bytes exhausted #155

Open
ksn135 opened this issue May 30, 2015 · 10 comments
Open

4CookBook: PHPExcel : Allowed memory size of bytes exhausted #155

ksn135 opened this issue May 30, 2015 · 10 comments

Comments

@ksn135
Copy link
Contributor

ksn135 commented May 30, 2015

I've put it here. It may helps someone someday.

class AppKernel extends Kernel
{
    public function __construct($environment, $debug)
    {
        // workaround for fix memory leaks in PHPExcel
        \PHPExcel_Settings::setCacheStorageMethod(
              \PHPExcel_CachedObjectStorageFactory::cache_to_apc);
        parent::__construct($environment, $debug);
    }
/*...*/
}
@ioleo
Copy link
Member

ioleo commented May 30, 2015

@ksn135 I wish I knew that a year ago... I was struggling with PHPExcel and memory issues back then :)

@ksn135
Copy link
Contributor Author

ksn135 commented May 30, 2015

@loostro About three and a half hours of life... BUT I did it! )))

@bobvandevijver
Copy link
Member

Looks like it only works when you use APC caching, which is deprecated (see for example http://stackoverflow.com/questions/9611676/is-apc-compatible-with-php-5-4-or-php-5-5).

I haven't had any problems with PHPExcel yet, could you specify the amount of lines and columns tot give an indication about the size? Your serverconfig would be useful as well.

@ioleo
Copy link
Member

ioleo commented May 30, 2015

True, I wonder if there is an option to use Opcache?

@ksn135
Copy link
Contributor Author

ksn135 commented May 30, 2015

@bobvandevijver Well, memory_limit = 256MB and excel-file about 1MB in size with 60 rows and 10 columns of plain numbers. CSV is my best friend, BUT my client can upload only Excel-files (sic!).

@loostro No Opcahe

class PHPExcel_CachedObjectStorageFactory
{
    const cache_in_memory               = 'Memory';
    const cache_in_memory_gzip          = 'MemoryGZip';
    const cache_in_memory_serialized    = 'MemorySerialized';
    const cache_igbinary                = 'Igbinary';
    const cache_to_discISAM             = 'DiscISAM';
    const cache_to_apc                  = 'APC';
    const cache_to_memcache             = 'Memcache';
    const cache_to_phpTemp              = 'PHPTemp';
    const cache_to_wincache             = 'Wincache';
    const cache_to_sqlite               = 'SQLite';
    const cache_to_sqlite3              = 'SQLite3';
/*...*/
}

@ioleo
Copy link
Member

ioleo commented May 30, 2015

But memcache is there 👍

@ksn135
Copy link
Contributor Author

ksn135 commented May 30, 2015

Please, tell me about APC deprecation. What will we do about doctrine cache and admingenerator cache in future ?

@ksn135
Copy link
Contributor Author

ksn135 commented May 30, 2015

Well, everything fine.
Zend Optimizer+ is faster (http://www.ricardclau.com/2013/03/apc-vs-zend-optimizer-benchmarks-with-symfony2/)
You still can use APC via APCu (https://github.com/krakjoe/apcu)

@bobvandevijver And APC will be included in the PHP core from PHP 6! :)

@bobvandevijver
Copy link
Member

@ksn135 That would be nice if there is ever going to be a PHP6 ;) (https://wiki.php.net/rfc/php6?s[]=php6)

@sescandell
Copy link
Member

APC OpCode Optimizer is deprecated, but user ache capacities is not.

About admingen and cache capacities, it is no tlimited to APC: you can create the one you want, just have to make the right adapters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants