<?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: Chaitanya Rai</title>
    <description>The latest articles on DEV Community by Chaitanya Rai (@chaitanyarai3).</description>
    <link>https://dev.to/chaitanyarai3</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3082212%2F6da42ba8-3d6a-4b07-86b9-3fad1311ebf0.png</url>
      <title>DEV Community: Chaitanya Rai</title>
      <link>https://dev.to/chaitanyarai3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chaitanyarai3"/>
    <language>en</language>
    <item>
      <title>When the mv Command “Loses” Your File in Linux — What Really Happened🚀</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Mon, 10 Nov 2025 16:52:33 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/when-the-mv-command-loses-your-file-in-linux-what-really-happened-1186</link>
      <guid>https://dev.to/chaitanyarai3/when-the-mv-command-loses-your-file-in-linux-what-really-happened-1186</guid>
      <description>&lt;p&gt;Have you ever used the Linux terminal to move a file with &lt;code&gt;mv&lt;/code&gt; and then realized the file &lt;em&gt;vanished&lt;/em&gt;? 😱&lt;br&gt;&lt;br&gt;
Don’t worry — your file isn’t gone. It’s just not where you thought it would be.&lt;/p&gt;

&lt;p&gt;Let’s dive into what actually happens when the &lt;code&gt;mv&lt;/code&gt; command “loses” your file — and how to avoid this in the future.&lt;/p&gt;


&lt;h2&gt;
  
  
  🧩 The Scenario
&lt;/h2&gt;

&lt;p&gt;You’re working inside this directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/var/www/project/config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you 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;mv &lt;/span&gt;ssl_key.pem /backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You expect your file to move into:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/var/www/project/config/backup/ssl_key.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But when you check… It’s not there! 😨&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;⚙️ The Root Cause: Absolute vs. Relative Paths&lt;/strong&gt;&lt;br&gt;
Here’s the catch — paths in Linux can be absolute or relative.&lt;/p&gt;

&lt;p&gt;Absolute Path - /backup Starts from the root (/) of the system&lt;br&gt;
Relative Path - backup  Starts from your current working directory&lt;/p&gt;

&lt;p&gt;So when you type:&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;mv &lt;/span&gt;ssl_key.pem /backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Linux looks for a folder named /backup at the root of the system, not inside your current folder.&lt;/p&gt;

&lt;p&gt;Your file actually ends up here:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/backup/ssl_key.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 Totally different location!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🤔 What If /backup Doesn’t Exist?&lt;/strong&gt;&lt;br&gt;
If that folder doesn’t exist, Linux assumes you’re renaming your file instead of moving it.&lt;/p&gt;

&lt;p&gt;So ssl_key.pem becomes a new file named /backup, sitting in your root directory.&lt;/p&gt;

&lt;p&gt;Yup — your file was just renamed, not moved.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;🧭 How to Find the “Lost” File&lt;/strong&gt;&lt;br&gt;
You can check what happened with this command:&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;ls&lt;/span&gt; &lt;span class="nt"&gt;-ld&lt;/span&gt; /backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now check the output:&lt;/p&gt;

&lt;p&gt;If it starts with d (like drwxr-xr-x), /backup is a directory, and your file is inside 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;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; /backup/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it starts with - (like -rw-r--r--), /backup is a file, not a folder — your original file was renamed to /backup.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;✅ The Right Way to Move It&lt;/strong&gt;&lt;br&gt;
If your goal was to move it to a subfolder within your current directory, use a relative path instead:&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;mv &lt;/span&gt;ssl_key.pem backup/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or, even safer:&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;mv&lt;/span&gt; ./ssl_key.pem ./backup/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice there’s no leading slash — that’s what makes it relative to your current directory.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🧠 Always Know Where You Are&lt;/strong&gt;&lt;br&gt;
Before running mv, it’s a good idea to check your current directory:&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;pwd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It shows your “present working directory,” helping you understand where a relative path will lead.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🧹 Recovering the File&lt;/strong&gt;&lt;br&gt;
If your file ended up somewhere unexpected, you can move it back like this:&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="c"&gt;# Case 1: File was renamed to /backup&lt;/span&gt;
&lt;span class="nb"&gt;mv&lt;/span&gt; /backup /var/www/project/config/ssl_key.pem

&lt;span class="c"&gt;# Case 2: File is inside /backup/&lt;/span&gt;
&lt;span class="nb"&gt;mv&lt;/span&gt; /backup/ssl_key.pem /var/www/project/config/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;✨ Final Thoughts&lt;/strong&gt;&lt;br&gt;
The Linux mv command is one of the simplest — yet most powerful — terminal tools.&lt;br&gt;
But a single / can change everything.&lt;/p&gt;

&lt;p&gt;Next time you move files, pause for a second and check your path.&lt;br&gt;
That little detail can save you from hours of “where did my file go?” debugging. 🧠🐧&lt;/p&gt;

</description>
      <category>linux</category>
      <category>terminal</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Simplify Database Configuration Across Environments (Dev, Staging, and Production)💡</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Fri, 07 Nov 2025 09:30:47 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/simplify-database-configuration-across-environments-dev-staging-and-production-4kml</link>
      <guid>https://dev.to/chaitanyarai3/simplify-database-configuration-across-environments-dev-staging-and-production-4kml</guid>
      <description>&lt;p&gt;If you’ve ever worked on a web application — whether in PHP, Laravel, Node.js, or Python — you’ve likely faced this common headache:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every time you push code to staging or production, you have to manually change your database configuration — host, username, password, and database name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That might sound small, but it’s a pain point for every developer and a frequent cause of bugs when someone accidentally pushes dev credentials to production. 😬&lt;/p&gt;

&lt;p&gt;Let’s fix that once and for all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚨 The Problem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A typical setup looks like this:&lt;/p&gt;

&lt;p&gt;// config.php&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="nv"&gt;$servername&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"localhost"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$dbname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"myapp_dev"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When moving to staging or production, you edit those values manually:&lt;/p&gt;

&lt;p&gt;// On staging&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="nv"&gt;$servername&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"staging-db-server"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"staging_user"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"staging_pass"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$dbname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"myapp_staging"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;But this approach is risky:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;❌ You might forget to change credentials before deployment.&lt;/p&gt;

&lt;p&gt;❌ You could accidentally commit secrets to GitHub.&lt;/p&gt;

&lt;p&gt;❌ It breaks automation and CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ The Smart Fix: Environment-Based Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The best practice is to separate configuration from code.&lt;br&gt;
In short: your code stays the same in every environment — only your environment variables change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗝️ Step 1: Use Environment Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of hardcoding credentials, read them dynamically.&lt;/p&gt;

&lt;p&gt;embed Example (PHP):&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="nv"&gt;$servername&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_HOST'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_USER'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_PASS'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$dbname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_NAME'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you only set these variables per environment — no code editing required!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Step 2: Create .env Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each environment (dev, staging, prod) should have its own .env file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;.env.dev

&lt;span class="nv"&gt;DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;localhost
&lt;span class="nv"&gt;DB_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;root
&lt;span class="nv"&gt;DB_PASS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;span class="nv"&gt;DB_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myapp_dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;.env.staging

&lt;span class="nv"&gt;DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;staging-db-server
&lt;span class="nv"&gt;DB_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;staging_user
&lt;span class="nv"&gt;DB_PASS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;staging_pass
&lt;span class="nv"&gt;DB_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myapp_staging
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;.env.prod

