10

How can i fix this php error?

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/php_pdo_mysql.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/php_pdo_mysql.dll, 9): image not found in Unknown on line 0

I am on a mac/mavericks and I have made a mistake and did a sudo cp /private/etc/php.ini.default /private/etc/php.ini so now I get the error stated above when I run php -v

1
  • 2
    that path suggests you're on a Unix system, but are trying to load a Windows .dll. Good luck getting that to work... Commented Mar 13, 2014 at 16:23

4 Answers 4

3

Follow this as it worked for me...

The error coming for me was:

$ sudo php -v
# PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/phalcon.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/phalcon.so, 9): image not found in Unknown on line 0
# PHP 5.5.14 (cli) (built: Sep  9 2014 19:09:25) 
# Copyright (c) 1997-2014 The PHP Group
# Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

Run this as root:

$ locate phalcon.so
# /opt/local/lib/php55/extensions/no-debug-non-zts-20121212/phalcon.so

Run this also as root:

$ cp -rp /opt/local/lib/php55/extensions/no-debug-non-zts-20121212/phalcon.so /usr/lib/php/extensions/no-debug-non-zts-20121212/

Just edit the directories as they might differ for you.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your reply! When I had this error there were no available answers to my question. So I included above the steps I did and fixed the problem. But anyway, this looks as another workaround!
1

Originally, I followed these step-by-step guides to set up apache, php, mysql, etc and and get my localhost working:

  1. http://brianflove.com/2013/10/23/os-x-mavericks-and-apache/
  2. http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/

Then, I accidentally replaced my php.ini file and got the error stated above in the question. Actually, at first I got the mcrypt missing error.

So, after fixing all of these, I had few things left to do in the php.ini file:

  1. Declared mcrypt like this: extension=mcrypt.so

  2. Uncommented the extension_dir line and added: extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20100525/"

  3. I commented out the line: extension=php_pdo_mysql.dll

  4. Done a sudo apachectl restart

Finally, everything works as is expected.

Comments

0

In the php.ini file, if you had a unique extensions folder as required in macOS Sierra, make sure the extensions directory read like:

extension=/usr/local/lib/php/extensions/mcrypt.so

It's easy to forget to add the first "/"

2 Comments

This issue was addressed when I was on Mavericks!
I've been having the same problem now. I'm trying to get a CodeIgniter project running.
0

If you're using last OS version on 2025:(ie Sequoia), following this medium article can solve your issues. Using Homebrew to install PHP seems to be not the easiest way.

You can find here the curl command to launch for a proper Laravel environment installation with PHP.

/bin/bash -c "$(curl -fsSL https://php.new/install/mac)"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.