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

White Paper: The Agile Transportation System (ATS) – AI-Driven, Routeless, and On-Demand Mobility

  Abstract / Executive Summary The Agile Transportation System (ATS) is a next-generation urban mobility solution that leverages Artificial Intelligence (AI) to revolutionize transportation. Unlike traditional public transit with fixed routes and rigid schedules , ATS operates on an AI-powered routeless model that dynamically adapts to commuter demand. It also integrates an intelligent passenger selection system to optimize seating, prevent congestion, and enhance accessibility. Designed initially for Bonifacio Global City (BGC), Philippines , ATS ensures on-demand scheduling, flexible vehicle deployment, and 24/7 availability . By incorporating AI-powered analytics, predictive algorithms, and real-time optimization , ATS offers a truly agile, scalable, and commuter-centric transportation system. Introduction Urban mobility is facing major challenges, including traffic congestion, inefficient public transport, and long waiting times . Traditional public transit operates on pred...

Retrieval-Augmented Generation (RAG) Using First-Principles Thinking

Instead of just learning how Retrieval-Augmented Generation (RAG) works, let's break it down using First-Principles Thinking (FPT) —understanding the fundamental problem it solves and how we can optimize it. Step 1: What Problem Does RAG Solve? Traditional AI Limitations (Before RAG) Large Language Models (LLMs) like GPT struggle with: ❌ Knowledge Cutoff → They can’t access new information after training. ❌ Fact Inaccuracy (Hallucination) → They generate plausible but false responses. ❌ Context Limits → They can only process a limited amount of information at a time. The RAG Solution Retrieval-Augmented Generation (RAG) improves LLMs by: ✅ Retrieving relevant information from external sources (e.g., databases, search engines). ✅ Feeding this retrieved data into the LLM before generating an answer. ✅ Reducing hallucinations and improving response accuracy. Core Idea: Instead of making the model remember everything, let it look up relevant knowledge when needed....

Agile Transportation System (ATS) Values and Principles

Here’s a draft of the Agile Transportation System (ATS) Values and Principles. ATS Core Values Adaptability Over Rigidity - ATS prioritizes flexible route adjustments and dynamic scheduling based on real-time demand rather than fixed, inefficient routes. Availability Over Scarcity - There should always be an ATS unit available when and where it's needed, reducing wait times and ensuring continuous service. Efficiency Over Redundancy - Every unit must maximize passenger load without compromising speed and convenience, ensuring an optimal balance of utilization. Simplicity Over Complexity - Operations should be straightforward, avoiding unnecessary bureaucracy and ensuring seamless passenger movement. Continuous Improvement Over Static Systems - ATS evolves based on data and feedback, refining operations to enhance reliability and customer satisfaction. Customer Experience Over Just Transportation - The system is not just about moving people; it's about making their journe...