PHP Warning: Unable to load dynamic library

Good. I have PHP running on my mac os x Apache 2 server. The problem I am facing cannot find extensions that allow me to connect to the sqlite database.

extension = php_sqlite.dll extension = php_pdo_sqlite.dll extension = php_sqlite3.dll 

I am getting this error now when I uncommented these extensions.

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

This is the same mistake for all 3.
Now I read in various places on the Internet that it may be that they are not installed on my Mac, but I can not find the PHP directory or wherever they are! I am very new to this, so any help would be great Disco

+6
source share
2 answers

The DLL extension you included is valid for Windows. On Mac and other * nix platforms, they are actually SO files.

I am on a Mac and it seems that the SQLite modules are already loaded. You should be able to comment on these lines in your php.ini , restart Apache and use SQLite without doing anything. SQLite modules have been enabled as long as I remember.

If it really is not included, you will have to compile the modules from the source. To do this, you must install Apple Developer Tools .

Compile from scratch (from the command line):

  • Download the PHP source code . You need to download the one that matches the version already installed on your system. To find out which one you are using, enter php -v from the command line.
  • Extract the archive you downloaded using tar -zxvf followed by the file name.
  • Type cd php-5.3.x/ext/sqlite3/ (where "5.3.x" should be replaced by your version number, and "sqlite3" can be any of the modules that you want to install from your list higher than the "php_" prefix) .
  • Enter phpize .
  • Type ./configure .
  • Type make .
  • Type sudo make install .
  • Add extension=sqlite3.so to your php.ini (make sure again that sqlite3.so replace the name of the other extensions if you compile the rest).

Finally, restart Apache, and you should be done.

+13
source

Open php.ini. Find the line that locates your extensions. In my case (Windows machine) it looks like this:

extension_dir = "C:\xampp\php\ext"

This gives you a place where all your extensions are located. Open it and check if the SQLite extensions really exist.

Also, make sure your extensions are actually for the Mac. Their extension should be "dylib" or perhaps "so" (not sure - I don’t have a Mac), and "dll" is the Windows Dynamic Library File Name Extension (AFAIK).

0
source

Source: https://habr.com/ru/post/891654/


All Articles