我正在尝试通过学说命令导入PostgreSQL dmp文件。尽管在导入之前清理了app / cache目录,但它仍抛出OutOfMemoryException。关于如何解决此问题的任何想法吗?
$ rm -rf app/cache/*
$ ll app/cache
total 0
$ php app/console doctrine:database:import zen_prod_20180625091104.dmp -vvv
Processing file '/home/xxxxxx/Documents/Projets/zen2/zen_prod_20180625091104.dmp'...
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in /home/btraband/Documents/Projets/zen2/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php on line 1098
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in /home/btraband/Documents/Projets/zen2/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php on line 1098
[Symfony\Component\Debug\Exception\OutOfMemoryException]
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes)
Exception trace:
() at /home/xxxxxx/Documents/Projets/zen2/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:1098
doctrine:database:import [--connection [CONNECTION]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] <command> <file> (<file>)...
$ ll zen_prod_20180625091104.dmp
-rw-r--r-- 1 xxxxxx xxxxxx 28M 25 juin 09:11 zen_prod_20180625091104.dmp
在下面的我的配置中找到一些信息:
$ php app/console --version
Symfony version 2.8.39 - app/dev/debug
$ composer show | grep -i -e doctrine
doctrine/annotations v1.6.0 Docblock Annotations Parser
doctrine/cache v1.7.1 Caching library offering an ...
doctrine/collections v1.5.0 Collections Abstraction library
doctrine/common v2.8.1 Common Library for Doctrine ...
doctrine/dbal v2.6.3 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.7 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.3 Symfony Bundle for Doctrine ...
doctrine/doctrine-migrations-bundle v1.3.1 Symfony DoctrineMigrationsBu...
doctrine/inflector v1.3.0 Common String Manipulations ...
doctrine/instantiator 1.1.0 A small, lightweight utility...
doctrine/lexer v1.0.1 Base library for a lexer tha...
doctrine/migrations v1.2.2 Database Schema migrations u...
doctrine/orm v2.5.14 Object-Relational-Mapper for...
gedmo/doctrine-extensions v2.4.35 Doctrine2 behavioral extensions
$ psql --version
psql (PostgreSQL) 9.6.9
答案 0 :(得分:2)
尝试增加php.ini中的memory_limit
答案 1 :(得分:0)
您可以尝试增加单个命令的内存大小,例如,导入可以使用的超大型数据库:
php -d memory_limit=10240M bin/console doctrine:database:import import.sql