23

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.

tereško
  • 58,060
  • 25
  • 98
  • 150
bansal kapil
  • 445
  • 1
  • 3
  • 13
  • '' 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. – Vickel Dec 23 '16 at 17:16
  • Does this answer your question? [Which version of CodeIgniter am I currently using?](https://stackoverflow.com/questions/2196799/which-version-of-codeigniter-am-i-currently-using) – adampweb Nov 14 '20 at 14:13

11 Answers11

40

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

define('CI_VERSION', '3.0.6');
Hikmat Sijapati
  • 6,869
  • 1
  • 9
  • 19
12

In the root folder:

cat system/core/CodeIgniter.php | grep CI_VERSION
pableiros
  • 14,932
  • 12
  • 99
  • 105
paulc
  • 455
  • 4
  • 10
9

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');

RASEL RANA
  • 2,112
  • 1
  • 15
  • 17
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!

Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75
4

check the file system/core/CodeIgniter.php

Linu S
  • 79
  • 10
3

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

Rafiqul Islam
  • 931
  • 11
  • 14
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...

Naga
  • 2,190
  • 3
  • 16
  • 21
1

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

user1283182
  • 131
  • 3
0

Just use this simple code to check for Codeigniter version

<?= CodeIgniter\CodeIgniter::CI_VERSION ?>
Yunat Amos
  • 93
  • 4
0

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 ?>
Kiran Sone
  • 45
  • 1
  • 10
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';