<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Artisan</title>
    <description>The latest articles on DEV Community by Artisan (@artisansg).</description>
    <link>https://dev.to/artisansg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4220122%2F376abb50-b124-4f4d-a53d-0b5e575ef2a3.jpg</url>
      <title>DEV Community: Artisan</title>
      <link>https://dev.to/artisansg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/artisansg"/>
    <language>en</language>
    <item>
      <title>HAProxy 503 “No Server Available”: A Practical Debugging Checklist</title>
      <dc:creator>Artisan</dc:creator>
      <pubDate>Thu, 05 Nov 2026 08:13:30 +0000</pubDate>
      <link>https://dev.to/artisansg/haproxy-503-no-server-available-a-practical-debugging-checklist-26ee</link>
      <guid>https://dev.to/artisansg/haproxy-503-no-server-available-a-practical-debugging-checklist-26ee</guid>
      <description>&lt;p&gt;A &lt;strong&gt;503 Service Unavailable from HAProxy&lt;/strong&gt; usually means HAProxy &lt;strong&gt;couldn’t find any usable backend server&lt;/strong&gt; to send the request to. The right fix depends on &lt;em&gt;why&lt;/em&gt; HAProxy considers the backend pool unavailable—common reasons include failed health checks, connection refusals/timeouts, queue overload, routing/ACL gaps, or servers being put into &lt;strong&gt;MAINT/DRAIN&lt;/strong&gt; mode. This article lays out a practical troubleshooting workflow: &lt;strong&gt;start with the logs&lt;/strong&gt;, confirm backend state via the &lt;strong&gt;stats socket&lt;/strong&gt;, then resolve the specific failure pattern. &lt;/p&gt;

&lt;h2&gt;
  
  
  What a HAProxy 503 typically looks like
&lt;/h2&gt;

&lt;p&gt;From the client side, the error is usually a plain message like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;503 Service Unavailable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;No server is available to handle this request.&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the HAProxy side, the key clue is in the &lt;strong&gt;HAProxy log entry&lt;/strong&gt; (commonly &lt;code&gt;/var/log/haproxy.log&lt;/code&gt; on Ubuntu/Debian setups). The article emphasizes that the fastest path to the root cause is reading the &lt;strong&gt;termination state code&lt;/strong&gt; recorded in that log line. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Use the logs to identify the failure mode
&lt;/h2&gt;

&lt;p&gt;The guide recommends filtering recent HAProxy logs for 503s, then focusing on the &lt;strong&gt;two-character termination state field&lt;/strong&gt; inside each log line. It highlights several codes that are especially relevant when debugging 503s:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;SC&lt;/code&gt;&lt;/strong&gt;: backend (or something in between) &lt;strong&gt;refused/reset the TCP connection&lt;/strong&gt; (RST/ICMP).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sC&lt;/code&gt;&lt;/strong&gt;: &lt;strong&gt;connect timeout&lt;/strong&gt; expired before the connection completed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sQ&lt;/code&gt;&lt;/strong&gt;: request sat in the &lt;strong&gt;queue too long&lt;/strong&gt; (exceeded &lt;code&gt;timeout queue&lt;/code&gt;) and got dropped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;SD&lt;/code&gt;&lt;/strong&gt;: backend detected as down; HAProxy terminated the connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--&lt;/code&gt;&lt;/strong&gt;: “normal termination,” suggesting the issue may be elsewhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another important signal is the backend/server field showing &lt;strong&gt;&lt;code&gt;&amp;lt;NOSRV&amp;gt;&lt;/code&gt;&lt;/strong&gt;, meaning HAProxy &lt;strong&gt;never selected a server&lt;/strong&gt;—often a routing (ACL/default_backend) problem rather than a backend health problem. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Confirm real-time backend status with the stats socket
&lt;/h2&gt;

&lt;p&gt;Instead of guessing, the article suggests using HAProxy’s &lt;strong&gt;runtime API via the stats/admin socket&lt;/strong&gt; to instantly check backend and server states (without reloading configuration). This lets you verify whether servers are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;UP&lt;/code&gt;&lt;/strong&gt; (healthy/eligible),&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;DOWN&lt;/code&gt;&lt;/strong&gt; (not receiving traffic), or&lt;/li&gt;
&lt;li&gt;in admin-excluded modes like &lt;strong&gt;&lt;code&gt;MAINT&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;DRAIN&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also notes that socket paths can differ by system, so you should confirm the configured location via the &lt;code&gt;stats socket&lt;/code&gt; directive in &lt;code&gt;haproxy.cfg&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  The most common root causes (and how to fix them)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) All backend servers are down (most common)
&lt;/h3&gt;

&lt;p&gt;If HAProxy has &lt;strong&gt;no viable destination&lt;/strong&gt;, it returns 503 immediately. The article points out this can happen after a bad deploy, a network partition between HAProxy and the backend tier, or an upstream dependency failure causing all app servers to fail around the same time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Typical approach:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;verify backend processes are running (e.g., systemd service status),&lt;/li&gt;
&lt;li&gt;test connectivity from the HAProxy host to backend health endpoints (e.g., &lt;code&gt;curl&lt;/code&gt; to &lt;code&gt;/health&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;restart/repair the backend, then watch HAProxy logs for recovery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It notes that HAProxy generally marks servers back &lt;strong&gt;UP&lt;/strong&gt; after they pass a configured number of successful checks (controlled by &lt;code&gt;rise&lt;/code&gt;). &lt;/p&gt;

&lt;h3&gt;
  
  
  2) Health check misconfiguration
&lt;/h3&gt;

&lt;p&gt;A server can be “healthy” in reality but still be marked &lt;strong&gt;DOWN&lt;/strong&gt; by HAProxy if the &lt;em&gt;health check is wrong&lt;/em&gt;—for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;checking the wrong port,&lt;/li&gt;
&lt;li&gt;using HTTP checks against a TCP-only service,&lt;/li&gt;
&lt;li&gt;expecting a status code that the service never returns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The article shows an example of an HTTP health check setup (&lt;code&gt;option httpchk&lt;/code&gt;, &lt;code&gt;http-check expect status 200&lt;/code&gt;) and explains key parameters like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;check&lt;/code&gt; (enable checks),&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;inter&lt;/code&gt; (interval),&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fall&lt;/code&gt; (failures before marking down),&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rise&lt;/code&gt; (successes before marking up).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also recommends enabling health-check logging (&lt;code&gt;option log-health-checks&lt;/code&gt;) and validating config before reload (&lt;code&gt;haproxy -c -f ...&lt;/code&gt;). &lt;/p&gt;

&lt;h3&gt;
  
  
  3) Connection refused or connect timeout (&lt;code&gt;SC&lt;/code&gt; / &lt;code&gt;sC&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;SC&lt;/code&gt;&lt;/strong&gt; suggests the backend isn’t listening on the expected port (or something is actively rejecting connections).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sC&lt;/code&gt;&lt;/strong&gt; indicates HAProxy couldn’t complete the connection before &lt;code&gt;timeout connect&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The article suggests verifying listening ports on the backend (e.g., with &lt;code&gt;ss&lt;/code&gt;) and adjusting HAProxy timeouts (notably &lt;code&gt;timeout connect&lt;/code&gt;) if the environment requires more time (slow or remote backends). &lt;/p&gt;

&lt;h3&gt;
  
  
  4) Queue saturation (&lt;code&gt;sQ&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;If backends hit their concurrency limits (&lt;code&gt;maxconn&lt;/code&gt;) and HAProxy is forced to queue requests, a too-short &lt;code&gt;timeout queue&lt;/code&gt; can lead to &lt;strong&gt;503s with &lt;code&gt;sQ&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The guide recommends using stats socket output (including queue-related counters like &lt;code&gt;qcur&lt;/code&gt;/&lt;code&gt;qmax&lt;/code&gt;) to confirm queue buildup, then choosing the right fix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;increase backend capacity / add servers,&lt;/li&gt;
&lt;li&gt;raise &lt;code&gt;maxconn&lt;/code&gt; if the backend can truly handle more,&lt;/li&gt;
&lt;li&gt;or raise &lt;code&gt;timeout queue&lt;/code&gt; if dropping is happening too aggressively.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key idea: &lt;strong&gt;don’t “tune” blindly—confirm whether it’s real overload vs. an overly strict queue timeout.&lt;/strong&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  5) ACL routing gap (&lt;code&gt;&amp;lt;NOSRV&amp;gt;&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;If a request matches no routing rule and there’s no &lt;code&gt;default_backend&lt;/code&gt;, HAProxy may return 503 because it has &lt;strong&gt;no routing target&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The article’s fix: ensure frontends define a &lt;code&gt;default_backend&lt;/code&gt;, and ensure ACL &lt;code&gt;use_backend&lt;/code&gt; rules cover all expected paths/hosts. This is a configuration correctness issue, not a backend health issue. &lt;/p&gt;

&lt;h3&gt;
  
  
  6) Servers stuck in &lt;code&gt;MAINT&lt;/code&gt; or &lt;code&gt;DRAIN&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Even if servers are alive, if they’ve been manually put into &lt;strong&gt;MAINT&lt;/strong&gt; or &lt;strong&gt;DRAIN&lt;/strong&gt; (often via admin socket or during maintenance) and never returned to READY/normal, HAProxy will act as if there are no available servers and return 503s.&lt;/p&gt;

