Codeigniter Compatibility with PHP Version

Does codeigniter 3 support PHP 7?

Yes. The latest v3.0.4 changelog explicitly has changes to use PHP7 functionality where it can e.g.

Updated Security Library method get_random_bytes() to use PHP 7’s
random_bytes() function when possible.

Update August 2018
There's also items in the change log for 3.1.8 which relate to fixes for PHP 7.2, as well as 3.1.7 which specifically mention fixes for PHP 7

CodeIgniter problems after upgrading to PHP 7.3

I've never used CodeIgniter but a quick look at the documentation seems to suggest that, inexplicably, they don't use namespaces. This is pretty unheard of for a modern codebase, and you're learning why.

PHP 7.0 introduced the Error class as the base class for all internal PHP errors. Since your code is not namespaced, you're trying to overwrite this built-in class. If you looked at your error log you'd see something like this:

PHP Fatal error:  Cannot declare class Error, because the name is already in use in...

Rename your Error class to something that isn't a reserved name and it should get you past this problem.

Updating php version project from 5.2.1 to 7

Should not be needed since php is (mostly) backwards compatible. I would however recommend to do it anyway.

how to run lower PHP version code (codeigniter) into higher php version

The problem you are facing is that there are certain functions that have simply been removed in the newer version of PHP. If you really need to use a newer PHP version, your only option is to get a migration guide and to rewrite the functions that have become deprecated or have been removed.

You could do that like this:

if (!function_exists('removed_function')) {
function removed_function($params)
{
// ...
}
}

In a guide like the below link specifies, you can find what has changed and what functions you'll need to rewrite.

PHP Migration guide

running a codeigniter application on localhost/xampp

Codeigniter 2.2.0 needs below Server Requirements

  1. PHP version 5.1.6 or newer.

  2. A Database is required for most web application programming. Current supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite, and ODBC.



Related Topics



Leave a reply



Submit