0

I have a project bulit on framework Codeigniter which when uploading it to the server and the attempt to download an Excel file with the help of the PHPExcel library is signaling me the following error:

require_once(application/third_party/PHPExcel/PHPExcel.php): failed to open stream: No such file or directory

In local it works to me of the following way, in the folder libraries:

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."/third_party/PHPExcel/PHPExcel.php"; require_once APPPATH."/third_party/PHPExcel/PHPExcel/IOFactory.php"; class Excel extends PHPExcel { public function __construct() { parent::__construct(); } } 

Already tried in the following ways:

Way 1: require_once "../third_party/PHPExcel/PHPExcel.php"; require_once "../third_party/PHPExcel/PHPExcel/IOFactory.php"; Way 2: require_once BASEPATH."third_party/PHPExcel/PHPExcel.php"; require_once BASEPATH."third_party/PHPExcel/PHPExcel/IOFactory.php"; 

But nevertheless I still mark error, like I already gave 777 permissions to all folders thinking that it is error per permissions, but I mark the same error.
The structure of my folders is as follows:

enter image description here

I would appreciate any comments to solve a problem.

1
  • yes, in the folder phpExcel there are the file phpExcel.php and the folder PHPExcel with the other components of the library Commented Jul 30, 2018 at 16:05

1 Answer 1

1

Try with this : replace APPPATH."/third_party with APPPATH."third_party

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."third_party/PhpExcel/PHPExcel.php"; require_once APPPATH."third_party/PhpExcel/PHPExcel/IOFactory.php"; class Excel extends PHPExcel { public function __construct() { parent::__construct(); } } 

for more :https://www.codeigniter.com/user_guide/general/reserved_names.html

Sign up to request clarification or add additional context in comments.

2 Comments

make sure PHPExcel.php has class name PHPExcel
change ur first folder name from PHPExcel to PhpExcel as in my answer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.