简体   繁体   中英

PHP ajax process 404 page not found error before complete the process

I am using a PHP ajax function to load the Twitter followers using Twitter API into database,In the case of large number of followers.it takes longtime for processing and before completion of the process 404 page not found error is occurred.

How to solve this issue

You can rise the time that a script is allowed to execute: http://php.net/manual/de/function.set-time-limit.php

Give attention to your max_execution_time in php.ini

But i wouldnt suggest if you are doing this in the frontend then it sounds more like an performance problem of your script. No user want to wait more than 4 seconds for website. Also 2 seconds are too long.

You have to increase execution time. It can be done in 2 ways

  1. Set the value in script
  2. Set the value in php.ini file

Set the value in your script

 ini_set('max_execution_time', 300); //300 seconds = 5 minutes 

Copy and paste the above code in to your applications config file or index.php or on a specified file.

Set the value in php.ini file

Open your php.ini file in notepad. Search for the string max_execution_time . Change its value into 300. (You can find the file in your c:/wamp/bin/php folder)

I set max_execution_time to 0 still i found the issue. I guess the issue is related to Apache server timeout. I echo 'something' after each insertion to the database and its working.

Sametime I found another issue in the front end page,"Internal server error 500" but still ajax process for insertion is progressing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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