&lt;span class="nv"&gt;DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;prod-db-server
&lt;span class="nv"&gt;DB_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;prod_user
&lt;span class="nv"&gt;DB_PASS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;super_secret_password
&lt;span class="nv"&gt;DB_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;myapp_prod

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;📦 Step 3: Load .env Automatically&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re using Laravel, this happens automatically.&lt;/p&gt;

&lt;p&gt;`For plain PHP or Node.js, use a helper library:&lt;/p&gt;

&lt;p&gt;PHP → vlucas/phpdotenv&lt;/p&gt;

&lt;p&gt;Node.js → dotenv`&lt;/p&gt;

&lt;p&gt;Example (PHP):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;require &lt;span class="s1"&gt;'vendor/autoload.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$dotenv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Dotenv&lt;span class="se"&gt;\D&lt;/span&gt;otenv::createImmutable&lt;span class="o"&gt;(&lt;/span&gt;__DIR__&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$dotenv&lt;/span&gt;-&amp;gt;load&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$servername&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'DB_HOST'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔄 Step 4: Auto-Detect Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can even load different .env files automatically depending on the environment or domain:&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="nv"&gt;$envFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'.env.dev'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; // default

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;strpos&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;, &lt;span class="s1"&gt;'staging'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$envFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'.env.staging'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt; elseif &lt;span class="o"&gt;(&lt;/span&gt;strpos&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_SERVER&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'HTTP_HOST'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;, &lt;span class="s1"&gt;'myapp.com'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$envFile&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'.env.prod'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$dotenv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; Dotenv&lt;span class="se"&gt;\D&lt;/span&gt;otenv::createImmutable&lt;span class="o"&gt;(&lt;/span&gt;__DIR__, &lt;span class="nv"&gt;$envFile&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$dotenv&lt;/span&gt;-&amp;gt;load&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your app picks the right config automatically — no manual edits ever again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔒 Step 5: Secure Your .env Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Never push &lt;code&gt;.env&lt;/code&gt; files to GitHub!&lt;/p&gt;

&lt;p&gt;Add this to &lt;code&gt;.gitignore:&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Ignore environment files
.env*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, on each server, manually create the correct .env file — or better yet, inject environment variables through your CI/CD pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 Why It Matters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✅ No more manual DB config changes&lt;br&gt;
✅ No secrets in GitHub&lt;br&gt;
✅ CI/CD-friendly deployments&lt;br&gt;
✅ Works across all frameworks&lt;br&gt;
✅ Clean, portable codebase&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🗂 Example Folder Structure&lt;/strong&gt;&lt;br&gt;
myapp/&lt;br&gt;
 ├── index.php&lt;br&gt;
 ├── config.php&lt;br&gt;
 ├── .env.dev&lt;br&gt;
 ├── .env.staging&lt;br&gt;
 ├── .env.prod&lt;br&gt;
 ├── .gitignore&lt;br&gt;
 └── vendor/&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌐 Bonus Tip: Use Cloud Secrets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you deploy on AWS, Google Cloud, or Render, you can skip .env files entirely!&lt;br&gt;
Store your DB credentials as environment secrets in your cloud console — your app will automatically read them at runtime.&lt;/p&gt;

&lt;p&gt;This keeps your deployment 100% secure and automated. 🔐&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🏁 Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Managing different database credentials for each environment shouldn’t slow you down.&lt;/p&gt;

&lt;p&gt;By using environment variables and .env files, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simplify deployments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protect credentials&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep your project portable and clean&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether you’re using Laravel, Node.js, or plain PHP, this approach saves hours and prevents “works-on-my-machine” moments. 💪&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✨ Pro tip:&lt;/strong&gt; Combine this setup with a CI/CD pipeline (like GitHub Actions or Cloud Build) to automatically deploy with the correct environment — no manual config edits ever again!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💬 What’s your approach?&lt;/strong&gt;&lt;br&gt;
How do you manage DB credentials across environments in your projects?&lt;br&gt;
Share your setup in the comments 👇&lt;/p&gt;

</description>
      <category>database</category>
      <category>webdev</category>
      <category>programming</category>
      <category>devops</category>
    </item>
    <item>
      <title>Debugging Memory Leaks in Node.js and PHP 🧠</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Tue, 04 Nov 2025 07:21:02 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/debugging-memory-leaks-in-nodejs-and-php-4ofp</link>
      <guid>https://dev.to/chaitanyarai3/debugging-memory-leaks-in-nodejs-and-php-4ofp</guid>
      <description>&lt;h1&gt;
  
  
  🧠 Debugging Memory Leaks in Node.js and PHP — Track Down Hidden Performance Killers
&lt;/h1&gt;

&lt;p&gt;Have you ever restarted your app every few hours because it was “just using too much memory”? 😅&lt;br&gt;&lt;br&gt;
That’s usually a &lt;strong&gt;memory leak&lt;/strong&gt; — when your application keeps holding onto data it no longer needs.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll explore &lt;strong&gt;how to detect and fix memory leaks&lt;/strong&gt; in both &lt;strong&gt;Node.js&lt;/strong&gt; and &lt;strong&gt;PHP&lt;/strong&gt;, using practical tools like &lt;strong&gt;Chrome DevTools&lt;/strong&gt; and &lt;strong&gt;Xdebug&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  💡 What is a Memory Leak?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;memory leak&lt;/strong&gt; happens when your program allocates memory and never releases it, even when that data is no longer used.&lt;br&gt;&lt;br&gt;
Over time, memory usage grows, performance slows, and eventually — 💥 your process crashes.&lt;/p&gt;

&lt;p&gt;Imagine this simple analogy:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You’re putting items into a bag, but never taking anything out.&lt;br&gt;&lt;br&gt;
Eventually, the bag bursts.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  🧩 Common Causes
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cause&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unreferenced objects kept alive&lt;/td&gt;
&lt;td&gt;Global variables holding large data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event listeners not removed&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;element.addEventListener()&lt;/code&gt; without cleanup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Caching gone wrong&lt;/td&gt;
&lt;td&gt;Storing too much in memory-based cache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long-running loops or intervals&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;setInterval&lt;/code&gt; without &lt;code&gt;clearInterval&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Circular references&lt;/td&gt;
&lt;td&gt;Two objects referencing each other indefinitely&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  🟢 Debugging Memory Leaks in &lt;strong&gt;Node.js&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1️⃣ Check memory usage in real time
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;--inspect&lt;/span&gt; yourApp.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then open &lt;code&gt;chrome://inspect&lt;/code&gt; in Chrome → click &lt;strong&gt;"Memory" tab&lt;/strong&gt; → take a heap snapshot.&lt;/p&gt;

&lt;p&gt;You can compare snapshots over time to see which objects &lt;strong&gt;keep growing&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  2️⃣ Use process.memoryUsage()
&lt;/h3&gt;

&lt;p&gt;You can log memory usage periodically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;setInterval&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  const used &lt;span class="o"&gt;=&lt;/span&gt; process.memoryUsage&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;let &lt;/span&gt;key &lt;span class="k"&gt;in &lt;/span&gt;used&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    console.log&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;(used[key] / 1024 / 1024).toFixed(2)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt; MB&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;, 5000&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the heap keeps increasing even under a steady workload, you likely have a leak.&lt;/p&gt;

&lt;h3&gt;
  
  
  3️⃣ Detect leaks with clinic.js or memwatch-next
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; clinic
clinic doctor &lt;span class="nt"&gt;--&lt;/span&gt; node app.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;memwatch-next
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;const memwatch &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'memwatch-next'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
memwatch.on&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'leak'&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;info&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; console.log&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Memory leak detected:'&lt;/span&gt;, info&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;##🐘 Debugging Memory Leaks in PHP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PHP scripts usually die after each request, so memory leaks are less common — but long-running workers (like Laravel Queues or Daemon scripts) can still leak memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  1️⃣ Enable Xdebug profiling
&lt;/h3&gt;

&lt;p&gt;Add this in &lt;code&gt;php.ini&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;xdebug.mode&lt;span class="o"&gt;=&lt;/span&gt;profile
xdebug.output_dir&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/tmp/xdebug_profiles"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run your script. Use tools like &lt;code&gt;QCacheGrind&lt;/code&gt; or &lt;code&gt;Webgrind&lt;/code&gt;&lt;br&gt;
 to visualize memory usage and function calls.&lt;/p&gt;
&lt;h3&gt;
  
  
  2️⃣ Monitor memory in code
&lt;/h3&gt;

&lt;p&gt;You can track memory usage directly:&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;memory_get_usage&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;" bytes&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Watch for continuous growth in long loops or workers:&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="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    doSomething&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;echo &lt;/span&gt;memory_get_usage&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3️⃣ Common PHP Leak Sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Unclosed database connections&lt;/li&gt;
&lt;li&gt;Huge arrays kept in memory&lt;/li&gt;
&lt;li&gt;Static variables holding data between iterations&lt;/li&gt;
&lt;li&gt;Recursive functions not returning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;To fix these, always:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unset unused variables (unset($var))&lt;/li&gt;
&lt;li&gt;Close DB or file handles&lt;/li&gt;
&lt;li&gt;Use generators (yield) for large datasets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧹 Prevention Strategies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✅ Avoid global variables&lt;br&gt;
✅ Use weak references or caches with size limits&lt;br&gt;
✅ Always remove event listeners&lt;br&gt;
✅ Test in a long-running environment (not just one request)&lt;br&gt;
✅ Automate leak checks in staging&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Wrapping Up&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Memory leaks are sneaky — they don’t crash your app immediately but slowly drain resources until everything slows down.&lt;br&gt;
By using profiling tools, logs, and heap snapshots, you can catch them before they reach production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debugging is not just fixing bugs — it’s understanding why they happened.&lt;/p&gt;

&lt;p&gt;💬 Have you ever debugged a real memory leak?&lt;br&gt;
Share your story (and pain 😅) in the comments!&lt;/p&gt;

</description>
      <category>php</category>
      <category>node</category>
      <category>performance</category>
      <category>developer</category>
    </item>
    <item>
      <title>Why Your Docker Ubuntu Container Exits Immediately (and How to Fix It)🐳</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Fri, 31 Oct 2025 07:18:38 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/why-your-docker-ubuntu-container-exits-immediately-and-how-to-fix-it-iim</link>
      <guid>https://dev.to/chaitanyarai3/why-your-docker-ubuntu-container-exits-immediately-and-how-to-fix-it-iim</guid>
      <description>&lt;p&gt;If you’ve ever tried running an Ubuntu container on macOS (or any system) and noticed that it &lt;strong&gt;stops immediately&lt;/strong&gt;, you’re not alone.  &lt;/p&gt;

&lt;p&gt;You might see something like this in &lt;strong&gt;Docker Desktop&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ Docker is running (green icon)&lt;br&gt;&lt;br&gt;
🧱 Image is downloaded&lt;br&gt;&lt;br&gt;
❌ Container won’t stay alive&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s break down &lt;em&gt;why that happens&lt;/em&gt; — and how to fix it like a pro 💪&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 The Problem
&lt;/h2&gt;

&lt;p&gt;You pull the image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then try to run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But when you check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;CONTAINER ID   IMAGE     COMMAND       STATUS                     PORTS   NAMES
123abc456def   ubuntu    &lt;span class="s2"&gt;"/bin/bash"&lt;/span&gt;   Exited &lt;span class="o"&gt;(&lt;/span&gt;0&lt;span class="o"&gt;)&lt;/span&gt; 3 seconds ago   &lt;span class="nt"&gt;---&lt;/span&gt;     bold_blackburn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 It starts and exits immediately!&lt;br&gt;
You might wonder: “Why is my container not staying alive?”&lt;/p&gt;
&lt;h3&gt;
  
  
  💡 The Reason
&lt;/h3&gt;

&lt;p&gt;A Docker container only runs as long as its main process is running.&lt;/p&gt;

&lt;p&gt;When you start the ubuntu image, it runs /bin/bash by default.&lt;br&gt;
But if you don’t attach to it interactively, that shell exits right away.&lt;/p&gt;

&lt;p&gt;Think of it like opening a terminal window that instantly closes because you didn’t type anything.&lt;/p&gt;

&lt;p&gt;⚙️ The Fix — Run It Interactively&lt;/p&gt;

&lt;p&gt;Start the container with an interactive shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll now drop into a shell like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;root@b7f9c4f8f9e0:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎉 Boom! The container stays alive because you’re inside it.&lt;/p&gt;

&lt;p&gt;You can explore, install packages, and do anything:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;When you type exit, it will stop again — as expected.&lt;/p&gt;

&lt;p&gt;🏷️ Add a Name to Manage It Easily&lt;/p&gt;

&lt;p&gt;Add a friendly name to your container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; myubuntu ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can easily restart or attach later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker start &lt;span class="nt"&gt;-ai&lt;/span&gt; myubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No need to remember a random container ID!&lt;/p&gt;

&lt;p&gt;🌀 Keep It Running in the Background&lt;/p&gt;

&lt;p&gt;If you want your Ubuntu container to stay alive in the background, you need a process that never ends.&lt;br&gt;
For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; myubuntu ubuntu &lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s what’s happening:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-d →&lt;/code&gt;detached mode (runs in background)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;tail -f /dev/null →&lt;/code&gt;keeps the process alive forever&lt;/p&gt;

&lt;p&gt;Now check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll see your container happily running 😄&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Summary
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Basic&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker run ubuntu&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Starts and exits immediately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interactive&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker run -it ubuntu&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Opens shell, stays alive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Named&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker run -it --name myubuntu ubuntu&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Easier to manage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Background&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker run -d --name myubuntu ubuntu tail -f /dev/null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Persistent background container&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  💬 Final Thoughts
&lt;/h3&gt;

&lt;p&gt;So, the reason your Ubuntu container wasn’t running wasn’t a Docker Desktop bug — it was just Docker doing exactly what it should.&lt;br&gt;
Containers are designed to run a single process, not act as full-blown virtual machines (though you can make them behave like one 😉).&lt;/p&gt;

&lt;p&gt;If you remember this golden rule 👇&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 “No running process → container exits.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;…you’ll never be confused again.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>kubernetes</category>
      <category>devops</category>
    </item>
    <item>
      <title>Fixing “Unable to Create Directory wp-content/uploads” Error in WordPress on macOS (XAMPP)🧠</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Tue, 28 Oct 2025 04:43:05 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/fixing-unable-to-create-directory-wp-contentuploads-error-in-wordpress-on-macos-xampp-52om</link>
      <guid>https://dev.to/chaitanyarai3/fixing-unable-to-create-directory-wp-contentuploads-error-in-wordpress-on-macos-xampp-52om</guid>
      <description>&lt;p&gt;&lt;strong&gt;🖼️ Problem Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re developing a WordPress site locally on macOS using XAMPP, you might encounter this frustrating error while uploading media:&lt;/p&gt;

&lt;p&gt;“Unable to create directory wp-content/uploads/2025/10. Is its parent directory writable by the server?”&lt;/p&gt;

&lt;p&gt;This issue appears when WordPress doesn’t have permission to create or write to the uploads directory inside the wp-content folder.&lt;/p&gt;

&lt;p&gt;Let’s walk through the cause, diagnosis, and step-by-step fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Step 1: Understanding the Cause&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WordPress saves uploaded images and files inside:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/wp-content/uploads/[year]/[month]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If WordPress cannot:&lt;/p&gt;

&lt;p&gt;create these folders, or&lt;/p&gt;

&lt;p&gt;write files into them&lt;/p&gt;

&lt;p&gt;you’ll get this permission error.&lt;/p&gt;

&lt;p&gt;The root cause on macOS (especially when using XAMPP) is usually incorrect file ownership or permissions — the web server process runs as a different user than your macOS login.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚙️ Step 2: Identify the Web Server User&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, we need to find out which user the Apache web server runs as.&lt;/p&gt;

&lt;p&gt;Open Terminal and run:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ps aux | grep httpd&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You’ll see output similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_tempuser         4121   0.0  0.0 410724400   1424 s000  S+    7:01PM   0:00.00 grep httpd
daemon            4069   0.0  0.0 34476672   3488   ??  S     7:00PM   0:00.01 /Applications/XAMPP/xamppfiles/bin/httpd ...
root              4023   0.0  0.1 34476672  14940   ??  Ss    7:00PM   0:00.14 /Applications/XAMPP/xamppfiles/bin/httpd ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, daemon is the key user — that’s the account running Apache under XAMPP on macOS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧰 Step 3: Fix File Ownership and Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate to your WordPress project folder inside XAMPP’s htdocs directory.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /Applications/XAMPP/xamppfiles/htdocs/mywordpress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then give ownership and permissions to the correct web server user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R daemon wp-content/uploads
sudo chmod -R 775 wp-content/uploads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;chown changes ownership to the Apache user (daemon).&lt;/p&gt;

&lt;p&gt;chmod 775 allows both the owner and group to write, while everyone else can read.&lt;/p&gt;

&lt;p&gt;If you want to apply this to the whole wp-content folder (recommended for local dev):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown -R daemon wp-content
sudo chmod -R 775 wp-content
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔁 Step 4: Restart Apache&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Restart Apache from the XAMPP Control Panel or run this command:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sudo /Applications/XAMPP/xamppfiles/xampp restartapache&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then reopen your browser and try uploading an image again from Media → Add New in your WordPress dashboard.&lt;/p&gt;

&lt;p&gt;✅ It should now upload successfully!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧾 Step 5: Check PHP Upload Configuration (Optional but Important)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If uploads still fail or get stuck, the issue may be with your PHP upload settings.&lt;/p&gt;

&lt;p&gt;Create a file named phpinfo.php in your WordPress directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php phpinfo(); ?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open it in your browser:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;http://localhost/phpinfo.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Check for these key values:&lt;/p&gt;

&lt;p&gt;Setting Description Recommended&lt;br&gt;
file_uploads    Enables uploads On&lt;br&gt;
upload_tmp_dir  Temporary upload directory  Should have a valid path&lt;br&gt;
upload_max_filesize Max size of a single file   64M (or higher)&lt;br&gt;
post_max_size   Max size for total POST data    128M (or higher)&lt;/p&gt;

&lt;p&gt;If upload_tmp_dir is empty, edit your PHP config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /Applications/XAMPP/xamppfiles/etc/php.ini
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Uncomment or add this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upload_tmp_dir = "/Applications/XAMPP/xamppfiles/temp"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then restart Apache again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo /Applications/XAMPP/xamppfiles/xampp restartapache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧠 Why This Happens&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On macOS, each process runs under its own user account.&lt;/p&gt;

&lt;p&gt;You (the logged-in developer) are one user.&lt;/p&gt;

&lt;p&gt;Apache (from XAMPP) runs as daemon.&lt;/p&gt;

&lt;p&gt;When WordPress tries to create directories under your account’s ownership, Apache doesn’t have permission unless explicitly granted.&lt;br&gt;
Hence, the fix is about aligning permissions between you and the web server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Bonus Tips&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Always use relative paths for uploads. Check your wp-config.php and remove any hardcoded UPLOADS definitions like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;define('UPLOADS', '/Users/username/.../wp-content/uploads');&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead, let WordPress manage it automatically.&lt;/p&gt;

&lt;p&gt;Keep wp-content/uploads writable only for local development.&lt;br&gt;
On production servers, consider more restrictive permissions (e.g., 755 with proper ownership).&lt;/p&gt;

&lt;p&gt;After fixing the issue, delete the temporary phpinfo.php file for security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fixing file upload errors in local WordPress setups is often about understanding how your server runs under the hood.&lt;br&gt;
In macOS + XAMPP environments, simply changing the ownership of your wp-content/uploads directory to the daemon user and ensuring writable permissions resolves the issue immediately.&lt;/p&gt;

&lt;p&gt;Once set up properly, you’ll be able to upload themes, plugins, and images without a hitch.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Debugging Production: How to Fix Bugs Without Breaking Everything 🌐</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Thu, 23 Oct 2025 14:55:05 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/debugging-production-how-to-fix-bugs-without-breaking-everything-5cg7</link>
      <guid>https://dev.to/chaitanyarai3/debugging-production-how-to-fix-bugs-without-breaking-everything-5cg7</guid>
      <description>&lt;p&gt;If you’ve ever pushed a bug to production (and who hasn’t?), you know that cold sweat moment when an error alert hits your Slack at 2 AM.  &lt;/p&gt;

&lt;p&gt;Debugging in production isn’t like fixing code on your laptop — there’s pressure, limited visibility, and real users depending on you. But with the right mindset and tools, you can handle it &lt;em&gt;without breaking more things&lt;/em&gt;.  &lt;/p&gt;

&lt;p&gt;Let’s walk through a safe and strategic way to fix production issues — step by step.  &lt;/p&gt;




&lt;h2&gt;
  
  
  🪵 1. Start by Reading the Logs — Carefully
&lt;/h2&gt;

&lt;p&gt;Your &lt;strong&gt;logs are your first line of truth&lt;/strong&gt;. Before touching the code or restarting anything, &lt;strong&gt;observe&lt;/strong&gt; what’s actually happening.  &lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Tips:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filter logs by request ID, timestamp, or user session.
&lt;/li&gt;
&lt;li&gt;Look for error patterns — repeating exceptions, failed API calls, or database connection errors.
&lt;/li&gt;
&lt;li&gt;Avoid drowning in noise: focus on &lt;em&gt;recently changed modules&lt;/em&gt;.
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🔍 &lt;strong&gt;Pro tip:&lt;/strong&gt; Always include structured logs (JSON format, with timestamps, log levels, and trace IDs). It makes debugging 10x faster when your production system is busy.  &lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🚩 2. Use Feature Flags to Limit the Blast Radius
&lt;/h2&gt;

&lt;p&gt;When debugging a live app, &lt;strong&gt;never deploy experimental fixes directly&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This allows you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn features &lt;strong&gt;on or off instantly&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Roll out to a small % of users.
&lt;/li&gt;
&lt;li&gt;Roll back safely if something breaks.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feature flags turn debugging from risky deployments into reversible switches.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚙️ &lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;


&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;isFeatureEnabled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;newCheckoutFlow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;runNewCheckout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;runOldCheckout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔄 3. Compare Versions — What Changed?
&lt;/h2&gt;

&lt;p&gt;One of the smartest debugging habits: &lt;strong&gt;compare the current version with the last known good one&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;You can:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;git diff&lt;/code&gt; to check for recent code changes.
&lt;/li&gt;
&lt;li&gt;Match timestamps of new errors with deployment times.
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🧠 80% of production bugs trace back to recent changes — even a single config tweak can ripple across your system.  &lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧪 4. Shadow Testing: Debug Without Impacting Real Users
&lt;/h2&gt;

&lt;p&gt;Shadow testing (also called &lt;em&gt;mirroring&lt;/em&gt;) is a lifesaver. It means sending &lt;strong&gt;a copy of real traffic&lt;/strong&gt; to a test version of your app — without affecting actual users.  &lt;/p&gt;

&lt;p&gt;You can test new fixes safely and see how they behave under real-world conditions.  &lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Use it to:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate bug fixes.
&lt;/li&gt;
&lt;li&gt;Measure performance differences.
&lt;/li&gt;
&lt;li&gt;Detect unexpected side effects.
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧯 5. Safe Hotfix Deployment
&lt;/h2&gt;

&lt;p&gt;Once you’ve confirmed the fix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deploy in stages&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor metrics&lt;/strong&gt; like response time, CPU, and error rates immediately.
&lt;/li&gt;
&lt;li&gt;If metrics spike — roll back instantly.
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🧩 &lt;strong&gt;Always deploy hotfixes with the same process as regular releases&lt;/strong&gt;  &lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧘 6. Stay Calm, Log Everything, Learn
&lt;/h2&gt;

&lt;p&gt;Production debugging can feel chaotic, but &lt;strong&gt;post-incident learning&lt;/strong&gt; turns chaos into improvement.  &lt;/p&gt;

&lt;p&gt;After you fix the bug:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Document what went wrong and how you found it.
&lt;/li&gt;
&lt;li&gt;Add new alerts or tests to catch similar issues earlier.
&lt;/li&gt;
&lt;li&gt;Share lessons in your team’s retro — no blame, just learning.
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Debugging production isn’t about perfection — it’s about control under pressure.  &lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🚀 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Debugging production code is like defusing a bomb in slow motion — the key is &lt;strong&gt;precision, not panic&lt;/strong&gt;.  &lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Observe first (logs),
&lt;/li&gt;
&lt;li&gt;Contain impact (feature flags),
&lt;/li&gt;
&lt;li&gt;Verify (shadow testing),
&lt;/li&gt;
&lt;li&gt;Deploy safely (hotfix rollout),
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…you’ll go from firefighting to &lt;em&gt;fire prevention&lt;/em&gt;.  &lt;/p&gt;

&lt;p&gt;Remember: every production bug teaches you how to build systems that fail more gracefully next time.  &lt;/p&gt;




&lt;p&gt;💬 What’s your go-to strategy when something breaks in production? Share your tips below 👇  &lt;/p&gt;

</description>
      <category>debugging</category>
      <category>devops</category>
      <category>production</category>
      <category>developer</category>
    </item>
    <item>
      <title>Integrating Forminator into Your Custom WordPress Page (and Fixing Visibility Issues) 🛠️</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Fri, 26 Sep 2025 03:54:52 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/integrating-forminator-into-your-custom-wordpress-page-and-fixing-visibility-issues-3jg6</link>
      <guid>https://dev.to/chaitanyarai3/integrating-forminator-into-your-custom-wordpress-page-and-fixing-visibility-issues-3jg6</guid>
      <description>&lt;p&gt;&lt;strong&gt;✅ Introduction&lt;/strong&gt;&lt;br&gt;
Forminator is a powerful and flexible WordPress plugin for building forms, polls, and quizzes. It offers drag-and-drop ease with advanced features like conditional logic, spam protection, and even payment gateways.&lt;/p&gt;

&lt;p&gt;But what if you’ve built a custom page template in your theme and the Forminator form doesn’t appear properly?&lt;br&gt;
You’re not alone — this often happens when theme styles override the form or the template is missing essential WordPress functions and assets.&lt;/p&gt;

&lt;p&gt;In this guide, you’ll learn how to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Embed a Forminator form inside a custom template&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fix invisible or broken forms with CSS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debug deeper issues like missing scripts or plugin conflicts&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧩 Step 1: Embed the Forminator Form Using a Shortcode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you’ve created a custom template file like page-contact.php.&lt;/p&gt;

&lt;p&gt;Add the Forminator shortcode inside your custom &lt;strong&gt;HTML/PHP markup&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="custom-form"&amp;gt;
    &amp;lt;?php echo do_shortcode( '[forminator_form id="123"]' ); ?&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔹 Tip: Replace 123 with your actual Forminator form ID.&lt;/strong&gt;&lt;br&gt;
Find it in: &lt;em&gt;&lt;strong&gt;WordPress Admin&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Forminator&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Forms&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Hover over&lt;/strong&gt;&lt;/em&gt; the form name.&lt;/p&gt;

&lt;p&gt;If you prefer a dynamic ID from a custom field, escape it for safety:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo do_shortcode( '[forminator_form id="' . esc_attr( $form_id ) . '"]' );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;**&lt;br&gt;
🎨 Step 2: Fix Visibility Issues with Scoped CSS**&lt;/p&gt;

&lt;p&gt;Sometimes the form is technically present but hidden due to theme CSS conflicts.&lt;/p&gt;

&lt;p&gt;Add this to your &lt;strong&gt;style.css&lt;/strong&gt; or &lt;em&gt;&lt;strong&gt;Customizer&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Additional CSS&lt;/strong&gt;&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Scope to this page’s wrapper to avoid affecting other pages */
.custom-form .forminator-ui,
.custom-form .forminator-custom-form,
.custom-form .forminator-design--default {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 100% !important;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔎 Use your browser dev tools (&lt;em&gt;&lt;strong&gt;F12 → Inspect&lt;/strong&gt;&lt;/em&gt;) to check which CSS rules are overriding Forminator’s default styles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Step 3: Load WordPress Assets in Your Template&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the form still doesn’t load or looks broken, make sure your template includes WordPress’s standard hooks and assets.&lt;/p&gt;

&lt;p&gt;At the top of your template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
/* Template Name: Custom Form Page */
get_header(); // Loads header.php, which should call wp_head()
?&amp;gt;
&amp;lt;!-- Your custom content --&amp;gt;
&amp;lt;?php
get_footer(); // Loads footer.php, which should call wp_footer()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Most themes already include wp_head() and wp_footer() inside header.php and footer.php.&lt;br&gt;
Only call these functions directly if you’re building a blank template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 4: Debug JavaScript Errors&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Still blank? Open the browser console (&lt;em&gt;&lt;strong&gt;F12 → Console&lt;/strong&gt;&lt;/em&gt;) and check for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Uncaught ReferenceError&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;jQuery is not defined&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;404 errors for missing JS or CSS files&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you see these, it usually means scripts aren’t being enqueued or a plugin is interfering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚫 Bonus: Check for Plugin or Cache Conflicts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Performance plugins (minification, lazy loading, caching) can block Forminator assets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Disabling lazy-loading for Forminator forms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Excluding Forminator from CSS/JS minification&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Temporarily deactivating other plugins to find conflicts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flush permalinks (&lt;em&gt;&lt;strong&gt;Settings&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Permalinks&lt;/strong&gt;&lt;/em&gt; → &lt;em&gt;&lt;strong&gt;Save Changes&lt;/strong&gt;&lt;/em&gt;) to refresh rewrite rules&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;✅ Final Result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once everything is set up, your rendered page will look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="custom-form"&amp;gt;
    &amp;lt;!-- Forminator Form Rendered Here --&amp;gt;
    &amp;lt;form class="forminator-custom-form"&amp;gt; ... &amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No more hidden inputs, missing scripts, or CSS ghosts. 🎯&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Integrating Forminator into a custom WordPress page is straightforward, but rendering issues can trip up developers.&lt;br&gt;
By ensuring that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The shortcode is placed correctly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSS conflicts are scoped and overridden&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;All necessary WordPress assets are loaded&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;…you can build beautiful, interactive forms even in fully custom templates — without sacrificing theme flexibility or performance.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>php</category>
      <category>wordpress</category>
      <category>themes</category>
    </item>
    <item>
      <title>Mastering the Art of Debugging: Strategies, Tools, and Mindset for Every Developer</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Wed, 24 Sep 2025 05:55:07 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/mastering-the-art-of-debugging-strategies-tools-and-mindset-for-every-developer-59hh</link>
      <guid>https://dev.to/chaitanyarai3/mastering-the-art-of-debugging-strategies-tools-and-mindset-for-every-developer-59hh</guid>
      <description>&lt;p&gt;No matter how experienced you are, bugs are inevitable. They sneak into code during late-night coding sessions, sudden requirement changes, or even the simplest refactor.&lt;br&gt;
What separates a frustrated developer from a confident one isn’t the absence of bugs—it’s the ability to debug effectively.&lt;/p&gt;

&lt;p&gt;This guide walks you through the mindset, techniques, and tools every developer should know to track down and fix issues with confidence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Testing vs. Debugging: Know the Difference&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before diving in, it’s important to separate testing from debugging:&lt;/p&gt;

&lt;p&gt;Testing is about detecting problems. It tells you something is wrong by running automated tests, QA checks, or manual verifications.&lt;/p&gt;

&lt;p&gt;Debugging is about diagnosing and fixing those problems. It’s the detective work that starts once a test fails or a user reports a bug.&lt;/p&gt;

&lt;p&gt;Think of testing as the alarm and debugging as the investigation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Breakpoints: Your First Line of Defense&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A breakpoint pauses code execution at a specific line so you can inspect variable values, memory state, and control flow in real time.&lt;/p&gt;

&lt;p&gt;When to use a breakpoint:&lt;/p&gt;

&lt;p&gt;When you need to inspect the exact state of a program at a critical moment.&lt;/p&gt;

&lt;p&gt;To follow the logic step by step and see where it diverges from expectations.&lt;/p&gt;

&lt;p&gt;Most IDEs (VS Code, IntelliJ, PyCharm, etc.) make it easy to set breakpoints and step through code without guesswork.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Logs, Error Messages, and Stack Traces: Reading the Clues&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logs and stack traces are your breadcrumbs through the forest.&lt;/p&gt;

&lt;p&gt;Logs reveal what happened leading up to the error. Use different levels (info, warn, error) for clarity.&lt;/p&gt;

&lt;p&gt;Error messages often contain keywords or codes that hint at the root cause.&lt;/p&gt;

&lt;p&gt;Stack traces show the exact chain of function calls when the error occurred.&lt;/p&gt;

&lt;p&gt;💡 Tip: Always log enough context (inputs, timestamps, environment details) to reproduce issues without flooding your console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Structured Debugging Approaches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When staring at a mysterious bug, a clear strategy saves time.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;&lt;em&gt;Divide and Conquer&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Split the problem space into smaller sections. Isolate components or modules to see where the bug disappears.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;&lt;em&gt;Binary Search&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the issue arises in a long block of code or a large data set, repeatedly halve the search space until you locate the faulty line.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;&lt;em&gt;Rubber Duck Debugging&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Explain your code line by line to a “rubber duck” (or a teammate, or even a text document).&lt;br&gt;
Often, the act of explaining reveals the flaw before the listener says a word.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Debugging with Version Control (Git)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Version control isn’t just for collaboration—it’s a debugging powerhouse.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Git bisect:&lt;/strong&gt;&lt;/em&gt; Automatically find the commit where a bug was introduced by performing a binary search through commit history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Blame/Annotate:&lt;/em&gt;&lt;/strong&gt; Identify who last changed a particular line of code to gather context.&lt;/p&gt;

&lt;p&gt;Branching: Experiment with fixes safely without risking production code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Code Reviews and Collaborative Debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debugging isn’t always a solo activity.&lt;br&gt;
Peer code reviews catch issues before they hit production and bring fresh eyes to tricky problems.&lt;br&gt;
Pair programming or quick brainstorming sessions can reveal oversights you might miss after hours of staring at the same file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. When Bugs Stay Unfixed: Risk, Legacy, and Cost&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not every bug deserves a fix.&lt;br&gt;
Engineering is about trade-offs, and sometimes the cost of a fix outweighs the benefit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common reasons to leave a bug unfixed:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Low Impact:&lt;/em&gt;&lt;/strong&gt; The bug doesn’t affect critical functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;High Risk:&lt;/em&gt;&lt;/strong&gt; Fixing it might break a fragile legacy system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Cost/Benefit:&lt;/em&gt;&lt;/strong&gt; Time and resources are better spent on new features or high-priority issues.&lt;/p&gt;

&lt;p&gt;Documenting these decisions is crucial for future teams to understand the context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Cultivating the Debugging Mindset&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Effective debugging isn’t just about tools—it’s about mindset:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Stay curious:&lt;/em&gt;&lt;/strong&gt; Treat bugs as puzzles, not annoyances.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Remain calm:&lt;/em&gt;&lt;/strong&gt; Frustration clouds judgment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Be systematic:&lt;/em&gt;&lt;/strong&gt; Change one thing at a time, and track your steps.&lt;/p&gt;

&lt;p&gt;Over time, you’ll develop an intuition for where bugs hide, but a structured process ensures you don’t rely on luck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debugging is more than a technical skill—it’s an art form that combines logic, patience, and creativity.&lt;br&gt;
By mastering breakpoints, logs, version control, and structured strategies, you’ll transform bugs from frustrating roadblocks into valuable learning opportunities.&lt;/p&gt;

&lt;p&gt;Next time a mysterious error pops up, don’t panic.&lt;br&gt;
Grab your debugger, trust your process, and start the hunt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;✍️ Have your own debugging war stories or favorite tips? Share them in the comments—every bug has a lesson to teach.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>code</category>
      <category>devbugsmash</category>
      <category>webdev</category>
      <category>fix</category>
    </item>
    <item>
      <title>Deleting the First Git Commit and Resolving Rebase Issues</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Tue, 27 May 2025 15:40:19 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/deleting-the-first-git-commit-and-resolving-rebase-issues-44ee</link>
      <guid>https://dev.to/chaitanyarai3/deleting-the-first-git-commit-and-resolving-rebase-issues-44ee</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Deleting the first commit in a Git repository and handling rebase issues can be tricky, especially when you end up in a situation where Git refuses to move back to a previous state. In this blog, we will address common scenarios related to deleting the first commit and resolving errors that occur during a rebase.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why Is Deleting the First Commit Challenging?
&lt;/h3&gt;

&lt;p&gt;The first commit in a Git repository is a unique entity. Since it’s the initial commit, there is no previous commit to revert to. Consequently, commands like &lt;code&gt;git reset --hard HEAD~1&lt;/code&gt; or &lt;code&gt;git reset --hard HEAD^&lt;/code&gt; result in errors like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This happens because Git cannot find a previous commit from which to reset. In this case, it’s essential to handle the situation differently.&lt;/p&gt;




&lt;h3&gt;
  
  
  Deleting the Only Commit from a Branch
&lt;/h3&gt;

&lt;p&gt;If you have just one commit and want to delete it completely, follow these steps:&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Navigate to Your Branch
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Delete the Commit
&lt;/h4&gt;

&lt;p&gt;To completely remove the commit, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git update-ref &lt;span class="nt"&gt;-d&lt;/span&gt; HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Clean Up Untracked Files (if needed)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clean &lt;span class="nt"&gt;-fdx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4: Push the Changes
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin master &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will clear the commit history, giving you a clean branch.&lt;/p&gt;




&lt;h3&gt;
  
  
  Resolving Git Rebase Errors
&lt;/h3&gt;

&lt;p&gt;Sometimes, while trying to delete or modify commits, you might end up in a rebase state. A common error message is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;On branch main
No commands done.
Next command to do (1 remaining command):
   noop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means your branch is stuck in a rebase, often because it was not completed or aborted correctly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Option 1: Complete the Rebase
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rebase &lt;span class="nt"&gt;--continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Option 2: Abort the Rebase
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git rebase &lt;span class="nt"&gt;--abort&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once completed or aborted, you can check the branch status again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Starting Fresh After Deleting Commits
&lt;/h3&gt;

&lt;p&gt;Once your branch is clean and the unwanted commit is gone, you can create a new initial commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit after cleanup"&lt;/span&gt;
git push origin master &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Deleting the first commit in Git can be tricky due to the lack of previous history. Understanding how to properly reset or update the branch is crucial to avoiding errors. Additionally, being familiar with rebase continuation and abort commands can help when your branch gets stuck. By following the steps outlined here, you can confidently manage your Git history without losing essential work.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitbash</category>
      <category>programming</category>
    </item>
    <item>
      <title>Step-by-Step: Creating a Custom Page Template in WordPress🧑‍💻</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Fri, 16 May 2025 14:15:51 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/step-by-step-creating-a-custom-page-template-in-wordpress-2bhf</link>
      <guid>https://dev.to/chaitanyarai3/step-by-step-creating-a-custom-page-template-in-wordpress-2bhf</guid>
      <description>&lt;p&gt;In WordPress, there are times when you might want a page that looks and functions completely differently from the rest of your site. A common use case is an Accessibility page that demands a specific layout, style, or behavior. This tutorial walks you through creating a &lt;strong&gt;custom page template&lt;/strong&gt; that uses a separate header and footer and unique styling.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🧩 Why Use a Custom Page Template?&lt;/strong&gt;&lt;br&gt;
Using a custom page template allows you to:&lt;/p&gt;

&lt;p&gt;Apply &lt;strong&gt;unique styling&lt;/strong&gt; to a specific page.&lt;/p&gt;

&lt;p&gt;Load &lt;strong&gt;custom JavaScript and CSS&lt;/strong&gt; independent of the main theme.&lt;/p&gt;

&lt;p&gt;Use &lt;strong&gt;different headers and footers&lt;/strong&gt;, which are useful for accessibility pages or landing pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ Step 1: Create the Custom Page Template&lt;/strong&gt;&lt;br&gt;
Navigate to your theme directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wp-content/themes/your-theme/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new file named:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;page-accessibility.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
/* Template Name: Accessibility Page */
get_header('accessibility');
?&amp;gt;

&amp;lt;div class="accessibility-content"&amp;gt;
    &amp;lt;h1&amp;gt;&amp;lt;?php the_title(); ?&amp;gt;&amp;lt;/h1&amp;gt;
    &amp;lt;?php the_content(); ?&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;?php get_footer('accessibility'); ?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧱 Step 2: Create Custom Header and Footer&lt;/strong&gt;&lt;br&gt;
Create two new files in your theme directory:&lt;/p&gt;

&lt;p&gt;`- header-accessibility.php&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;footer-accessibility.php`&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: header-accessibility.php&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html &amp;lt;?php language_attributes(); ?&amp;gt;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="&amp;lt;?php bloginfo('charset'); ?&amp;gt;"&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;?php wp_title(); ?&amp;gt;&amp;lt;/title&amp;gt;
    &amp;lt;?php wp_head(); ?&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;header class="accessibility-header"&amp;gt;
    &amp;lt;h1&amp;gt;Accessibility Page&amp;lt;/h1&amp;gt;
&amp;lt;/header&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧱 Create footer-accessibility.php&lt;/strong&gt;&lt;br&gt;
Add a matching footer for this layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;footer class="accessibility-footer"&amp;gt;
    &amp;lt;p&amp;gt;&amp;amp;copy; &amp;lt;?php echo date('Y'); ?&amp;gt; My Accessibility Page&amp;lt;/p&amp;gt;
&amp;lt;/footer&amp;gt;

&amp;lt;?php wp_footer(); ?&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🎨 Step 3: Enqueue Custom Styles and Scripts&lt;/strong&gt;&lt;br&gt;
Open your &lt;code&gt;functions.php&lt;/code&gt; and add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function accessibility_custom_scripts() {
    if (is_page_template('page-accessibility.php')) {
        wp_enqueue_style(
            'accessibility-style',
            get_stylesheet_directory_uri() . '/css/accessibility.css'
        );
        wp_enqueue_script(
            'accessibility-script',
            get_stylesheet_directory_uri() . '/js/accessibility.js',
            array('jquery'),
            null,
            true
        );
    }
}
add_action('wp_enqueue_scripts', 'accessibility_custom_scripts');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;📂 Step 4: Create CSS and JS Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In your theme directory:&lt;/p&gt;

&lt;p&gt;`- Create a css/ folder → Add accessibility.css&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a js/ folder → Add accessibility.js`&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example CSS (css/accessibility.css):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
    background-color: #f4f4f4;
    font-size: 18px;
}

.accessibility-header {
    background-color: #333;
    color: #fff;
    padding: 20px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example JS (js/accessibility.js):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener("DOMContentLoaded", function () {
    alert("Accessibility page loaded!");
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;📝 Step 5: Assign Template in WordPress&lt;/strong&gt;&lt;br&gt;
Go to your &lt;strong&gt;WordPress Dashboard&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate to &lt;strong&gt;Pages **→ **Add New&lt;/strong&gt; or edit an existing page&lt;/p&gt;

&lt;p&gt;In the right sidebar under &lt;strong&gt;Page Attributes&lt;/strong&gt; → &lt;strong&gt;Template&lt;/strong&gt;, select:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Accessibility Page
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Publish the page — and you're done!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;✅ Conclusion&lt;/strong&gt;&lt;br&gt;
By creating a &lt;strong&gt;custom page template&lt;/strong&gt;, you gain full control over the layout, styles, and functionality of specific pages on your site. This is incredibly useful for:&lt;/p&gt;

&lt;p&gt;`- Accessibility-specific content&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Landing pages&lt;/li&gt;
&lt;li&gt;Unique layout requirements`&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s a clean, modular approach that keeps your theme organized and maintainable.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>php</category>
      <category>programming</category>
    </item>
    <item>
      <title>SSH Error Explained: Permission Denied (publickey) — And How We Solved It 🔐</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Tue, 13 May 2025 08:04:13 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/ssh-error-explained-permission-denied-publickey-and-how-we-solved-it-kfl</link>
      <guid>https://dev.to/chaitanyarai3/ssh-error-explained-permission-denied-publickey-and-how-we-solved-it-kfl</guid>
      <description>&lt;p&gt;When trying to SSH into a newly created Linux server, you might run into a common error like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ssh user@your-server-ip
The authenticity of host 'your-server-ip' can't be established.
ED25519 key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Any other names do not know this key.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'your-server-ip' (ED25519) to the list of known hosts.
user@your-server-ip: Permission denied (publickey).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This error simply means: “SSH couldn’t find a valid key to authenticate you.”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ What Actually Worked&lt;/strong&gt;&lt;br&gt;
Instead of using just:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh ubuntu@your-server-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You used the correct approach by providing the private key file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i /path/to/your-key.pem ubuntu@your-server-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And &lt;strong&gt;this worked&lt;/strong&gt; — because the server was expecting authentication via a specific &lt;strong&gt;private key (.pem file)&lt;/strong&gt;, not a default key from &lt;code&gt;~/.ssh/id_rsa&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔍 Why This Happens&lt;/strong&gt;&lt;br&gt;
Cloud providers (like AWS, Google Cloud, Azure, etc.) often use &lt;strong&gt;key-based authentication only&lt;/strong&gt; for better security. When you create a VM or instance, you’re often required to either:&lt;/p&gt;

&lt;p&gt;Upload your public key, or&lt;/p&gt;

&lt;p&gt;Download a .pem file that matches the server's authorized key&lt;/p&gt;

&lt;p&gt;If you try to SSH without specifying the &lt;code&gt;.pem&lt;/code&gt; file, the SSH client defaults to using standard key files like &lt;code&gt;~/.ssh/id_rsa&lt;/code&gt;, which likely don’t match what the server expects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🛠️ How to Avoid This in the Future&lt;/strong&gt;&lt;br&gt;
You can either:&lt;/p&gt;

&lt;p&gt;Always specify the key manually with &lt;code&gt;-i&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;Add the key to your SSH agent so it's picked up automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-add /path/to/your-key.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🧠 Pro Tip&lt;/strong&gt;&lt;br&gt;
Make sure your .pem file has the correct permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 600 your-key.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This keeps your key file secure and prevents SSH from refusing to use it.&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>aws</category>
      <category>cli</category>
      <category>shell</category>
    </item>
    <item>
      <title>How to Create an AWS Account for Individuals: A 5-Step Guide</title>
      <dc:creator>Chaitanya Rai</dc:creator>
      <pubDate>Mon, 12 May 2025 16:53:26 +0000</pubDate>
      <link>https://dev.to/chaitanyarai3/how-to-create-an-aws-account-for-individuals-a-5-step-guide-3fkd</link>
      <guid>https://dev.to/chaitanyarai3/how-to-create-an-aws-account-for-individuals-a-5-step-guide-3fkd</guid>
      <description>&lt;p&gt;Amazon Web Services (AWS) is one of the most powerful cloud platforms in the world, enabling individuals and businesses to run everything from simple websites to complex machine learning applications. If you're just starting your cloud journey, the first step is setting up your own AWS account. This blog will walk you through how to create an individual AWS account in just five simple steps.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🚀 Step 1: Visit the AWS Sign-Up Page&lt;/strong&gt;&lt;br&gt;
Start by going to the &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;AWS homepage&lt;/a&gt; and clicking on the &lt;strong&gt;"Create an AWS Account"&lt;/strong&gt; button.&lt;br&gt;
Make sure to use a &lt;strong&gt;personal email address&lt;/strong&gt; that you have access to, as AWS will send important communications and verification emails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;👉 Tip:&lt;/strong&gt; Use an email you plan to keep long-term, especially if you want to build a portfolio or work on certifications.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🧑‍💻 Step 2: Enter Personal Account Details&lt;/strong&gt;&lt;br&gt;
In this step:&lt;/p&gt;

&lt;p&gt;Choose &lt;strong&gt;"Personal Account"&lt;/strong&gt; (not "Professional") when prompted.&lt;/p&gt;

&lt;p&gt;Fill in your &lt;strong&gt;full name, email address, and account name&lt;/strong&gt; (this can be anything; e.g., &lt;strong&gt;“CR AWS Playground”&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;Create a &lt;strong&gt;strong password&lt;/strong&gt; and confirm it.&lt;/p&gt;

&lt;p&gt;Click *&lt;em&gt;Continue *&lt;/em&gt; to proceed.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;💳 Step 3: Add Payment Information&lt;/strong&gt;&lt;br&gt;
AWS requires a &lt;strong&gt;credit or debit card&lt;/strong&gt; for account creation, even if you're only using free-tier services. Don’t worry — you won’t be charged as long as you stay within the free usage limits.&lt;/p&gt;

&lt;p&gt;Enter your &lt;strong&gt;card details&lt;/strong&gt; and &lt;strong&gt;billing address&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;AWS may place a &lt;strong&gt;temporary $1 charge&lt;/strong&gt; to verify your card, which will be refunded shortly.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;☎️ Step 4: Identity Verification&lt;/strong&gt;&lt;br&gt;
Next, AWS will verify your identity via &lt;strong&gt;SMS or a phone call:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Select your country code and enter a phone number.&lt;/p&gt;

&lt;p&gt;Choose either &lt;strong&gt;text message or a voice call.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Enter the &lt;strong&gt;verification code&lt;/strong&gt; you received.&lt;/p&gt;

&lt;p&gt;Once verified, click &lt;strong&gt;Continue&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🛠️ Step 5: Choose a Support Plan and Sign In&lt;/strong&gt;&lt;br&gt;
AWS offers several support plans. For individual use or learning:&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Basic Support Plan&lt;/strong&gt; (which is free).&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Complete Sign Up&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Once your account is created, you’ll be directed to the &lt;strong&gt;AWS Management Console&lt;/strong&gt; where you can sign in with your new credentials and start using services like EC2, S3, and Lambda.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;✅ You're All Set!&lt;/strong&gt;&lt;br&gt;
Congratulations! You now have your own AWS account. From here, you can explore services, start small projects, or follow along with tutorials to learn more about cloud computing.&lt;/p&gt;

&lt;p&gt;If you're new to AWS, here are a few great starting points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS Free Tier page:&lt;/strong&gt; See what you can use for free&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Educate or Skill Builder:&lt;/strong&gt; For free learning resources&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create your first EC2 instance or S3 bucket&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Tip:&lt;/strong&gt; &lt;code&gt;Always keep an eye on the Billing Dashboard in the AWS Console to make sure you’re not accidentally incurring charges.&lt;/code&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
      <category>cloud</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
