<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CodeIgniter Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/codeigniter/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Wed, 24 May 2023 13:00:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>CodeIgniter Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/codeigniter/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install CodeIgniter on Ubuntu 22.04</title>
		<link>https://www.linuxtuto.com/how-to-install-codeigniter-on-ubuntu-22-04/</link>
					<comments>https://www.linuxtuto.com/how-to-install-codeigniter-on-ubuntu-22-04/#respond</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Wed, 24 May 2023 13:00:02 +0000</pubDate>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=1345</guid>

					<description><![CDATA[<p>CodeIgniter is a fast, lightweight, and open-source PHP framework used for developing web applications. It follows the model-view-controller (MVC) architectural pattern, which separates the application...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-codeigniter-on-ubuntu-22-04/">How to Install CodeIgniter on Ubuntu 22.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>CodeIgniter is a fast, lightweight, and open-source PHP framework used for developing web applications. It follows the model-view-controller (MVC) architectural pattern, which separates the application logic into three interconnected components: the model, the view, and the controller.</p>
<p>In this tutorial, we will show you how to install CodeIgniter on Ubuntu 22.04 OS.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 1: Update Operating System</span></h2>
<p>Update your <strong>Ubuntu</strong> <strong>22.04</strong> operating system to the latest version with the following command:</p>
<pre><code># apt update &amp;&amp; sudo apt upgrade -y</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 2: Install Apache webserver</span></h2>
<p>You can install it via <code>apt</code> package manager by executing the following command.</p>
<pre><code># apt install apache2</code></pre>
<p>You can start the Apache service and configure it to run on startup by entering the following commands:</p>
<pre><code># systemctl start apache2
# systemctl enable apache2</code></pre>
<p>Verify the status of the <code>Apache</code> service using <code>systemctl status</code> command:</p>
<pre><code># systemctl status apache2</code></pre>
<p>Output:</p>
<pre><code><span style="color: #00ff00;">●</span> apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: <span style="color: #00ff00;">active (running)</span>
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 81008 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 81012 (apache2)
      Tasks: 7 (limit: 2193)
     Memory: 26.4M
        CPU: 671ms
     CGroup: /system.slice/apache2.service
             ├─81012 /usr/sbin/apache2 -k start
             ├─81013 /usr/sbin/apache2 -k start
             ├─81014 /usr/sbin/apache2 -k start
</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 3: </span><span class="has-inline-color has-vivid-purple-color">Install PHP and PHP extensions for CodeIgniter</span></h2>
<p>To install PHP and additional PHP modules to support CodeIgniter, run the following command:</p>
<pre><code># apt-get install php php-cli php-common libapache2-mod-php php-curl php-zip php-gd php-mysql php-xml php-imagick php-json php-intl</code></pre>
<p>Verify if PHP is installed.</p>
<pre><code>php -v</code></pre>
<pre><code><strong>Output:</strong>
PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2-1ubuntu2.11, Copyright (c), by Zend Technologies</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 4: Install MariaDB and create a database</span></h2>
<p>To install MariaDB run the following command:</p>
<pre><code># apt install mariadb-server mariadb-client</code></pre>
<p>Verify the status of the <code>MariaDB</code> service using <code>systemctl status</code> command:</p>
<pre><code># systemctl status mariadb</code></pre>
<p>Output:</p>
<pre><code><span style="color: #00ff00;">●</span> mariadb.service - MariaDB 10.6.12 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: <span style="color: #00ff00;">active (running)</span>
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 979 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 7 (limit: 2193)
     Memory: 72.6M
        CPU: 6.374s
     CGroup: /system.slice/mariadb.service
             └─979 /usr/sbin/mariadbd
</code></pre>
<p>By default, MariaDB is not hardened. You can secure MariaDB using the <code>mysql_secure_installation</code> script.</p>
<pre><code># mysql_secure_installation</code></pre>
<p>Configure it like this:</p>
<pre><code>- Set root password? [Y/n] <strong>Y</strong>
- Remove anonymous users? [Y/n] <strong>Y</strong>
- Disallow root login remotely? [Y/n] <strong>Y</strong>
- Remove test database and access to it? [Y/n] <strong>Y</strong>
- Reload privilege tables now? [Y/n] <strong>Y</strong></code></pre>
<p>Now run the command below to log in to the MariaDB shell.</p>
<pre><code># mysql -u root -p</code></pre>
<p>Once you are logged in to your database server you need to create a database for the CodeIgniter installation:</p>
<pre><code>MariaDB [(none)]&gt; CREATE DATABASE <span class="pln">codeigniter</span>;
MariaDB [(none)]&gt; CREATE USER '<span class="pln">codeigniter</span>'@'localhost' IDENTIFIED BY 'Str0ngP@ssf1';
MariaDB [(none)]&gt; GRANT ALL PRIVILEGES ON <span class="pln">codeigniter</span>. * TO '<span class="pln">codeigniter</span>'@'localhost';
MariaDB [(none)]&gt; FLUSH PRIVILEGES;
MariaDB [(none)]&gt; exit;</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 5: Download CodeIgniter</span></h2>
<p>The latest version of CodeIgniter is available to <a href="https://github.com/codeigniter4/CodeIgniter4/releases">download from GitHub</a>. As of writing this tutorial, the latest version available is 4.3.5.</p>
<p>Run the following command to download it from the GitHub page to your Ubuntu system:</p>
<pre><code># wget https://github.com/codeigniter4/CodeIgniter4/archive/refs/tags/v4.3.5.zip</code></pre>
<p>After the download is complete, extract the file into the folder <strong>/var/www/</strong> with the following command:</p>
<pre><code># unzip v4.3.5.zip -d /var/www </code></pre>
<p>Rename the extracted directory:</p>
<pre><code># cd /var/www/ &amp;&amp; mv CodeIgniter4-*/ CodeIgniter</code></pre>
<p>Then enable permission for the Apache webserver user to access the files:</p>
<pre><code># chown -R www-data:www-data /var/www/<span class="pln">CodeIgniter</span>/</code></pre>
<p>Next, you need to edit the database configuration:</p>
<pre><code># cp CodeIgniter/env CodeIgniter/.env 
# nano CodeIgniter/.env</code></pre>
<p>Set environment:</p>
<pre><code>#-------------------------------------------------------------------- 
# ENVIRONMENT 
#-------------------------------------------------------------------- 
CI_ENVIRONMENT = development</code></pre>
<p>Configure CodeIgniter base URL for accessing via your web browser:</p>
<pre><code>#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

app.baseURL = 'http://your-domain.com'
</code></pre>
<p>Set database connection:</p>
<pre><code>#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

database.default.hostname = localhost
database.default.database = codeigniter
database.default.username = codeigniter
database.default.password = Str0ngP@ssf1
database.default.DBDriver = MySQLi</code></pre>
<p>Save and close the file.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Step 6: Configure Apache for <span class="pln">CodeIgniter</span></span></h2>
<p>Run the commands below to create a new VirtualHost file called codeigniter in the <strong>/etc/apache2/sites-available/</strong> directory.</p>
<pre><code># nano /etc/apache2/sites-available/<span class="pln">codeigniter</span>.conf</code></pre>
<p>Paste the content as shown below:</p>
<pre><code> &lt;VirtualHost *:80&gt;
    ServerAdmin admin@your-domain.com
    DocumentRoot /var/www/<span class="pln">CodeIgniter/public</span>/
    
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    &lt;Directory /var/www/<span class="pln">CodeIgniter/public</span>/&gt; 
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt; 

    ErrorLog /var/log/apache2/your-domain.com-error_log
    CustomLog /var/log/apache2/your-domain.com-access_log common

 &lt;/VirtualHost&gt;</code></pre>
<p>Remember to replace <strong><code>your-domain.com</code></strong> with the domain name of your server.</p>
<p>Save and exit the configuration file.</p>
<p>To enable this site run the command:</p>
<pre><code># a2ensite <span class="pln">codeigniter</span>.conf</code></pre>
<p>To implement the changes, restart Apache webserver:</p>
<pre><code># systemctl restart apache2</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Step 7: Access CodeIgniter</span></h2>
<p>Open your web browser and type the URL <strong><code>http://your-domain.com/</code></strong>. You should see the following page:</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-large wp-image-1359" src="https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-900x512.jpg" alt="CodeIgniter 4" width="900" height="512" srcset="https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-900x512.jpg 900w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-300x171.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-768x436.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-1536x873.jpg 1536w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-1222x695.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-897x510.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4-684x389.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2023/05/CodeIgniter4.jpg 1895w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>Congratulations! You have successfully installed CodeIgniter on Ubuntu 22.04 OS.</p>
<p>You can start your development with <code>CodeIgniter</code>. For additional help or useful information, we recommend you refer to the <a href="https://www.codeigniter.com/user_guide/" target="_blank" rel="noreferrer noopener">User guide</a>.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-codeigniter-on-ubuntu-22-04/">How to Install CodeIgniter on Ubuntu 22.04</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-codeigniter-on-ubuntu-22-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1345</post-id>	</item>
	</channel>
</rss>
