Troubleshooting API module sites

Last updated on
29 March 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Cron runs out of memory (error message or white screen of death)

The cron process for the API module can sometimes use a large amount of memory, so if your PHP memory limit is too small, you could run out of memory. This could result in an error saying "Allowed memory size of X bytes exhausted", or a White Screen of Death (WSOD).

If you have a WSOD, follow the steps on one of these pages to troubleshoot and fix the problem:

If you know that your problem is memory, follow the steps on this page to fix the problem:
http://drupal.org/node/207036

Branch 7.x-2.x of the API module uses a 3rd-party library known as "nikic/php-parser" (from https://github.com/nikic/PHP-Parser ) as part of the PHP file parsing process. Drush also uses this library.

After installing version 7.x-2.x of the API module and using Composer to download this PHP library from Github, if Drush has an older or incompatible version of the library, you could see PHP errors when attempting to use Drush to run the API module's cron jobs. One reported error was:

Error: Access level to ApiPrettyPrinter::pParam() must be public (as in class PhpParser\PrettyPrinter\Standard) 

If you see an error like this, it is probably due to Drush using a different Composer-based code set from the API module site. You should probably switch to running Drush from a .phar file installation, as it may not be possible to find a version of the PhpParser library that is compatible with both Drush and the API module. See http://docs.drush.org/en/master/install/ for details on how to install Drush.

PHP maximum function nesting level and stack errors

If you have xdebug or Suhosin running on your server, these packages have settings that prevent PHP from nesting function calls past a certain point. The default setting for xdebug is 100 nested calls (setting: xdebug.max_nesting_level), and for Suhosin, it is 750 (setting: suhosin.executor.max_depth). If you are running another PHP debugging or execution package, it probably has a similar setting.

Part of the parsing process in the API module 7.x-2.x branch involves deeply nested function calls -- the parsing process creates a parse tree of the PHP code, and then traverses that tree to "pretty-print" the code. So, to pretty-print the code for a file, you might have to go through a process like:

pretty print the file
  pretty print the class
    pretty print the method
      pretty print the if statement
        pretty print the first statement inside the {}
...

This can lead to a lot of nested function calls, given that each level of pretty printing involves several nested function calls in the pretty printer class.

So, if you see error messages about maximum function nesting levels or stack levels being exceeded, try increasing the call stack limit or disabling the call limit feature by setting the limit to zero.

Help improve this page

Page status: No known problems

You can: