Skip to main content

PHP Error: Unable to load dynamic library 'gd'

Currently installing Laravel on my Arch Linux.

I got PHP, MySQL, Apache and Composer installed and trying to install Laravel with this:

$ composer global require laravel/installer

 But got this instead:

PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: /usr/lib/php/modules/gd (/usr/lib/php/modules/gd: cannot open shared object file: No such file or directory), /usr/lib/php/modules/gd.so (/usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Warning:  PHP Startup: Unable to load dynamic library 'openssl.so' (tried: /usr/lib/php/modules/openssl.so (/usr/lib/php/modules/openssl.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/openssl.so.so (/usr/lib/php/modules/openssl.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Warning:  PHP Startup: Unable to load dynamic library 'phar.so' (tried: /usr/lib/php/modules/phar.so (/usr/lib/php/modules/phar.so: cannot open shared object file: No such file or directory), /usr/lib/php/modules/phar.so.so (/usr/lib/php/modules/phar.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Warning:  Phar::mapPhar(): open_basedir restriction in effect. File(/usr/bin/composer) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/) in /usr/bin/composer on line 28 PHP Warning:  require(phar://composer.phar/bin/composer): Failed to open stream: phar error: invalid url or non-existent phar "phar://composer.phar/bin/composer" in /usr/bin/composer on line 29 PHP Fatal error:  Uncaught Error: Failed opening required 'phar://composer.phar/bin/composer' (include_path='.:') in /usr/bin/composer:29 Stack trace: #0 {main}   thrown in /usr/bin/composer on line 29
And so I have six errors and I'll be going through all of them one by one. I decided to document it here as a journal which can serve as a note for the future.

First up is the "Unable to load dynamic library 'gd'". 

This means "there's something wrong with gd.

What can we do?
  1. Back up libgd.so first.
  2. Restart server and install again
What is libgd.so? It's a GD Graphics library in a shared object file
  • lib is for library
  • gd is for GD Graphics or GIF Draw graphics
  • .so is an extension name for shared objects file
So the error message is saying that it's unable to load the shared object. I checked the folder and it's not there. Next is to download and install: 

$ sudo pacman -S php-gd

Then restart httpd.service.

Installed Laravel again and the error message is gone, but not all. 

So on to the next one.

Popular

Prompt Analysis Using First-Principles Thinking (FPT)

Instead of memorizing existing prompt patterns, let’s break down Prompt Analysis from First-Principles Thinking (FPT) —understanding what makes a prompt effective at its core and how to optimize it for better AI responses. Step 1: What is a Prompt? At its most fundamental level, a prompt is just: An input instruction → What you ask the AI to do. Context or constraints → Additional details that guide the response. Expected output format → Defining how the AI should structure its answer. A well-designed prompt maximizes relevance, clarity, and accuracy while minimizing misunderstandings. Step 2: Why Do Prompts Fail? Prompts fail when: ❌ Ambiguity exists → The model doesn’t know what’s truly being asked. ❌ Lack of context → Missing background information leads to weak responses. ❌ Overloaded instructions → Too many requirements confuse the AI. ❌ Vague output expectations → No clear structure is provided. ❌ Incorrect assumptions about AI behavior → The prompt d...

Process Design & Workflow Optimization Using First-Principles Thinking (FPT)

Instead of copying existing process frameworks, let’s break down Process Design & Workflow Optimization from first principles —understanding the core problem it solves and building efficient workflows from the ground up. Step 1: What is a Process? At its most fundamental level, a process is just: Inputs → Resources, data, materials, or people. Actions → Steps that transform inputs into outputs. Outputs → The final result or outcome. A process is optimized when it minimizes waste, reduces friction, and improves efficiency without compromising quality. Step 2: Why Do Processes Become Inefficient? Processes break down when: ❌ Unnecessary steps exist → Extra approvals, redundant checks, or outdated rules. ❌ Bottlenecks appear → A single point slows down the entire system. ❌ Lack of automation → Manual tasks take too much time. ❌ Poor data flow → Information is siloed or delayed. ❌ Overcomplicated workflows → Too many dependencies and unclear roles. To fix i...

rhymin

i got stuck with words on this song that i want to finish by tomorrow. i have no instrument to use so im hoping to finish at least the lyrics. sad part is my rhyming brain is not that functional right now. so, i headed online to look for some sites or software that can help. here's what i got: analogx.com 's rhyme came to mind first as it's what i used before. a simple to install software that returns numerous results that, most of the time, ends up confusing. good thing is you can use it offline. so i started searching. 3d2f and the next one got my attention. but let me pour my heart out on this one first. one word: confusing! it gave me more list to figure out. so click on the first. then it lead me to several pages before i get to download. then, i have to figure out which of the links i needed. then after few minutes, i found it only to be more confused... i am to download a 249MB of a .dmg which turned out to be for mac engines and not for windows. i know, right?! w...