Search code examples
codeigniterphpstorm

PhpStorm server using codeigniter


When developing a project using the IDE PhpStorm Codeigniter have the problem that if I do not generate a server does not send me the url of the controller to use the debug port , and if I think it also gives me a server to access failures . I do not know which is the optimal setting .

http://localhost:63342/U5AP1E2Alex/index.php (U5AP1E2Alex is the project's folder) It`s OK

http://localhost:63342/U5AP1E2Alex/index.php/tienda/index (Function index in controller Tienda) It's KO - 404 Not Found

If I build a Deployment Server I have problems too.. What's better configuration??


Solution

  • CodeIgniter 3v + Common checks 404 error.

    http://www.codeigniter.com/docs

    1: Check file name has first letter upper case:

    Tienda.php

    2: Check class name has first letter upper case:

    <?php
    
    class Tienda extends CI_Controller {
        public function index() {
    
        }
    }
    

    Make sure your config base url is not empty

    $config['base_url'] = 'http://localhost:63342/U5AP1E2Alex/';
    

    If your url http://localhost:63342/U5AP1E2Alex/index.php/tienda/ index then that should go direct to index function no need to have the function index at end of url

    You may need to configure some routes http://www.codeigniter.com/user_guide/general/routing.html

    $route['tienda'] = 'tienda/index';
    

    Or if in sub folder i.e controllers > some_folder > Tienda.php

    $route['tienda'] = 'some_folder/tienda/index';
    

    UPDATE:

    If you do not need index.php in url then I suggest you remove it by making this blank like below.

    $config['index_page'] = '';
    

    And adding a htaccess file in your main directory. Some htaccess Examples