Welcome Guest, Not a member yet? Register   Sign In
migrating to CI4
#1

I am looking seriously at migrating from CI 3.x to CI 4.x. However, I have a complex website with several thousand of lines of code and dozens of libraries, controllers and models. The thought of rewriting is daunting and if necessary to spend months on a conversion, begs the question why stick with CI?

 Is it as simple as changing how controllers, libraries and models are defined to fit into the new concept plus messing around with a few config files?

 My long term concern is staying current with PHP into the future and I have no idea how compatible CI 3.x and 4 are with PHP8. I suspect this is not an issue but it is always worrisome.

 Another question is: does CI4 have more robust security features?
Reply
#2

I count 4 paragraphs in your post;mind you my English was never that great , not being my first language. My first language was Geordie, so i had to translate words like "ben" to child and so on ...

i will leave 1) to admin/ lead and perhaps yourself to keep an eye on signs of activity; that movement is steady and progressive.

2) I have used codeigniter in the past but can't remember if it was 2 or 3. I think there are some sea change from 3 to 4. As i understand it from Lonnie new book https://leanpub.com/codeigniter4foundations James Parry did a complete re-write .

I just started shifting from loading views in the approach of:
Code:
head
main content
footer

to just echo view('someview');
//you create a layout and each view you use extends it. I think you have some work to do; having said that if you install using composer then in theory that should take a lot of heavy lifting away , with future releases by just using composer to update.

forms now can use csrf using helper ; there is use of "esc" and so on. I really like CI4 ,at least i can half understand it ! So i hope that it will prevail
Reply
#3

I am going to believe you and see what I can do. I can give Composer another shot, but I am not a fan. I always keep the code and CI outside the public html folder and simply put the index file in there. For me. this is a security strategy.

I have been using CI since version 2. So I am pretty dedicated to it. Transitions have always had a few issues, but they were always easy to overcome. This conversion is testing my patience, but I do not see any alternatives. CI2 and CI3 were similar to my coding style and thinking and generally easy to accomplish all I needed. Though I do bypass it from time to time where my hand crafted solutions just work better. So far, I find CI4 is hard to understand both in terms of code and documentation. But, it is somewhat better than the documentation for other alternatives.
Reply
#4

(This post was last modified: 11-09-2020, 04:23 PM by John_Betong.)

@clancey,

I prefer using git clone repository instead of Composer, only takes seconds to download. System file then copied to my project and RSYNC the complete project to server also takes seconds.

CI4 is very different to versions two and three, best to rewrite your project. Start with the landing page, thoroughly debug, try alternatives, optimise and only move on when satisfied.

CI4 and using many small classes instead of a single god class along with using an auto loader and namespaces was a huge jump but well worth the effort.
Reply
#5

You will also need to re-write all your validation it is totally different in CI 4.

Like @John_Betong said I also believe that a complete re-rite is merited here.

Too many major changes in CI 4 but well worth it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

Rewriting the site will take months. The gains need to be substantial, not incremental. If it was as simple as changing how all the controllers, libraries and models were initiated to conform it would not be daunting.
Reply
#7

I tried a vanilla install of codeigniter by downloading on my laptop and installing via sftp. But got a strange error. It tried to access pear. That concerns me because codeigniter should never need access to pear or need privileges beyond those that I have given to my user account.
Reply
#8

@clancy,

Please be more specific about how you downloaded CI4 also the laptop and remote server operating systems.

What was the actual Pear error.
Reply
#9

(This post was last modified: 11-14-2020, 09:48 AM by clancey.)

I downloaded directly from Codeigniter to my laptop and copied it over to my website using sftp and unpacked outside the website. The error was:

Failed opening required '' (include_path='.:/opt/php_interim_dir/ea-php74/root/usr/share/pear') in /home/user/public_html/index.php on line 32

The server is CentOS
Reply
#10

It's not trying to access pear. It's trying to include an empty filename: 
Code:
Failed opening required ''

Then it's telling you what your include_path is, and it happens to include the pear directory, it has nothing to do with CI:
Code:
(include_path='.:/opt/php_interim_dir/ea-php74/root/usr/share/pear')

...and this error comes from line 32 in index.php:
Code:
in /home/user/public_html/index.php on line 32

What is at line 32? In CI 4.04 we have this:
PHP Code:
require $pathsPath

...which is defined at line 16:
PHP Code:
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath realpath(FCPATH '../app/Config/Paths.php');
// ^^^ Change this if you move your application folder 

Did you change this line? You have something misconfigured and that's why you have this error.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB