简体   繁体   English

更改了php.ini中的max_execution_time设置,Drupal仍然存在问题

[英]Changed setting in php.ini for max_execution_time, Drupal still having problems

Ok, I am trying to do some work for a client. 好的,我正在尝试为客户做一些工作。 Currently we're just trying to do a kludgy fix for a custom function another developer created, which exports a CSV of all of their contacts. 目前,我们只是试图对另一个开发人员创建的自定义功能进行模糊修复,该功能会导出其所有联系人的CSV。

As they've added more contacts, the function takes longer, and it requires more memory (we've had to up their memory limit from 128M to 256M already, and now up to 512M). 随着他们添加更多联系人,该功能将花费更长的时间,并且需要更多的内存(我们必须将其内存限制从128M提高到256M,现在达到512M)。

Anyway, I'm trying to run the CSV exporter, and I'm getting the following errors, on different runs: 无论如何,我正在尝试运行CSV导出器,并且在不同的运行中遇到以下错误:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/readyby2/public_html/includes/module.inc on line 19

Fatal error: Maximum execution time of 30 seconds exceeded in /home/readyby2/public_html/sites/all/modules/contrib/views/modules/field/views_handler_field_field.inc on line 0

and every now and again I am getting an Internal Server Error 500 而且我时不时地收到内部服务器错误500

Note, this function HAS worked before - and I have seen it work. 请注意,此功能以前曾起作用过-我已经看到它起作用了。

Now, as far as I can tell, this means that I need to change the maximum execution time setting in php.ini. 现在,据我所知,这意味着我需要更改php.ini中的最大执行时间设置。

There is a php.ini file outside of the /public_html folder (which is where the files for the Drupal install are kept) and I've modified that setting - but still get all of the errors above. /public_html文件夹之外有一个php.ini文件(Drupal安装文件保留在该文件中),并且我已经修改了该设置-但仍然收到上述所有错误。 I've changed it to 60, 90, and 0, respectively, no change. 我将其分别更改为60、90和0,没有变化。

Is there anywhere else where timeout settings are set for a Drupal install? 还有其他地方为Drupal安装设置了超时设置吗? Am I finding the right php.ini file? 我在找到正确的php.ini文件吗? I'm not seeing one in the /public_html directory, or any others. 我在/public_html目录中没有看到任何其他文件。

How can I solve this issue? 我该如何解决这个问题? I've already upped the memory limit (could the server error imply that there isn't enough memory available on the server to perform this function?) 我已经提高了内存限制(服务器错误是否暗示服务器上没有足够的内存来执行此功能?)

Any advice or help would be useful. 任何建议或帮助将是有用的。

As an FYI, this is in Drupal 7. PHP version is 5.x (I don't remember the exact one, think it is 5.1, can find out if necessary). 作为一个FYI,它在Drupal 7中。PHP版本是5.x(我不记得确切的版本,认为它是5.1,可以在必要时找到它)。

Where the correct php.ini is, is going to depend a lot on your hosting environment but you can quickly get around it by using either ini_set or the set_time_limit function on the script. 正确的php.ini会在很大程度上取决于您的托管环境,但是您可以通过在脚本上使用ini_setset_time_limit函数来快速解决它。

You can do the ini set in settings.php but then it will be global for the whole site. 您可以在settings.php中设置ini设置,但是它将对整个站点都是全局的。

ini_set('max_execution_time', 120); to settings.php 到settings.php

or in your script set_time_limit ( 120 ) this doesn't work if PHP safemode is on! 或在您的脚本set_time_limit ( 120 )中,如果启用了PHP安全模式,则此方法将无效!

Usually the php.ini file is somewhere like /etc/php5/apache/php.ini or similar. 通常,php.ini文件位于/etc/php5/apache/php.ini类的/etc/php5/apache/php.ini Maybe just /etc/php.ini on more simple setups. 在更简单的设置上,也许只是/etc/php.ini

You might want to consult your software management system: $> rpm -ql php5 or the apt alternative, if you on a debian based system. 如果您使用的是基于Debian的系统,则可能要咨询您的软件管理系统: $> rpm -ql php5或apt替代方案。 That lists you the files contained in the package. 那列出了您包中包含的文件。 The php.ini file should be amongst them. php.ini文件应该在其中。 Depending on your distribution you might also have to look at the package apache-mod_php5 or similar. 根据您的发行版,您可能还必须查看软件包apache-mod_php5或类似的软件包。 Search for php inside your package management, for example with $> rpm -q --whatprovides /usr/bin/php5 or $> rpm -qa | grep -i php 在包管理内部搜索php,例如,使用$> rpm -q --whatprovides /usr/bin/php5$> rpm -qa | grep -i php $> rpm -qa | grep -i php . $> rpm -qa | grep -i php

Call phpinfo() within the drupal environment. 在drupal环境中调用phpinfo() In the output php specifies which php.ini file has been parsed. 在输出php中,指定已解析的php.ini文件。

另一个选择是将以下内容添加到drupal的.htaccess

php_value max_execution_time 0

You can always try (in settings.php of you sites (sites/default/settings.php) see if you got rights write it. 您可以随时尝试(在您网站的settings.php中(sites / default / settings.php)中,查看是否拥有编写权限。

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

it's overwride php.ini. 它超越了php.ini。 But I don't think you can fix it by increase memory(you can't increase your limit every time you got memory problem). 但是我不认为可以通过增加内存来解决它(每次遇到内存问题时都不能增加限制)。 You must find what produce this reach limit (infinite boucle, too much result...) You can always use Views module and csv export to make a good csv with a good views :D Just think to overwride pager for csv. 您必须找到导致此范围极限的原因(无限循环,太多结果...)。您始终可以使用Views模块和csv导出来制作具有良好视图的良好csv:D只需考虑覆盖csv的传呼机即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM