Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max Execution Timeout 30 Seconds/Mbstring Error Laravel 6*

I am working in Laravel 6.2 and have a basic database that houses a questions table that brings back an id, slug, title, body, timestamps. I have a route set up at questions that calls a controller which queries the DB and the passes the questions to a view index.blade.php and here I display questions with pagination. The issue is that I can display the $questions->title just fine but when I try to display the $question->body I keep getting a specific timeout error. I already changed the max_execution in my .ini from 30 to 300 and to no avail.

Specific Error

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /home/projects/inquiry-app/vendor/symfony/polyfill-mbstring/Mbstring.php on line 603

Line 603:

return (string) iconv_substr($s, $start, $length, $encoding);

Web.php

Route::get('/', function () {
    return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::resource('questions', 'QuestionsController');

QuestionsController

class QuestionsController extends Controller
{
    public function index()
    {
        $questions = Question::latest()->paginate(2);

        return view('questions.index', compact('questions'));
    }
}

index.blade.php

 @foreach($questions as $question)
                            <div class="media">
                                <div class="media-body">
                                    <h3 class="mt-0">{{$question->title}}</h3>
{{--                                    <p>{{Str::limit($question->body, 10)}}</p>--}}
                                </div>
                            </div>
                            <hr>
                       @endforeach

Any ideas why I would be getting this error? The page loads if the $question->body line is commented out.

I am on Ubuntu 19.04, Laravel 6.2, php7.3(FPM/FastCGI)

Thank you.

like image 901
CodeConnoisseur Avatar asked Sep 01 '26 06:09

CodeConnoisseur


1 Answers

To late but for someone got this issue.
This issue came from php mb-string not work well.
So reinstall php mb-string can fix this error.

like image 59
AkiHizashi Avatar answered Sep 02 '26 21:09

AkiHizashi