codeigniter-restserver icon indicating copy to clipboard operation
codeigniter-restserver copied to clipboard

The configuration file rest.php does not exist.

Open ryeoman opened this issue 9 years ago • 10 comments

Hi, I add codeigniter-restserver to my project using composer, and i direct it to dir 'application/vendor' on my composer.json file. but I get error: 'The configuration file rest.php does not exist.'

ryeoman avatar Sep 23 '17 08:09 ryeoman

Hi @ryeoman, can you show me a code example how you include the project?

What i understand is, you included it via composer file, like

/codeigniter /codeigniter/application /codeigniter/application/composer.json <-- here?

And after you did composer update, it creates the /codeigniter/application/vendor folder, correct?

Did you enter the composer autoload file in your codeigniter config?

fabianblum avatar Sep 23 '17 14:09 fabianblum

Hi @Hanisch-IT , Thanks for the reply before, i use : use Restserver\Libraries\REST_Controller;

I have my composer.json file in: /codeigniter/composer.json <-- here I custom the composer.json file so that target directory for vendor like this: /codeigniter/application/vendor by adding this code: "config": { "vendor-dir": "application/vendor" }

the composer autoload file was generated automatically when I do 'composer install': /codeigniter/application/vendor/autoload.php and I set $config['composer_autoload'] = TRUE;

ryeoman avatar Sep 25 '17 02:09 ryeoman

Hi @ryeoman,

the library does not have a namespace. Try it without the use. And make sure that you set

$config['composer_autoload'] = realpath(APPPATH . '/vendor/autoload.php');

in your config.php

fabianblum avatar Sep 25 '17 08:09 fabianblum

Hi @Hanisch-IT , sorry for my late reply. I have set composer _autoload as your sugestion. but I get this error: Message: Class 'REST_Controller' not found

and in my controller I do this: // This can be removed if you use __autoload() in config.php OR use Modular Extensions /** @noinspection PhpIncludeInspection */ //require APPPATH . 'libraries/REST_Controller.php';

ryeoman avatar Sep 27 '17 13:09 ryeoman

@ryeoman Your controller should be like this one:

<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Flights extends REST_Controller { Your composer config line in application/config/config.php should be like this: $config['composer_autoload'] = realpath(APPPATH . '../vendor/autoload.php');

That's it! I tested yesterday on new project that I started and it works.

farukgaric avatar Sep 27 '17 13:09 farukgaric

Hi @ryeoman,

you dont need

require APPPATH . 'libraries/REST_Controller.php';

the composer autoload do all the file loadings for you. Only do what @farukgaric told you and you will be fine.

Regards

PS: Try to sorround your code blocks with

```php my php Code ```

then you will have a nice syntax highlighting

fabianblum avatar Sep 27 '17 14:09 fabianblum

@farukgaric @Hanisch-IT , Thanks for the reply, but I still got same error: The configuration file rest.php does not exist. for now I will close this isue, I will try to see through my problem then, but if the problem still ocure i will ask again,

Thanks You

ryeoman avatar Sep 27 '17 14:09 ryeoman

Did you find a solution? I'm having the same problem

jpbamberg1993 avatar Aug 27 '18 19:08 jpbamberg1993

I having the same problem! Any solution?

feeh27 avatar Sep 16 '18 21:09 feeh27

I "solved" this problem copying the rest.php file (rest server file) to folder application/config and copying the file Format.php (rest server file) to folder application/libraries.

feeh27 avatar Sep 16 '18 22:09 feeh27