PHP Fatal Error: Class "Controller" not found

1

I'm trying to run a PHP script on the Linux command line with:

php -f ClienteController.php

and I get this error in the command line:

PHP Fatal Error: Class 'Controller' not found in (__directorio__)

The ClientController code:

<?php
    class ClienteController extends Controller
{
    (contenido)
}

The strange thing is that I have this project in the localhost and if it works, but I also have it duplicated in a Linux server and this is where I get the error and I do not know why. I tried to do an include and a require of the Controller class and it still does not work. I do not know if it can be for some configuration that would have to do with the configuration files that come in Linux, since it also throws this error next to the other:

PHP Warning: PHP Startup: Unable to load dynamic library 'usr/lib64/php/modules/mysql.so' - 'usr/lib64/php/modules/mysql.so': cannot open shared object file: No such file or directory in Unknown on line 0

-RUTAS:
   -ClientController: \var\www\html\ClubVinos\clubdevinos\protected\modules\cliente\controllers\
   -Controller:

\var\www\html\ClubVinos\clubdevinos\protected\components

Thank you very much in advance !!

    
asked by Csc99 01.08.2018 в 15:37
source

2 answers

1

You have to make an inclusion of the file that contains the Controler class of which you extend

   <?php 
require_once "Controller.php"
class ClienteController extends Controller {

Or you can also define the class in the same file

    <?php 
class Controller{}
class ClienteController extends Controller {
    
answered by 01.08.2018 в 15:47
0

Apparently you need to indicate where the Controller class you are extending from is located.

You should add above, something like:

use App\Http\Controllers\Controller;

Or similar depending on the structure of your project.

    
answered by 01.08.2018 в 15:42