&lt;p&gt;The guide shows checking server state via the socket and resetting a server back to &lt;strong&gt;ready&lt;/strong&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Confirming the fix (so you don’t regress later)
&lt;/h2&gt;

&lt;p&gt;After any change, the article recommends confirming recovery in two ways:&lt;/p&gt;

&lt;p&gt;1) &lt;strong&gt;Watch logs&lt;/strong&gt; for backend UP/DOWN and 503 patterns.&lt;br&gt;&lt;br&gt;
2) &lt;strong&gt;Re-check server status&lt;/strong&gt; through the stats socket to ensure servers are &lt;code&gt;UP&lt;/code&gt; and eligible.&lt;/p&gt;

&lt;p&gt;It emphasizes safe operational hygiene: validate config before reload, and use graceful reload methods to avoid dropping existing connections. &lt;/p&gt;

&lt;h2&gt;
  
  
  Extra checks if you still see 503s
&lt;/h2&gt;

&lt;p&gt;If the common causes don’t match, &lt;a href="https://sudoguide.com/troubleshoot-haproxy-503-errors/" rel="noopener noreferrer"&gt;the guide suggest&lt;/a&gt;s looking into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;firewall reachability (port connectivity),&lt;/li&gt;
&lt;li&gt;TLS/SSL mismatches between HAProxy and backends,&lt;/li&gt;
&lt;li&gt;backend file descriptor exhaustion under load,&lt;/li&gt;
&lt;li&gt;stats counters that hint HAProxy is retrying and masking instability until it can’t (e.g., retry-related indicators).&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>haproxy</category>
      <category>devops</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Fixing “No such file or directory” when installing LAMP on Ubuntu</title>
      <dc:creator>Artisan</dc:creator>
      <pubDate>Sun, 01 Nov 2026 07:12:48 +0000</pubDate>
      <link>https://dev.to/artisansg/fixing-no-such-file-or-directory-when-installing-lamp-on-ubuntu-5bpm</link>
      <guid>https://dev.to/artisansg/fixing-no-such-file-or-directory-when-installing-lamp-on-ubuntu-5bpm</guid>
      <description>&lt;p&gt;Installing a LAMP stack on Ubuntu &lt;em&gt;should&lt;/em&gt; be boring: &lt;code&gt;apt install&lt;/code&gt;, start services, load a test page, done.&lt;/p&gt;

&lt;p&gt;In reality, it’s common to get hit with errors like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;No such file or directory&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;command not found&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;permission denied&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bad file descriptor&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Apache/MySQL won’t start after install&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post is a practical, copy/paste-friendly checklist to get you unstuck, based on SudoGuide’s troubleshooting flow and the typical root causes behind these failures. &lt;/p&gt;

&lt;h2&gt;
  
  
  What “No such file or directory” usually &lt;em&gt;really&lt;/em&gt; means
&lt;/h2&gt;

&lt;p&gt;When you see “No such file or directory” during a LAMP install, it rarely means “your server randomly lost a file.”&lt;/p&gt;

