{"id":209,"date":"2024-06-30T16:57:21","date_gmt":"2024-06-30T14:57:21","guid":{"rendered":"https:\/\/blog.nickywin.com\/?p=209"},"modified":"2024-07-02T13:35:00","modified_gmt":"2024-07-02T11:35:00","slug":"setting-up-lamp-apache-mysql-php-on-fedora-40","status":"publish","type":"post","link":"https:\/\/blog.nickywin.com\/setting-up-lamp-apache-mysql-php-on-fedora-40\/","title":{"rendered":"Setting Up LAMP (Apache, mysql, PHP) on Fedora 40"},"content":{"rendered":"<figure class=\"wp-block-post-featured-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/blog.nickywin.com\/wp-content\/uploads\/2024\/06\/fedora.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"270\" data-original=\"https:\/\/blog.nickywin.com\/wp-content\/uploads\/2024\/06\/fedora.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" class=\"attachment-post-thumbnail size-post-thumbnail no-lazy wp-post-image\" alt=\"\" style=\"object-fit:cover;\"  sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/div><\/figure>\n\n\n<h2 class=\"wp-block-heading\">Step 1: Updating Fedora System Packages<\/h2>\n\n\n\n<p>Once\u00a0<strong>Fedora workstation<\/strong>\u00a0is installed( on server , php can&#8217;t work, I don&#8217;t understand), the first step is to update the system packages to ensure you have the latest security patches and software updates.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf update\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55893\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Update-Fedora-System.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Update-Fedora-System.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Update Fedora System\" class=\"wp-image-55893\"\/><\/div><figcaption class=\"wp-element-caption\">Update Fedora System<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Apache on Fedora<\/h2>\n\n\n\n<p><strong>Apache<\/strong>&nbsp;is a popular and most reliable web server on the Linux platform powering multiple websites and web-based applications on the web. It comes with several modules to enhance its functionality under different categories including security modules, server access modules plus so much more.<\/p>\n\n\n\n<p>To install&nbsp;<strong>Apache<\/strong>, issue the command below on your terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install httpd\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55894\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-Apache-in-Fedora.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-Apache-in-Fedora.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Install Apache in Fedora\" class=\"wp-image-55894\"\/><\/div><figcaption class=\"wp-element-caption\">Install Apache in Fedora<\/figcaption><\/figure>\n\n\n\n<p>After installation is complete, you need to perform a few tasks to get your&nbsp;<strong>Apache<\/strong>&nbsp;web server running.<\/p>\n\n\n\n<p>First, you need to set it to start automatically at boot time:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable httpd.service\n<\/code><\/pre>\n\n\n\n<p>Then start the service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start httpd.service\n<\/code><\/pre>\n\n\n\n<p>Next, to be sure that the service is running, you can issue the command below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status httpd.service\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55895\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Check-Apache-in-Fedora.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Check-Apache-in-Fedora.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Check Apache Status\" class=\"wp-image-55895\"\/><\/div><figcaption class=\"wp-element-caption\">Check Apache Status<\/figcaption><\/figure>\n\n\n\n<p>To access your web server over&nbsp;<strong>HTTP\/HTTPS<\/strong>, you need to enable access to it through the system firewall.<\/p>\n\n\n\n<p>To do that, run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --permanent --add-service=http\nsudo firewall-cmd --permanent --add-service=https\n<\/code><\/pre>\n\n\n\n<p>Then reload the system firewall configurations as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload firewalld\n<\/code><\/pre>\n\n\n\n<p>One last thing to do under&nbsp;<strong>Apache<\/strong>&nbsp;installation is to check whether the default Apache installation index page can load in your web browser, therefore open your web browser and enter your server IP address as shown:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;server-ip-address\n<\/code><\/pre>\n\n\n\n<p>If you don\u2019t know your server IP address, you can find using the below&nbsp;<a href=\"https:\/\/www.tecmint.com\/ip-command-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">ip command<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ip a | grep \"inet\" \n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55896\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Check-Fedora-Server-IP.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Check-Fedora-Server-IP.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Check Fedora Server IP\" class=\"wp-image-55896\"\/><\/div><figcaption class=\"wp-element-caption\">Check the Fedora Server IP<\/figcaption><\/figure>\n\n\n\n<p>You should be able to view this page below:<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55897\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Fedora-Apache-Webpage.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Fedora-Apache-Webpage.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Fedora Apache Webpage\" class=\"wp-image-55897\"\/><\/div><figcaption class=\"wp-element-caption\">Fedora Apache Webpage<\/figcaption><\/figure>\n\n\n\n<p><strong>Note<\/strong>: The Apache default root directory is\u00a0<code>\/var\/www\/html<\/code>, and this is where you can drop your web files.<\/p>\n\n\n\n<p>Step 3: Install mysql on Fedora<\/p>\n\n\n\n<p>view <a href=\"https:\/\/blog.nickywin.com\/?p=174\">https:\/\/blog.nickywin.com\/?p=174<\/a> cause of I don&#8217;t like mariaDB.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Install PHP on Fedora<\/h2>\n\n\n\n<p><strong>PHP<\/strong>&nbsp;is a serve-side scripting language that handles and sends user requests to the web and database server.<\/p>\n\n\n\n<p>To install&nbsp;<strong>PHP<\/strong>&nbsp;on Fedora, use the command below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php php-common \n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55902\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-PHP-in-Fedora.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-PHP-in-Fedora.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Install PHP in Fedora\" class=\"wp-image-55902\"\/><\/div><figcaption class=\"wp-element-caption\">Install PHP in Fedora<\/figcaption><\/figure>\n\n\n\n<p>In order for PHP to work well with mysql databases, you need to install some PHP modules therefore, execute the command below to install the required PHP modules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install php-mysqlnd php-gd php-cli php-mbstring\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55903\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-PHP-Extensions-in-Fedora.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Install-PHP-Extensions-in-Fedora.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Install PHP Extensions in Fedora\" class=\"wp-image-55903\"\/><\/div><figcaption class=\"wp-element-caption\">Install PHP Extensions in Fedora<\/figcaption><\/figure>\n\n\n\n<p>When the installation process is complete, you need to restart the&nbsp;<strong>Apache<\/strong>&nbsp;web server, this will allow all the changes to take effect before you can have a complete working&nbsp;<strong>LAMP<\/strong>&nbsp;stack.<\/p>\n\n\n\n<p>To restart&nbsp;<strong>Apache<\/strong>, issue the command below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart httpd \n<\/code><\/pre>\n\n\n\n<p>Now you can test it all, using your favorite editor, create a called file&nbsp;<code>info.php<\/code>&nbsp;in your Apache root directory as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/var\/www\/html\/info.php\n<\/code><\/pre>\n\n\n\n<p>Add the following lines in the file, save it, and exit.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nphpinfo()\n?&gt;\n<\/code><\/pre>\n\n\n\n<p>Then open your web browser and enter the following URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;server-ip-address\/info.php\n<\/code><\/pre>\n\n\n\n<p>In case everything is set, then you should be able to view this PHP information below:<\/p>\n\n\n\n<figure class=\"wp-block-image\" id=\"attachment_55904\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Verify-PHP-in-Fedora.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/06\/Verify-PHP-in-Fedora.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Verify PHP in Fedora\" class=\"wp-image-55904\"\/><\/div><figcaption class=\"wp-element-caption\">Verify PHP in Fedora<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Updating Fedora System Packages Once\u00a0Fedora wor [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":210,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,7],"tags":[],"class_list":["post-209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-my-code-diary","category-linux-tinkering"],"_links":{"self":[{"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":1,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/posts\/209\/revisions\/211"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/media\/210"}],"wp:attachment":[{"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nickywin.com\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}