logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
Fatal error when trying to run 'propel:build-model'

Frustrating. We just moved to a new server. I try to run "symfony propel:build-model" and I get an out of memory error:

 ./symfony propel:build-model 

[propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
[propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
[propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ObjectBuilder.php on line 1839

>> schema converting "/home/tma/core/config/schema.yml" to XML
>> schema putting /home/tma/core/config/generated-schema.xml
>> schema converting "/home/tma/core/plug...lugin/config/schema.yml" to XML
>> schema putting /home/tma/core/plugins/...ggableBehaviorPlugin-schema.xml
>> schema converting "/home/tma/core/plug...lugin/config/schema.yml" to XML
>> schema putting /home/tma/core/plugins/...erated-sfGuardPlugin-schema.xml
>> file+ config/generated-sfPropelActAsTaggableBehaviorPlugin-schema.xml
>> file- /home/tma/core/plugins/sfPropel...ggableBehaviorPlugin-schema.xml
>> file+ config/generated-sfGuardPlugin-schema.xml
>> file- /home/tma/core/plugins/sfGuardP...erated-sfGuardPlugin-schema.xml
>> propel Running "om" phing task
Buildfile: /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/build.xml
[resolvepath] Resolved /home/tma/core/config to /home/tma/core/config

propel-project-builder > check-project-or-dir-set:


propel-project-builder > check-project-set:


propel-project-builder > set-project-dir:


propel-project-builder > check-buildprops-exists:


propel-project-builder > check-buildprops-for-propel-gen:


propel-project-builder > check-buildprops:


propel-project-builder > configure:

[echo] Loading project-specific props from /home/tma/core/config/propel.ini
[property] Loading /home/tma/core/config/propel.ini

propel-project-builder > om:

[phing] Calling Buildfile '/usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'om'
[property] Loading /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties

propel > check-run-only-on-schema-change:


propel > om-check:


propel > mysqli-check:


propel > om:

[echo] +------------------------------------------+
[echo] | |
[echo] | Generating Peer-based Object Model for |
[echo] | YOUR Propel project! |
[echo] | |
[echo] +------------------------------------------+
[phingcall] Calling Buildfile '/usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/build-propel.xml' with target 'om-template'
[property] Loading /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/./default.properties

propel > om-template:

[propel-om] Processing: generated-sfGuardPlugin-schema.xml
[propel-om] Processing: generated-schema.xml
[propel-om] Processing: generated-sfPropelActAsTaggableBehaviorPlugin-schema.xml
[propel-om] Processing Datamodel : JoinedDataModel
[propel-om] - processing database : propel
[propel-om] + sf_guard_group
[propel-om] -> BasesfGuardGroupPeer [builder: SfPeerBuilder]



Any thoughts about how to work around this? And why would Symfony need more memory on the new server than the last server?

This question has been answered.

Lawrence Krubner | 01/20/13 at 6:02pm Edit
Tutorial: How to assign prize money


(14) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    01/20/13
    6:22pm
    Milena Dimitrova says:

    You will have to increase the PHP memory limit in Command Line php.ini configuration file.

    This file is typically located in: /etc/php5/cli/

    Try for instance with the following setting:

    memory_limit = 600M 


    In case you do not have access to this file you might have to simply build the model in your local environment and then just checkout/transfer the generated base classes to the new server.


  • avatar
    Last edited:
    01/20/13
    10:46pm
    Luis Cordova says:

    PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ObjectBuilder.php on line 1839

    yes also look on what has changed or if some error or modification prompt this error, usually it is either you need more or you have an infinite loop, so discard that first

  • avatar
    Last edited:
    01/22/13
    11:30pm
    Evert Harmeling says:

    Do you have `php_xsl` enabled?

    php -m | grep xsl


    The memory error probably is a result of the `xsl` extension not being enabled.
    If not remove the ';' before the 'extension=php_xsl.dll' line in your php.ini.

  • avatar
    Last edited:
    01/22/13
    5:25pm
    Lawrence Krubner says:

    " look on what has changed or if some error or modification prompt this error,"

    Yes, that is obvious. But where should I look? We just moved to a new server, many things have changed. I'm looking for suggestions on how to narrow it down.

  • avatar
    Last edited:
    01/22/13
    5:27pm
    Lawrence Krubner says:

    I have never seen this before. Do you know what it means?

    php -i | grep memory
    memory_limit => -1 => -1

  • avatar
    Last edited:
    01/22/13
    5:36pm
    Luis Cordova says:

    pay close attention to errors

    [propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.

    [propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.

    [propel-om] Could not perform XLST transformation. Make sure PHP has been compiled/configured to support XSLT.

    PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in /usr/share/php/symfony/plugins/sfPropelPlugin/lib/vendor/propel-generator/classes/propel/engine/builder/om/php5/PHP5ObjectBuilder.php on line 1839

    try to go by what it is doing when it fails. So if it is building objects on there it seems something with php5.3-5.4 version
    so check your php version?

  • avatar
    Last edited:
    01/22/13
    5:36pm
    Luis Cordova says:

    most likely is that

  • avatar
    Last edited:
    01/22/13
    10:34pm
    Milena Dimitrova says:

    This command

    php -i | grep memory_limit


    checks the 'memory_limit' setting in php.ini.

    However, PHP on the command line might use a different configuration file than the Apache version.

    You can find the location of the currently loaded php.ini file with this command:

    php -i | grep php.ini

  • avatar
    Last edited:
    01/27/13
    1:32am
    Lawrence Krubner says:

    The version from the command line:

    php -v
    PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

  • avatar
    Last edited:
    01/27/13
    1:34am
    Lawrence Krubner says:

    This:

    php -m | grep xsl

    returns nothing.

    However, I have seen the XSL error consistently since I started working with Symfony in 2008. I have seen that error with every version of Symfony I have ever worked with. That error has never given a problem before, therefore it is not a problem now.

  • avatar
    Last edited:
    01/27/13
    1:37am
    Lawrence Krubner says:

    This:

    php -i | grep php.ini
    Configuration File (php.ini) Path => /etc/php5/cli
    Loaded Configuration File => /etc/php5/cli/php.ini


    If I open this:

    /etc/php5/cli/php.ini

    I see:

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

    See screenshot.

    I am unclear what the -1 means, but in other programming languages it would suggest no limits.

    attachment image expert uploaded image

  • avatar
    Last edited:
    01/27/13
    1:42am
    Lawrence Krubner says:

    Hmm, okay. I reset memory limit to 400M and that seemed to work. It is possible that "-1" suggests a default value of 32 megs. I am not sure where that default would be set, if not in the php.ini. I have not run into that before.

  • avatar
    Last edited:
    01/27/13
    11:22am
    Milena Dimitrova says:

    If 400M works in your case - that's great!

    Indeed according to the php documentation:

    'to have no memory limit, set this directive to -1.'.


    However, there might be something else in your environment (e.g. suhosin) preventing memory_limit to go above some defined cap.

    So, you are right that in practice memory_limit defaulted to 32 megabytes (as you got an error: '33554432 bytes exhausted' ).

    Regarding the lack of XSLT: it might be useful to check all server settings needed for symfony before installation from the command line:

    php check_configuration.php


    check_configuration.php:
    <?php

    function is_cli()
    {
    return !isset($_SERVER['HTTP_HOST']);
    }

    /**
    * Checks a configuration.
    */
    function check($boolean, $message, $help = '', $fatal = false)
    {
    echo $boolean ? " OK " : sprintf("[[%s]] ", $fatal ? ' ERROR ' : 'WARNING');
    echo sprintf("$message%s\n", $boolean ? '' : ': FAILED');

    if (!$boolean)
    {
    echo " *** $help ***\n";
    if ($fatal)
    {
    die("You must fix this problem before resuming the check.\n");
    }
    }
    }

    /**
    * Gets the php.ini path used by the current PHP interpretor.
    *
    * @return string the php.ini path
    */
    function get_ini_path()
    {
    if ($path = get_cfg_var('cfg_file_path'))
    {
    return $path;
    }

    return 'WARNING: not using a php.ini file';
    }

    if (!is_cli())
    {
    echo '<html><body><pre>';
    }

    echo "********************************\n";
    echo "* *\n";
    echo "* symfony requirements check *\n";
    echo "* *\n";
    echo "********************************\n\n";

    echo sprintf("php.ini used by PHP: %s\n\n", get_ini_path());

    if (is_cli())
    {
    echo "** WARNING **\n";
    echo "* The PHP CLI can use a different php.ini file\n";
    echo "* than the one used with your web server.\n";
    if ('\\' == DIRECTORY_SEPARATOR)
    {
    echo "* (especially on the Windows platform)\n";
    }
    echo "* If this is the case, please launch this\n";
    echo "* utility from your web server.\n";
    echo "** WARNING **\n";
    }

    // mandatory
    echo "\n** Mandatory requirements **\n\n";
    check(version_compare(phpversion(), '5.2.4', '>='), sprintf('PHP version is at least 5.2.4 (%s)', phpversion()), 'Current version is '.phpversion(), true);

    // warnings
    echo "\n** Optional checks **\n\n";
    check(class_exists('PDO'), 'PDO is installed', 'Install PDO (mandatory for Propel and Doctrine)', false);
    if (class_exists('PDO'))
    {
    $drivers = PDO::getAvailableDrivers();
    check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Propel and Doctrine)');
    }
    check(class_exists('DomDocument'), 'PHP-XML module is installed', 'Install and enable the php-xml module (required by Propel)', false);
    check(class_exists('XSLTProcessor'), 'XSL module is installed', 'Install and enable the XSL module (recommended for Propel)', false);
    check(function_exists('token_get_all'), 'The token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
    check(function_exists('mb_strlen'), 'The mb_strlen() function is available', 'Install and enable the mbstring extension', false);
    check(function_exists('iconv'), 'The iconv() function is available', 'Install and enable the iconv extension', false);
    check(function_exists('utf8_decode'), 'The utf8_decode() is available', 'Install and enable the XML extension', false);
    check(function_exists('posix_isatty'), 'The posix_isatty() is available', 'Install and enable the php_posix extension (used to colorized the CLI output)', false);

    $accelerator =
    (function_exists('apc_store') && ini_get('apc.enabled'))
    ||
    function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
    ||
    function_exists('xcache_set')
    ;
    check($accelerator, 'A PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);

    check(!ini_get('short_open_tag'), 'php.ini has short_open_tag set to off', 'Set it to off in php.ini', false);
    check(!ini_get('magic_quotes_gpc'), 'php.ini has magic_quotes_gpc set to off', 'Set it to off in php.ini', false);
    check(!ini_get('register_globals'), 'php.ini has register_globals set to off', 'Set it to off in php.ini', false);
    check(!ini_get('session.auto_start'), 'php.ini has session.auto_start set to off', 'Set it to off in php.ini', false);

    check(version_compare(phpversion(), '5.2.9', '!='), 'PHP version is not 5.2.9', 'PHP 5.2.9 broke array_unique() and sfToolkit::arrayDeepMerge(). Use 5.2.10 instead [Ticket #6211]', false);

    if (!is_cli())
    {
    echo '</pre></body></html>';
    }

  • avatar
    Last edited:
    01/29/13
    2:28am
    Lawrence Krubner says:

    Thank you for looking that up. I did not have time to dig into the docs. I would have assumed that -1 meant "no limit". But clearly, something else was setting a limit.

This question has expired.



Lawrence Krubner voted on this question.



Current status of this question: Completed



Please log in to add additional discourse to this page.





Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.