Welcome Guest, Not a member yet? Register   Sign In
Gateway time out CI 4.4.1
#1

I have a project made on Codeigniter 4.4.1 + MySQL

The setup is:

Routes.php

PHP Code:
$routes->get('admin_start',  'Admin::index');
$routes->get('admin_ejercicios',  'Admin::admin_ejercicios');
$routes->get('admin_rutinas',  'Admin::admin_rutinas'); 

Controller: Admin.php

PHP Code:
<?php

namespace App\Controllers;
use 
App\Models\Admin_model;
use 
App\Models\Admin_users_model;

use 
App\Controllers\BaseController;


class 
Admin extends BaseController
{

    protected $helpers = ['form','url','html'];

    public function index()
    {
        $data['content_view']="admin/admin_users_view";
        return view('admin/admin_main_view',$data);
    }

    public function admin_ejercicios()
    {
        $data['content_view']="admin/admin_ejercicios_view";
        return view('admin/admin_main_view',$data);
    }

    public function admin_rutinas()
    {
        $user_id    =$this->request->getGet('id');

        $admin_model= new Admin_users_model();
        $user_name=$admin_model->get_username($user_id);

        $data['user_name']=$user_name;
        $data['user_id']=$user_id;
        $data['content_view']="admin/admin_rutinas_view";
      
        
return view('admin/admin_main_view',$data);
    }



.htaccess

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>


Switching between these controllers:

http://192.168.1.167/gym/admin_rutinas?id=70

or

http://192.168.1.167/gym/admin_ejercicios

or

http://192.168.1.167/gym/admin_start

I get a 504 Gateway timeout error after 5min waiting for response

On the browser console the call is shown as pending, and never throws an error.

I tried to change max_execution_time on PHP to 0 or -1 and I have the same behaivour

The database has only a few records, so I don't think it is due to a long response from the server.

I'm also having the same behaivour on my hosting.

Could it be something related with the framework?, or it is just my code?


Thanks.
Reply
#2

After a clean installation, does the default page work? 
How do you run the server? spark serve or via apache2?
Simple CI 4 project for beginners codeigniter-expenses
Reply
#3

Yes, the default page works.
And everything works ok except when I switch between the mentioned controllers after two or more times 
The server runs via Apache2.
Thanks.
Reply
#4

Any ideas?
Reply
#5

Start with a simple one. 
Comment out the routes except for one + SQL call code and show an empty template. Then uncomment the requests.
PHP Code:
    public function admin_rutinas()
    {
        $user_id    =$this->request->getGet('id');

        // $admin_model= new Admin_users_model();
        // $user_name=$admin_model->get_username($user_id);

        $data['user_name']='Username';
        $data['user_id']=$user_id;
        $data['content_view']="admin/admin_rutinas_view";
      
        
return view('admin/admin_main_view',$data);
    }

//$routes->get('admin_start',  'Admin::index');
//$routes->get('admin_ejercicios',  'Admin::admin_ejercicios');
$routes->get('admin_rutinas',  'Admin::admin_rutinas'); 
Simple CI 4 project for beginners codeigniter-expenses
Reply
#6

Try to use "Local Development Server".
https://codeigniter4.github.io/CodeIgnit...ent-server
If your app works, the issue is your Apache configuration.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB