Welcome Guest, Not a member yet? Register   Sign In
Strange problem - CodeIgniter Error - won't start
#1

Hello.
I'm not a professional programmer, but I'm trying to help my student intern so that he can help me this summer.  We are running into a very strange problem that neither of us, nor my other programming supporters, can figure out.
On my system, I'm running xampp with my codeigniter-framework website without any problems. 
We've installed the exact same xampp with the same files on my student's computer, but when he tries to run localhost, this is the error message he gets:

Code:
Deprecated: filter_var(): Passing null to parameter #3 ($options) of type array|int is deprecated in
C:\WorkingWebs\cirwep\priv\codeigniter\system\HTTP\RequestTrait.php on line 338

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at
C:\WorkingWebs\cirwep\public_html\app\Config\Events.php:35) in C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php:137
Stack trace: #0 [internal function]:
CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', 'C:\\WorkingWebs\\...', 137) #1
C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php(137): header('HTTP/1.1 500 In...', true, 500) #2 [internal function]:
CodeIgniter\Debug\Exceptions->exceptionHandler(Object(CodeIgniter\Cache\Exceptions\CacheException))
#3 {main} thrown in C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php on line 137

Fatal error: Uncaught ErrorException: Cannot modify header information -
headers already sent by (output started at C:\WorkingWebs\cirwep\public_html\app\Config\Events.php:35) in
C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php:137
Stack trace: #0 [internal function]:
CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', 'C:\\WorkingWebs\\...', 137)
#1 C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php(137): header('HTTP/1.1 500 In...', true, 500)
#2 C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php(197): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
#3 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
#4 {main} thrown in C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php on line 137
WorkingWebs is the local folder under which the cirwep website is installed.  These are all Codeigniter files that are having issues, but we can't figure out what the problem is though we have spent many days on this issue. 
We've checked all the ini files and .conf files under xampp, and they both work without problems on my machine. 

Anyone have any ideas where we could look next for a problem?
Reply
#2

Usally that ERROR means that the headers have already been sent to the output.

Check for blank spaces befor the opening php tags and closing php tags.
also make sure you are not sending anything to the view before calling the controller.

Most Web Browsers have developer tools you bring up by F-12 key.

use the console and network tabs to see what is happening.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Old versions are not supported. Update the framework to the latest version.
Reply
#4

(This post was last modified: 06-05-2023, 01:59 PM by sheilaf. Edit Reason: added PHP version note )

(05-31-2023, 10:31 AM)CJRhoads Wrote: Hello.
I'm not a professional programmer, but I'm trying to help my student intern so that he can help me this summer.  We are running into a very strange problem that neither of us, nor my other programming supporters, can figure out.
On my system, I'm running xampp with my codeigniter-framework website without any problems. 
We've installed the exact same xampp with the same files on my student's computer, but when he tries to run localhost, this is the error message he gets:

Code:
Deprecated: filter_var(): Passing null to parameter #3 ($options) of type array|int is deprecated in
C:\WorkingWebs\cirwep\priv\codeigniter\system\HTTP\RequestTrait.php on line 338

Fatal error: Uncaught ErrorException: Cannot modify header information - headers already sent by (output started at
C:\WorkingWebs\cirwep\public_html\app\Config\Events.php:35) in C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php:137
Stack trace: #0 [internal function]:
CodeIgniter\Debug\Exceptions->errorHandler(2, 'Cannot modify h...', 'C:\\WorkingWebs\\...', 137) #1
C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php(137): header('HTTP/1.1 500 In...', true, 500) #2 [internal function]:
CodeIgniter\Debug\Exceptions->exceptionHandler(Object(CodeIgniter\Cache\Exceptions\CacheException))
#3 {main} thrown in C:\WorkingWebs\cirwep\priv\codeigniter\system\Debug\Exceptions.php on line 137
WorkingWebs is the local folder under which the cirwep website is installed.  These are all Codeigniter files that are having issues, but we can't figure out what the problem is though we have spent many days on this issue. 
We've checked all the ini files and .conf files under xampp, and they both work without problems on my machine. 

Anyone have any ideas where we could look next for a problem?

When debugging PHP start with the first error message. Fix that and any subsequent "headers already sent" messages go away.
The first message says the particular call to filter_vars is 'deprecated' meaning it shouldn't be used. It will go away in future versions of PHP.  So you should update the version of CodeIgniter to avoid future problems. 

As for why you only see the problem on one site and not the other "identical" site, well they aren't identical. There is a configuration difference somewhere. Have your student read up on phpinfo() and generate a page with it's output. Then compare the output for the two websites. Pay attention to the section called "Core". Mostly likely the value for error_reporting will be different. This assumes both sites are running the same version of PHP.
Reply
#5

Thanks all.  We will review all of these suggestions and get back to you.  Thank you so much.
Reply
#6

Again - thanks everyone for all your help.  Turned out that the main problem was that XAMPP installed PHP8, when our system requires PHP7.  We swapped out the PHP version and (after a few more other issues) finally got the entire thing working.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB