how to check version of codeigniter framework?
Asked Answered
I

11

28

I recently setup a old Codeigniter framework on my xampp.But i don't know the version of this framework. I use the code

<?php echo CI_VERSION; ?> 

but its give me error

Notice: Use of undefined constant CI_VERSION - assumed 'CI_VERSION' in /opt/lampp/htdocs/projectname/views/v_header.php on line 57
CI_VERSION

Please guide me, I am new in Codeigniter.

Impost answered 23/12, 2016 at 6:48 Comment(2)
'<?php echo CI_VERSION; ?>' should echo out the correct version of CI. if it doesn't something might be wrong with your CI installation - specially if you comment several times that you have no system folder! I would try to re-install CI from scratch.Magdeburg
Does this answer your question? Which version of CodeIgniter am I currently using?Ebersole
E
43

See in system/core/CodeIgniter.php and there is a constant like this..

define('CI_VERSION', '3.0.6');
Effete answered 23/12, 2016 at 6:54 Comment(2)
I have no any folder with name of systemImpost
see in root directory.Effete
C
14

In the root folder:

cat system/core/CodeIgniter.php | grep CI_VERSION
Cheyenne answered 9/2, 2019 at 2:18 Comment(1)
UUOC: grep CI_VERSION system/core/CodeIgniter.phpCaa
N
11

You can check it two ways. one is to

<?php echo CI_VERSION; ?>

Another way is go to your system/core/CodeIgniter.php path and then check define('CI_VERSION', '2.1.4');

Nations answered 9/5, 2017 at 18:23 Comment(0)
P
5

Method 1:

Please access the file

System >> Core >> Codeigniter.php

 /**
  * CodeIgniter Version
  *
  * @var    string
  *
  */
  define('CI_VERSION', '3.0.0');

Method 2: In index.php or any other view file write the following code of php as follows:

 <?php
   echo CI_VERSION;
 ?>

CI_VERSION is build in constant in codeigniter, which contains value of version.

Thank you!

Pax answered 23/12, 2016 at 7:21 Comment(0)
H
4

check the file system/core/CodeIgniter.php

Hereunder answered 23/12, 2016 at 6:53 Comment(2)
I have no any folder with name of systemImpost
There are 3 folders in your root folder. They are 'application','system' and 'user guides'.Hereunder
I
3

Try This:<?php echo CI_VERSION; ?> // echoes something like 3.1.6

Introductory answered 4/11, 2017 at 17:7 Comment(0)
M
2

Which means you are not properly configure your codeigniter project / system folder. System folder is not necessary to be placed in project root. you can place anywhere and configure the correct system path[something like $system_path = '../system';] in the index.php(project root) properly. It should work...

Marcellus answered 23/12, 2016 at 7:58 Comment(0)
C
2

If you are running CodeIgniter 4, the CodeIgniter 3 style

<?php echo CI_VERSION; ?>

would not work out and you would get the error - Use of undefined constant CI_VERSION

As @user1283182 has pointed out, the exact version can be found in system/CodeIgniter.php (see const CI_VERSION)

or enter the below code in one of your views

<?= CodeIgniter\CodeIgniter::CI_VERSION ?>
Cottier answered 9/3, 2022 at 4:2 Comment(0)
E
1

For CodeIgniter 4, the CI_VERSION is defined in system\CodeIgniter.php

Ermina answered 26/7, 2020 at 23:25 Comment(0)
P
1

Just use this simple code to check for Codeigniter version

<?= CodeIgniter\CodeIgniter::CI_VERSION ?>
Pelligrini answered 19/12, 2021 at 3:43 Comment(0)
P
0

For CodeIgniter 4

You can also try following path to find CodeIgniter version.

D:\xampp\htdocs\PROJECT_NAME\vendor\codeigniter4\framework\system\CodeIgniter.php

In CodeIgniter.php file, find the following line;

public const CI_VERSION = '4.3.3';

Polytypic answered 18/4, 2023 at 11:30 Comment(1)
Hi, please note, your answer is specific to Windows systemsNahshon

© 2022 - 2024 — McMap. All rights reserved.