How to resolve the issue of "dyld: Library not loaded:" while installing PHP on macOS?

I'm currently facing an issue while installing the most recent version of PHP on my Mac. I attempted the following:

brew install php72 --force

Afterward, when I wanted to verify the installed version, I encountered this error:

localhost:regagents davea$ php --version
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/Cellar/php72/7.2.1_12/bin/php
  Reason: image not found
Abort trap: 6

Hence, I decided to reinstall readline, or so I believe...

 localhost:regagents davea$ brew reinstall readline
==> Reinstalling readline 
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/davea/Library/Caches/Homebrew/downloads/c0566e677ba9f92c270590e2d8132f95668817a7817d2ee47711ff3c2ff045d6--readline-8.0.0.high_sierra.bottle.tar.gz
==> Pouring readline-8.0.0.high_sierra.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/readline/8.0.0: 48 files, 1.5MB

However, despite the reinstallation, executing "php -version" continues to produce the same error message. What could be the reason for this? How can I successfully install and run PHP on my Mac?

Answer №1

It seems that your current version of php is linked against readline 7, but you actually have readline 8 installed. To resolve this issue, it is recommended to update php. The most up-to-date package available is php72 version 7.2.17_1, which can be installed through homebrew.

brew update
brew upgrade php72

If you prefer to use the latest release, you can install php package version 7.3.4 using the following command:

brew install php

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Trouble getting PHP and AJAX FormData to communicate with each other

I'm completely baffled! Ajax doesn't seem to be sending the file to PHP, and I can't figure out why. Can anyone make sense of this? Here is the code snippet: ----- HTML ----- <input id="mmSelectedDoc" name="selectedFiles[]" type="file" ...

What is the best way to create a unique collection that highlights the most frequently occurring data points?

I have a table setup as shown below: https://i.stack.imgur.com/erxnt.png This particular table is designated as favourite_products and holds product ids that users have marked as favorites. My goal is to retrieve a list of the most frequently favorited ...

The submitted form did not come from the anticipated source on the EC2 server

Recently, I began the process of migrating a PHP zend based web application to AWS EC2 as I am new to PHP. However, upon trying to log in to the site after completing the migration, I encountered the following error: The form submitted did not originate fr ...

Verifying the existence of a node in PHP/XML

I have a structured XML document that looks something like this: <items> <item> <seller></seller> <itemname></itemname> and so on... </item> </items> My goal is to extract da ...

Using Codeigniter to paginate JSON array outputs from a REST API

Is it possible to implement pagination for a JSON array response in a CodeIgniter REST API controller? Can the controller's index_get function be modified to accept two variables (one for the controller function and one for the page number for paginat ...

Creating personalized flash messages in CakePHP

I recently came across a feature in the CakePHP Book where you can create your own customized setFlash messages using an element. However, I'm unsure of what to include inside the element and how to pass different content. For instance, let's sa ...

Incorporating Bootstrap Content: A Guide to Including a PHP File within Another PHP File

I am encountering an issue when trying to import a PHP file containing my navigation bar into another PHP file. Here's the code for the navigation file: <?php echo " <html> <head> <nav class = "navbar navbar-default navbar-fixed-top ...

Why is it that the image is not showing up even though I have correctly input the full pathway into the database?

view image here Any issues with the path for the image? If so, how can a valid image path be written in a MySQL database using PHP? Please note that the image shown above contains the column for images with paths such as C:/wamp/www/phpT/images/products/m ...

Ways to verify an array object and an array

Primary list: [VariationSpecificsSet] => SimpleXMLElement Object ( [NameValueList] => Array ( [0] => SimpleXMLElement Object ( ...

What is the extent of a PHP function encapsulated within a PHP anonymous function?

Query Suppose I implement the following code: $checkName = function ($value) use ($min, $max) { function lengthTest($string, $min, $max) { $length = mb_strlen($string, 'UTF-8'); return ($length >= $min) && ($ ...

Following the implementation of the YITH ajax navigation filter, my jQuery scripts are no longer functioning as

I'm having trouble with using yith ajax navigation in my theme. Everything works perfectly until I click on an element to filter, at which point my jquery codes stop working. The team at yith suggests: If your product list contains JavaScript cod ...

Tips for previewing selected image files before uploading them in Laravel Nova 4

How can I display a preview of the image selected before submitting the form in Laravel Nova 4? # App/Nova/Image.php /** * Get the fields displayed by the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request ...

What is the best way to retrieve the parameter of ng2-file-upload using endback?

I am attempting to retrieve a parameter using PHP in order to save it into a folder. However, my code is not working as expected. Here is the code snippet: Using the Ionic framework this.uploader.onBeforeUploadItem = (item: any) => { this.uploader ...

Establishing a Secure Connection between PHP Server and Amazon AWS MySQL Server

Currently, I have set up two servers on Amazon AWS. One server is dedicated to running PHP while the other handles MySQL. Accessing the MySQL database through my terminal and MySQL Query Browser has proven successful. However, I am facing challenges in es ...

Utilize either local file storage or a remote server as a serving alternative

For the purpose of development, security is not a top concern. Here's the scenario: Assets are served from assets.example.com The local development environment is trying to access files from localhost.assets.example.com instead We want to synchroniz ...

Submitting multiple forms using AJAX and PHP

I am currently trying to send the form data to another page for processing, but I am not receiving any data. Below are the forms in question: The default form is the login form for requesting a username and password, with only one submit button. ...

Looking to fetch JSON data from a private IP that is not accessible to the public

Is there a way to retrieve JSON data from a location that is only accessible within a company's firewall? The address I am trying to access is: http://12.34.56.789:8983/app/collection/select?q=*%3A*&wt=json&indent=true My application can be ...

Connecting Models in CakePHP

As a beginner in using cakephp, my goal is to display a list of all subjects belonging to a specific subject category. I have created a Subject model with the following code: subjects.php <?php class Subject extends AppModel { var $name='Subject ...

struggling to find the precise value in the array

my original result is displayed below: [status] => 1 [schedule_status] => 1 [cid] =>3 [cdate] => 16-10-18 01:10:52 [did] => 16 [jid] => 4 However, when I try to extract individual array values using the following code: $count = count($ ...

sending an array from Javascript to PHP

Utilizing JavaScript, I have successfully converted data from a file into an array. Now, my goal is to utilize input from a form to search through this array using PHP and present the results in a table. Despite browsing various solutions for similar probl ...