upgrading an CI application from 2.0.x to 3.0.x
This is second CI application that I found on internet. Actually I baught this script online.the Application was actually built in CI2 but ever since I upgraded my OS from Ubuntu 14.04 to 16.04 the application did not install and I thought of upgrading the CodeIgniter version of the application. In order to upgrade it I followed the instruction given on /user_guide/installation/upgrade_300.html which initially asked me to capitalize the first letter of classes, models etc. secondly replace config/mimes.php and other instruction on the guide.
once the changes as suggested in guide were done I tried to run application, but it was an failure. I had to browse the apache error log to find out the source of error and do some minor fixing. Now I was able to get some response on my browser. (Earlier the browser was completely blank) the the first problem that I had to address was related to PHPactiveRecord. The actual error was as follows
“Unable to load the requested class: PHPActiveRecord”
I tried to fix the issue by directly searching the blogs but could not figure out much as most of the blogs that I found was addressing this issues in CI2 where as I was using CI3 now. So I decided to understand the working of PHPActiveRecord. Initially I need to find out from where this library is being called. it was autoload.php under config folder that was loading this class I observed that it was version 0.0.2 of PHPActiveRecord that is being used and after little browsing I found that latest version of PHPActiveRecord (as available on www.phpactiverecord.php) was 0.0.3 instantly I downloaded the latest version and replaced the earlier one. I also have to update the path in autoload.php (as there was bit difference in the path settings of version 0.0.2
(may be it was done by original writer of the script). On rerunning the script now the error was changed. and the new error was “Unable to locate the model you have specified: Ion_auth_model”
and it was my mistake as I forgot to capitalize the first letter of the model in models folder.
The next Error
“An uncaught Exception was encountered
Type: Error
Message: Call to undefined function mysql_pconnect()
Filename: path-to-projectsystemdatabasedriversmysqlmysql_driver.php
Line Number: 135“
I know I need not to to do any changes to mysql_driver.php and the error was due to the fact that I was trying to connect to database using mysql which is not supported by the latest version of php. I was required to update the default dbdriver in database.php to set default drivers to mysqli by changing the line in database.php to
$db['default']['dbdriver'] = 'mysqli';
Now the application was working fine and the script installer asked me to make the file database.php writable by giving 777 permission, doing which successfully installed the script.