php maximum execution time of 30 seconds exceeded

Fatal error: Maximum execution time of 30 seconds exceeded

I am downloading a JSON file from an online source and and when it runs through the loop I am getting this error:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\temp\fetch.php on line 24

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

16 Answers 16

Your loop might be endless. If it is not, you could extend the maximum execution time like this:

can be used to temporarily extend the time limit.

I hope this could help you.

All the answers above are correct, but I use a simple way to avoid it in some cases.

Just put this command in the begining of your script:

I ran into this problem while upgrading to WordPress 4.0. By default WordPress limits the maximum execution time to 30 seconds.

Add the following code to your .htaccess file on your root directory of your WordPress Installation to over-ride the default.

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

Edit php.ini

Change its value to 300:

300 means 5 minutes of execution time for the http request.

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

Your script is timing out. Take a look at the set_time_limit() function to up the execution time. Or profile the script to make it run faster 🙂

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

We can solve this problem in 3 different ways.

1) Using php.ini file

3) Using Wp-config.php file ( for WordPress )

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

You can remove the restriction by seting it to zero by adding this line at the top of your script:

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

Open it and set the value of max_execution_time to a desired one.

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

Maybe check for any thing that you have changed under the php.ini file. For example I changed the «;intl.default_locale =» to «;intl.default_locale = en_utf8» in order to enable the «Internationalization extension (Intl)» without adding the «extension=php_intl.dll» then this same error occurred. So I suggest to check for similar mistakes.

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

!! But be aware that, both functions restarts also counting of time script has already taken to execute

so if you want to set exact maximum amount of time script can run, your command must be very first.

Differences between those two functions are

Источник

Ошибка Maximum execution time of 30 seconds exceeded

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

Ошибка Maximum execution time of 30 seconds exceeded возникает, когда PHP скрипт выполняется более 30 секунд.

Быстрое исправление

Чтобы исправить проблему, достаточно увеличить допустимое время работы скрипта в php.ini:

max_execution_time = 900
Ограничение в 15 минут, вместо 30 секунд по умолчанию

Установит ограничение в 900 секунд для текущего скрипта

Причин возникновения ошибки Maximum execution time может быть несколько.

1. Медленные внешние запросы

Если PHP получает какие-то данные из внешних ресурсов либо из базы данных, это может занимать очень большое количество времени. В этом случае можно использовать кэширование.

Для обнаружения медленных участков кода используйте профайлеры.

2. Бесконечные циклы и рекурсия

Частые ошибки в коде приводят к тому, что код выполняется бесконечно:

Цикл будет выполняться всегда

Общие рекомендации по оптимизации приложений на PHP.

Этот текст был написан несколько лет назад. С тех пор упомянутые здесь инструменты и софт могли получить обновления. Пожалуйста, проверяйте их актуальность.

Источник

Fatal error: Maximum execution time of 30 seconds exceeded in script

I have a customer who is getting an error related to a script timeout. I’ve included the code below, but i think the issue is that the timeout needs to be extended.

Is this something I can set in the code, or does it have to be set by the web host (GoDaddy)?

Fatal error: Maximum execution time of 30 seconds exceeded in D:\hosting\123\html\siteame\wp-content\plugins\myplugin\myplugin.php on line 170

The code at that point is:

6 Answers 6

If you’ve hosted your site on GoDaddy, Windows Hosting and are using WordPress, sooner or later you will face the max execution time out problem. I faced this problem for quite some time and looked aroung google, hitting my head. If you’ve faced the same series of problems as below:

this post is for you>

upload info.php to the root of your hosting. Now browse to http://yourhost/info.php. Whatever loads up on the screen is the PHP config. Look for Loaded Configuration File and note down its value. IN my case it is C:\PHP5\php.ini. We need all this information in our custom PHP5.ini file but its too much info to copy and format, so we will copy GoDaddy’s default file and edit it as necessary.

fire your text editor and create the following file: getconfig.php
(replace * with whatever path shows up in Loaded Configuration File)

copy file getconfig.php to badaddy and now browse to http://yourhost/baddaddy/getconfig.php.

Once you see «finally» written on screen, go back to the filemanager in GoDaddy Control Panel, goto baddaddy folder and you will see a new file PHP5.ini appear there. Download this file. This is a copy of GoDaddy Settings.

Make whatever changes you need to(just know what you’re changing, I am not a PHP expert, so I cannot be responsible if you screw up something). For my problem, I changed the max_execution_time = 30 to max_execution_time = 1200.

Upload the edited file to the root of your application and back in the GoDaddy Control Panel, IIS Management, hit Recycle App Pool, and then WAIT FOR A WHILE (20 minutes)

browse back to http://yourhost/info.php to confirm the new settings are in place

IMPORTANT ** IF you see a «500: Internal Server Error» on your GoDaddy WordPress Blog after doing all this, 12. Change the log_errors from log_errors = On to log_errors = Off in the PHP5.ini you just edited and re-upload, recycle app pool and wait. The 500 error pop up if the log file cannot be found.

I AM NO PHP EXPERT but this thing worked for me, the blog still loads slow but I have not seen any «Fatal Error: 30 second timeout» since then.

Источник

How to fix «Fatal error: Maximum execution time of 30 seconds exceeded» [duplicate]

I am trying to install woocommerce plugin to my wordpress website I get the following error message:

I also installed WP Maximum Execution Time Exceeded plugin too but I am still not able to install plugin. Please help me out with this.

5 Answers 5

This question has been asked before. Here is a link to an existing Stack Overflow question that should help you:

You need to update your PHP.ini file to tell Apache to allow PHP scripts to run longer than 30 seconds.

I encountered the same problem and solved it by increasing the maximum execution time to 180. Follow these steps to solve your problem:

Open the Xampp control panel Click on ‘config’ behind ‘Apache’

Change 30 to a bigger number (180 worked for me), like this:

‘Stop’ Apache server Close Xampp Restart Xampp ‘Start’ Apache server

install woocommerce plugin again

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

This problem kept me up for hours. What solved it for me was to increase the maximum execution time (max_execution_time) in php.ini file. Here is a step-by-step procedure:

php maximum execution time of 30 seconds exceeded. Смотреть фото php maximum execution time of 30 seconds exceeded. Смотреть картинку php maximum execution time of 30 seconds exceeded. Картинка про php maximum execution time of 30 seconds exceeded. Фото php maximum execution time of 30 seconds exceeded

i believe you are getting the error because you are trying to install woocommerce via Add New in the WordPress plugins section of wp-admin and your internet connection isn’t fast enough.

consider downloading your plugin’s zip file next time. then unpack the zip file you downloaded for the plugin in your /wp-content/plugins folder.

then when you log into wp-admin, go to plugins and you will see the plugin listed with other plugins but unactivated. just activate it then and the plugin should work fine.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *