调用php app / console doctrine:schema:update时,Symfony2允许内存耗尽

时间:2021-09-08 11:19:57

I have a big problem...

我有一个大问题......

I want to update the schema of my database and I have a problem.

我想更新我的数据库的架构,我有一个问题。

When I a running this script:

当我运行这个脚本时:

php app/console doctrine:schema:update --dump-sql

I have this error:

我有这个错误:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in /Applications/MAMP/htdocs/myApp/vendor/doctrine/lib/Doctrine/ORM/Tools/SchemaTool.php on line 509

I have tried to increase memory_limit in php.ini but nothing works.

我试图在php.ini中增加memory_limit,但没有任何效果。

I have ran the php app/console cache:clear but it does nothing. Still the same problem...

我已经运行了php应用程序/控制台缓存:清除但它什么也没做。还是同样的问题......

Please help...

请帮忙...

I can't do nothing...

我无能为力......

3 个解决方案

#1


27  

Do:

做:

php -d memory_limit=200M app/console doctrine:schema:update --dump-sql

200M or higher

200M或更高

#2


2  

First of all check php.ini location by creating php file that outputs php's configuration

首先通过创建输出php配置的php文件来检查php.ini位置

<?php

    phpinfo();

Run this file in a browser and check "Loaded Configuration File" this is the location of php.ini.

在浏览器中运行此文件并选中“已加载的配置文件”,这是php.ini的位置。

Another method to solve the issue is to add the next line of code to app/console file:

解决该问题的另一种方法是将下一行代码添加到app / console文件:

ini_set('memory_limit', '64M');

64 MB should be enough

64 MB就足够了

#3


0  

Consolidate and Summarize of all answers and comments:

整合和总结所有答案和评论:

  1. It does not matter what command you issue, what matters is your PHP configuration.

    发出什么命令并不重要,重要的是你的PHP配置。

  2. This is the error:

    这是错误:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 434032 bytes)

    致命错误:允许的内存大小为134217728字节耗尽(尝试分配434032字节)

  3. Solution: in your php.ini change to this example, and restart Apache/web server:

    解决方案:在您的php.ini中更改此示例,并重新启动Apache / Web服务器:

    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit=512M
    

Tested and working.

经过测试和工作。

#1


27  

Do:

做:

php -d memory_limit=200M app/console doctrine:schema:update --dump-sql

200M or higher

200M或更高

#2


2  

First of all check php.ini location by creating php file that outputs php's configuration

首先通过创建输出php配置的php文件来检查php.ini位置

<?php

    phpinfo();

Run this file in a browser and check "Loaded Configuration File" this is the location of php.ini.

在浏览器中运行此文件并选中“已加载的配置文件”,这是php.ini的位置。

Another method to solve the issue is to add the next line of code to app/console file:

解决该问题的另一种方法是将下一行代码添加到app / console文件:

ini_set('memory_limit', '64M');

64 MB should be enough

64 MB就足够了

#3


0  

Consolidate and Summarize of all answers and comments:

整合和总结所有答案和评论:

  1. It does not matter what command you issue, what matters is your PHP configuration.

    发出什么命令并不重要,重要的是你的PHP配置。

  2. This is the error:

    这是错误:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 434032 bytes)

    致命错误:允许的内存大小为134217728字节耗尽(尝试分配434032字节)

  3. Solution: in your php.ini change to this example, and restart Apache/web server:

    解决方案:在您的php.ini中更改此示例,并重新启动Apache / Web服务器:

    ; Maximum amount of memory a script may consume (128MB)
    ; http://php.net/memory-limit
    memory_limit=512M
    

Tested and working.

经过测试和工作。