• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How I upgraded from CI3 to CI4

I have created a few new CI4 projects, become a lot more familiar with the system and decided try an upgrade...

I have a really old project which dates back over ten years, uses CI3 and has been neglected for a very long time. The project is basically a landing page with a static page containing a menu and some blurb. The menu calls numerous blogs (different authors) and three stories, some with over a hundred pages. MysSqli is used to store the blogs and stories.

The Plan:

1. Rename both localhost and online folders from the old project.com to project-ci3.com

2. Create a new project.com
  mkdir /var/www/project.com

3. Download latest CI4 project to my http://localhost/ folder :
  git clone https://github.com/codeigniter4/CodeIgniter4.git

4. Copy the following files and folders to project.com

5. Copy following folder (required by my operating system) 
  CodeIgniter4/public  ==> project/public_html

6. Copy following files from project-ci3.com/ to project.com/
  (do not overwrite any existing files such as welcome_message.php)

7. Create quick RSYNC.txt update file with content:
  TOUCH  /var/www/project.com/RSYNC.txt
  rsync -avz /var/www/project.com/ -e ssh [email protected]:/var/www/project.com/
  synchronise localhost and online folders

8. Test http://localhost/project/public_html and get it to render "welcome_message.php".

Modifications to files:

There were a lot of redundant Controllers and Models Sad I only have a simple editor and decided to:

1. "echo __file__;die;" to all Controllers and Models
2. modify app/Config/Routes.php and test each routing one at a time.

After the "welcome_message.php" was rendered I continued until I rendered the landing page menu then preceded to call the each menu item and clear bugs wherever they appeared.

I found that it seems a lot easier to create a new project rather than update an existing project Sad

I'm curious to know any other tips or trips to update projects.

If you changed public to public_html you also need to change spark it has public inside it
change it also to public_html and it will work fine.

I also found that it is better to re-write the project than to try and convert it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

I forgot to mention that Ubuntu is the localhost operating system and it is a mirror image of the Online operating system.

I do not use Spark and think it is a Windows application.

Further to the previous instructions I have since created the following folders and copied relevant files from the CI3 Application:


Also modified ./app/Config/Routes.php 

PHP Code:
if(FALSE) :
  // We get a performance increase by specifying the default
  // route since we don't have to scan directories.
  // routes copied from CI3 version 
    $routes->get('/',                'C_page::index');
    $routes->add('/bwci4/(:any)',  'C_bwci4::index/$1');
    $routes->add('/bwci4',        'C_bwci4::index');


The new plan is now to start with a welcome_message route then try the CI3 routes.

Errors will show about missing files which need amending, etc

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.