&lt;p&gt;It usually means one of these is true:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Your package lists are stale&lt;/strong&gt; (you didn’t run &lt;code&gt;apt update&lt;/code&gt;, or a repo is failing).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependencies are broken&lt;/strong&gt; (a previous install was interrupted and dpkg is half-configured).
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You’re installing the wrong package name / wrong PHP version&lt;/strong&gt; for your Ubuntu release.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A config file references a path or module that doesn’t exist&lt;/strong&gt; (common with Apache ↔ PHP module mismatches).
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So the goal isn’t to guess. The goal is to restore your system to a clean package state, install the right components, and verify services.&lt;/p&gt;

&lt;h2&gt;
  
  
  The “fix it first” command block (most common solution)
&lt;/h2&gt;

&lt;p&gt;If you want the shortest path to “working LAMP,” run this sequence first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dpkg &lt;span class="nt"&gt;--configure&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;

&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2 mysql-server php libapache2-mod-php php-mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matches the “repair apt/dpkg, then install core LAMP packages” approach from the SudoGuide article. &lt;/p&gt;

&lt;p&gt;If the install completes cleanly, skip down to &lt;strong&gt;Verification&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 0: Confirm your Ubuntu version (matters more than you think)
&lt;/h2&gt;

&lt;p&gt;Package availability—especially PHP versions—depends on your Ubuntu release. Confirm it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsb_release &lt;span class="nt"&gt;-ds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this matters: people often follow a tutorial targeting a different Ubuntu version and end up installing packages that don’t exist (or mixing PHP versions/modules). The SudoGuide article calls this out as a common cause of “missing file/module” style failures. &lt;/p&gt;

&lt;h2&gt;
  
  
  Error pattern 1: “Unable to locate package” / missing packages
&lt;/h2&gt;

&lt;p&gt;If you see errors like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;E: Unable to locate package ...&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;packages that &lt;em&gt;should&lt;/em&gt; exist “can’t be found”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do this:&lt;/p&gt;

&lt;p&gt;1) Update package lists:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) If &lt;code&gt;apt update&lt;/code&gt; shows repository errors, fix/disable the broken repo lines before retrying (this is a frequent underlying cause of “packages can’t be found”). &lt;/p&gt;

&lt;p&gt;Then rerun the install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2 mysql-server php libapache2-mod-php php-mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error pattern 2: “dpkg was interrupted” / broken package state
&lt;/h2&gt;

&lt;p&gt;If you see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dpkg was interrupted, you must manually run 'sudo dpkg --configure -a'&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;dependency/configuration errors that won’t go away&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Repair your package manager state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dpkg &lt;span class="nt"&gt;--configure&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then retry installing the stack. This exact dpkg repair workflow is a central part of the SudoGuide troubleshooting path. &lt;/p&gt;

&lt;h2&gt;
  
  
  Error pattern 3: &lt;code&gt;command not found&lt;/code&gt; (but the tutorial says it should exist)
&lt;/h2&gt;

&lt;p&gt;This one is sneaky because it looks like your shell is broken, but it’s usually just “that package/tool isn’t installed yet.”&lt;/p&gt;

&lt;p&gt;Two common cases:&lt;/p&gt;

&lt;h3&gt;
  
  
  A) &lt;code&gt;add-apt-repository: command not found&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Install the helper package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;software-properties-common
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SudoGuide specifically flags missing prerequisites like &lt;code&gt;add-apt-repository&lt;/code&gt; as a reason installs derail. &lt;/p&gt;

&lt;h3&gt;
  
  
  B) MySQL hardening command missing
&lt;/h3&gt;

&lt;p&gt;If &lt;code&gt;mysql_secure_installation&lt;/code&gt; is missing, it often means MySQL server itself isn’t installed correctly yet. Make sure you installed the server package successfully first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;mysql-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(That “secure installation” step is widely recommended in standard LAMP setups.) &lt;/p&gt;

&lt;h2&gt;
  
  
  Error pattern 4: Apache won’t start (often PHP module mismatch)
&lt;/h2&gt;

&lt;p&gt;A classic scenario:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apache installs fine&lt;/li&gt;
&lt;li&gt;You install PHP&lt;/li&gt;
&lt;li&gt;Restart Apache and it fails&lt;/li&gt;
&lt;li&gt;Logs/config mention missing &lt;code&gt;.so&lt;/code&gt; modules or paths&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The underlying cause is often: &lt;strong&gt;Apache is configured to load a PHP module that isn’t actually installed&lt;/strong&gt; (or you have version conflicts). The SudoGuide article highlights “wrong paths/modules in config” as a frequent reason for “file not found” style errors during LAMP setup. &lt;/p&gt;

&lt;p&gt;Start with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apache2ctl configtest
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status apache2 &lt;span class="nt"&gt;--no-pager&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then ensure the Apache PHP module package is installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;libapache2-mod-php
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(If you’re juggling multiple PHP versions, you may also need to disable one module and enable another, but don’t do that unless you know you’re in a multi-version situation.)&lt;/p&gt;

&lt;h2&gt;
  
  
  Error pattern 5: “Permission denied” (install or web root)
&lt;/h2&gt;

&lt;p&gt;Two common permission issues:&lt;/p&gt;

&lt;h3&gt;
  
  
  A) Installing without sudo
&lt;/h3&gt;

&lt;p&gt;If you see permission errors during install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  B) Writing files into &lt;code&gt;/var/www/html&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Ubuntu’s default web root is typically owned by &lt;code&gt;root&lt;/code&gt;. If you’re testing with a quick PHP file, write it with sudo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;?php phpinfo(); ?&amp;gt;"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /var/www/html/info.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error pattern 6: “Bad file descriptor” / weird I/O errors
&lt;/h2&gt;

&lt;p&gt;This is often not “a LAMP problem” at all—it’s a system problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;low disk space&lt;/li&gt;
&lt;li&gt;corrupted package downloads&lt;/li&gt;
&lt;li&gt;filesystem issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SudoGuide frames this as a separate class of failures and recommends system-level checks (disk space, cleanup, reinstall). &lt;/p&gt;

&lt;p&gt;At minimum, check disk usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you’re critically low, free space and retry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification (make sure the whole stack is actually working)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Apache is running
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status apache2 &lt;span class="nt"&gt;--no-pager&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also test locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-I&lt;/span&gt; http://localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2) PHP works via Apache
&lt;/h3&gt;

&lt;p&gt;Create a test file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;?php phpinfo(); ?&amp;gt;"&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /var/www/html/info.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://YOUR_SERVER_IP/info.php&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; remove it immediately after testing. Leaving &lt;code&gt;phpinfo()&lt;/code&gt; exposed can leak configuration details (extensions, paths, environment info) you don’t want public. &lt;/p&gt;

&lt;p&gt;Remove it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo rm&lt;/span&gt; /var/www/html/info.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3) MySQL is alive
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status mysql &lt;span class="nt"&gt;--no-pager&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Debugging checklist (when you’re still stuck)
&lt;/h2&gt;

&lt;p&gt;If something still fails, don’t reinstall blindly—collect signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repair package state:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo dpkg --configure -a&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sudo apt install -f&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Validate Apache config:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sudo apache2ctl configtest&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Check logs:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo journalctl -u apache2 -n 100 --no-pager&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo journalctl -u mysql -n 100 --no-pager&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pattern to remember: LAMP “file not found” errors are usually either &lt;strong&gt;package manager state&lt;/strong&gt; (apt/dpkg) or &lt;strong&gt;module/config mismatch&lt;/strong&gt; (Apache/PHP). &lt;/p&gt;

&lt;h2&gt;
  
  
  Closing thoughts
&lt;/h2&gt;

&lt;p&gt;Most LAMP install failures are fixable without nuking your server. Treat the error message as a hint, restore your package manager to a healthy state, install the core packages for &lt;em&gt;your&lt;/em&gt; Ubuntu release, then verify each layer (Apache → PHP → MySQL).&lt;/p&gt;

&lt;p&gt;Source inspiration: SudoGuide’s troubleshooting walkthrough on LAMP install errors for Ubuntu. &lt;/p&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>php</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
