![translation](https://cdn.durumis.com/common/trans.png)
This is an AI translated post.
[php] Setting up Codeigniter 4 on Ubuntu
- Writing language: Korean
- •
-
Base country: All countries
- •
- Information Technology
Select Language
Summarized by durumis AI
- I recorded the process of resolving problems encountered while installing Codeigniter 4 on a development server.
- After installing Apache2 and PHP 7, I downloaded the Codeigniter 4 framework files and uploaded the project files to Apache2.
- By setting permissions for the project files, installing essential PHP extensions, and modifying the php.ini file, I resolved errors and successfully displayed the initial Codeigniter 4 screen.
Codeigniter 4.
I had the opportunity to work on a new project at the company. Since the existing web page was using Codeigniter 3 after joining, I decided to use Codeigniter 4 out of curiosity and anticipation.
The first thing to do is to set up the development server. This document was created to record the (?) that I experienced while setting up Codeigniger 4 on the development server.
The operating system of the development server was tested on Ubuntu 20.04.2 version
Apache2 and php version 7 were pre-installed, so I downloaded the Codeigniter 4 (CI4) framework file. It seems that PHP version 7.3 or higher is required by default.
Access the above URL and click CI4 Download to download the framework file. It seems that PHP version 7.3 or higher is required by default.
You can see the files above after unzipping. The CI version I used for the test is 4.1.3.
Now upload the downloaded project file to Apache2.
I changed the project name to ci4 for testing. After uploading, access localhost(or address)/public/index.php to check if it works properly.
I see the error screen as soon as I connect.
In fact, this was the beginning of the digging. In my case, it was an error that seemed to be caused by the lack of folder permissions and PHP extensions installed. First, change the permissions of the /writable folder within the project file.
sudo chmod -R 777 writable
Second, you need to install essential php extensions. The essential extensions are curl, intl, mbstring, and xml. It may be installed on the server you are running, but I am setting up the server for the first time, so I install it one by one.
sudo apt-get install php-curl
sudo apt-get install php-intl
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Run the above commands one by one to install the necessary extensions.
Finally, you need to uncomment the crul and intl extensions in the php.ini file.
sudo nano /etc/php/7.4/apache2/php.ini
The location of the php.ini file may vary depending on the server environment. Run the above command to access the php.ini file in edit mode.
;extension=bz2
extension=curl
;extension=ffi
;extension=ftp
;extension=fileinfo
;extension=gd2
;extension=gettext
;extension=gmp
extension=intl
;extension=imap
;extension=ldap
;extension=mbstring
;extension=exif ; Must be after mbstring as it depends on it
;extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
;extension=pdo_mysql
As you scroll down the php.ini file, you will see the above part. Remove the ; in front of curl and intl, save it by pressing Cntl + x, and exit.
Change all the settings and restart apache.
sudo service apache2 restart
If you access the above url again, you can see the initial CI4 screen output normally.
It's nothing special when I organize it, but it took a lot of time through Google search and (?) while setting up the development server for the first time.
I've been working on SM-oriented servers, so I haven't had the opportunity to set up a development server directly. It was a good experience to learn, even though it was difficult.