I am just curious about the process of installing an extension because I am trying to install php's uploadprogress extension on Ubuntu. I have a default php installation in my usr/ directory, but I have a XAMPP server set up (separate php apache mysql package) in another location in /opt. This is the installation I use for testing.
When I use the command pecl install uploadprogress, the extension installs automatically to the /usr directory. As a test I took the uploadprogress.so file out of the /usr directory php location and put it in the opt location where my XAMPP installation is. I then modified the php.ini for my XAMPP installation and put the extension in. When I ran phpinfo() it showed uploadprogress as installed, however when uploading a file, the uploadprogress function returns null.
My question is, when a php extension is installed, what processes are done, and what files are created and modified? If I manually download the uploadprogress.tgz and manually compile, it still installs to the default directory of /usr/local/php5/ext and I figure there must be more done then just a .so file created in the extension directory. How can I change the location that the extension installs to? I want to have the extension available to my other XAMPP installation in /opt.
My question is, when a php extension is installed, what processes are done, and what files are created and modified?
That depends on the extension, but normally there is the building and compilation of the extension. Temporary files are created, the configuration could getting modified and the actual module file (.so/.dll) is getting written (at least).
Keep in mind that some modules require certain settings in php.ini before they work. If you have copied over only the .so file then you should copy over the relevant part of the php.ini as well.
How can I change the location that the extension installs to?
You normally compile it for the location you want to install it to. If the default location is not the location you want it to be, you can try to specify the output directory in the build process, and there is php-config.
You want to run configure --help to see what options it gives to you to compile the extension and to look for the install directory path option. Maybe this answer helps you with pecl How do you change the default Pear/PECL build folder from /var/tmp?. A .so file is a special standalone library. It's stripped from any linkage and is basically an object file.
Related
I am using php7 in my project. I have enabled intl in php.ini file by un-comment the following line.
;extension=php_intl.dll
Then copied ic*.dll file from php folder to apache/bin folder. Also I have checked the Environment Variables.
All are correct, but still it shows error
PHP - INTL Extension is missing.
Please help me. How can i solve this.
Cause:
If you have installed the unbundled PHP version, the extension is not installed on the system. (unless you’ve installed it separately)
If you have the bundled PHP version, the extension might be existing but not enabled.
Make sure the php_intl.dll file exists within your php extensions directory
for separately installed PHP: C:\path\to\php\ext\
for xampp: C:\path\to\xampp\php\ext
(note: your drive letter might be different)
If the file exists:
Search for the config file (php.ini, usually in the same folder as the php executable) and open it
Make sure the line “extension=php_intl.dll” is existing and not commented
Restart the web server (usually apache)
Check if the extension is enabled using phpinfo()
If the file doesn’t exist:
Check your php version by running the “php -v” command
Download the PHP version that corresponds to yours from the PHP Downloads Page (TS/NTS, x86/x64)
To find thread safety for php, run: php -i | findstr “Thread” , source & more info.
Search for the php_intl.dll file in the ext folder in that version and copy it in your php\ext folder
Repeat the steps for the case in which the file exists
Edit: changed php7.0 occurrences with php7.x as the version may vary.
For more information about the solution, check link.
Apparently, the .dll file is missing from your system.
Please check this link to download and install your PHP intl extension. Also do check, whether they are pointing at the right directories.
Hope this will solve your problem.
I've been having some issues with phpmyadmin suddenly not cooperating with my php configuration, so I decided to reinstall php7 and phpmyadmin from the latest stable tar file on their respective websites.
(Edit: Here is a link to the issue that this is a sub-issue of: phpmyadmin Error with php7: Missing json extension)
When I uninstalled php7 (which was originally installed via this ppa: ondrej/php)
then reinstalled it via the tar file, the php files went into usr/lib instead of etc/ which I understand to be the default php directory. Why are they being installed in usr/lib now?
Also, when I check this new directory, it seem to be missing php.ini and the apache2 service directory that php usually ships with. Why is this? Do I have to install these separately now?
In short: Why does installing php7 from a tar file have such different defaults than the apt install of php5, and what can I do to make sure that something like phpmyadmin can understand and use this install of php7?
Thanks for any input.
If you compile from source, there are various configuration options to determine where files go. The defaults for configure are not necessarily the defaults for a rpm or deb package.
Along with the PHP configure options: http://php.net/manual/en/configure.about.php, you have GNU general configuration options like --prefix to determine the install directory or --sysconfdir to determine the system configuration directory.
See all the options here: https://gcc.gnu.org/install/configure.html
--prefix=dirname
Specify the toplevel installation directory. This is the recommended way to install the tools into a directory other than the
default. The toplevel installation directory defaults to /usr/local.
--exec-prefix=dirname
Specify the toplevel installation directory for architecture-dependent files. The default is prefix.
--bindir=dirname
Specify the installation directory for the executables called by users (such as gcc and g++). The default is exec-prefix/bin.
--libdir=dirname
Specify the installation directory for object code libraries and internal data files of GCC. The default is exec-prefix/lib.
--libexecdir=dirname
Specify the installation directory for internal executables of GCC. The default is exec-prefix/libexec.
--with-slibdir=dirname
Specify the installation directory for the shared libgcc library. The default is libdir.
--datarootdir=dirname
Specify the root of the directory tree for read-only architecture-independent data files referenced by GCC. The default is
prefix/share.
--infodir=dirname
Specify the installation directory for documentation in info format. The default is datarootdir/info.
--datadir=dirname
Specify the installation directory for some architecture-independent data files referenced by GCC. The default is
datarootdir.
I run a PHP script and get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0
What does that mean?
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
If you're on Linux, you can find all loaded configuration files by typing this in shell:
php -r "print phpinfo();" | grep ".ini"
UPDATE:
As mentioned in comments, this can be even more accurate:
php -i | grep ini
phpStom with XAMPP
TL;DR Except from verifying that the files exist, you might need to add the drive letter to some records in your php.ini file
I suddenly started having a problem using phpStorm 7 for debugging php with xampp and xdebug. When trying to set intellij interperter to be xampps php I got a lot of the warnings like the one in the question, for example:
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
For some reason I had to add my drive letter to the records of extension_dir and browscap in the php.ini file:
extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"
to
extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"
If you just want to make the error disappear, and you don't need the extension, then by all means comment the line out in php.ini. But if you actually want to fix the problem here is some additional info.
There are various causes for this based on the exact module, but there are also some general guidelines.
Open phpinfo() and look for extension_dir under the Core section. This is where your modules should be located.
For instance, /usr/lib/php/modules for Unix/Linux.
If the file does in fact exist, make sure permissions are adequate.
If the file does not exist, use the resources below to install it.
Installation on *nix (PEAR)
Installation of extensions on Windows
Loading .dll in Linux
I've encountered this warning message while I was trying to install a php-extension via the php.ini file;
until I figured out that you cannot load .dll extensions in Linux,
but you have to comment the extensions that you want to import ;extension= ... .dll and install it correctly via sudo apt-get install php-...
note: ... is the extension name you want to enable.
php -r "echo php_ini_loaded_file();"
Will show in CLI current ini loaded file, search there for Your extension, path to it is incorrect.
In my case, this message started to appear when I updated the php version to 7.4.
To solve it I had to look for the php.ini files found inside the php version folder (/etc/php/7.4/apache2/ && /etc/php/7.4/cli/) checking the lines where the extensions I could see that the extensions gd2 and intl were uncommented.
Note that you can also get this error if your PHP library doesn't have the "other" directory opening permission. In my particular case, I noticed this when using php -l to syntax check a script in my text editor. This meant that since my account was called "volomike", that account didn't have permission to run the libraries that the php command relied upon.
For instance, on Ubuntu 14.04, I had PHP5 installed automatically into the path /usr/lib/php5/20121212+lfs. However, because I was working in C++ in building some shared objects, I messed around with the directory permissions and screwed things up such that non-root accounts did not have the directory execute (directory open) permissions to view /usr/lib/php5/20121212+lfs. So, I typed the following command to rectify that problem:
sudo chmod o+x /usr/lib/php5/20121212+lfs.
Now when I do php -l example.php as a non-root user, it never gives me this "Unabled to load dynamic library" problem anymore.
I had the same problem on XAMPP for Windows when I try to install composer.
I did php -v and php throwing error :
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
It took me a while until I realized that I need to setup my XAMPP. So I run setup_xampp.bat and php return to works like a charm.
I had this error on a number of modules when I had been running different versions of PHP side by side on my server. To sort this out, I needed to install the packages it couldn't find for that specific PHP version. So, for example, if I saw:-
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'
I would install the library for the PHP version specifically:-
sudo apt-get install php7.1-xml
And then restart Apache. Fixed it for me. You can check your version like this:-
php -v
I had the same problem on XAMPP for Windows10 when I try to install composer.
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
Then follow this steps
just open your current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini in texteditor (like notepad++)
now just find - is the current_xampp_containing_drive:\xampp exist?
if not then find the "extension_dir" and get the drive name(c,d or your desired drive) like.
extension_dir="F:\xampp731\php\ext" (here finded_drive_name_from_the_file is F)
again replace with finded_drive_name_from_the_file:\xampp with current_xampp_containing_drive:\xampp and save.
now again start the composer installation progress, i think your problem will be solved.
What I did was;
1 - I first find out what version of PHP I am using thru the function phpinfo()
<?php
phpinfo();
?>
2 - From there you will find the location of your configuration(php.ini) file
3 - Open that file
4 - Comment out the line similar to the image below
This might be a different value but it should be related to extension.
I am no expert but this process helped me solved similar problem.
In my case I got this error because I downloaded a thread-safe version of the dll (infixed with -ts-), but my installation of php was a non-thread-safe (infixed with -nts-). Downloading the right version of the dll, exactly matching my php installation version fixed the issue.
After Windows 10 XAMPP now I installed LAMPP (XAMPP) on Ubuntu. Windows XAMPP had a lot less to configure compare to MAC (iOS) but now with Linux Ubuntu I had a few more since there are more going in Linux (a good thing).
I confused and activated mysqli.dll (and mysql.dll: erase "#" in /etc/php/7.2/cli/php.ini
I started to get the PHP Warning: PHP Startup: Unable to load dynamic library message related to dll. I commented out mysql(and i).dll in the same file but the message didn't go away up until I commented out " " in /opt/lampp/etc/php.ini.
Looks like XAMPP reads php.ini file from /etc/php/7.2/cli and makes modification in php.ini of /opt/lampp/etc. (;extension=php_pdo_mysql.dll after ";" restarted Apache and no more any message.
I encountered a similar error. The mistake I made was to use the "controller" name as "Pages" instead of "pages" in my url.
In Windows, it could be a wrong path in "System environment variables".
"Path" to the php.exe directory must be the good one.
'C:/PHP/5.2.13/ext\php_mcrypt1.dll'
I'd say there's some typo on your php.ini (the extra 1). Perhaps you're loading a different php.ini from what you expect (see the output of php.ini to make sure).
Other than that make sure that php_mcrypt.dll and PHP:
Were linked to the same VC runtime library (typically msvcrt.dll for VC6 or msvcrt90.dll for VC9) – use e.g. the dependency walker for this
Are both debug builds or both release builds
Both have ZTS enabled or ZTS disabled
For libraries that depend on further libraries (DLLs), make sure they are available (e.g. in the same directory as the extension)
PHP should give you meaning errors if any of the first three conditions above is not satisfied, but I wrote those anyway because I'm not sure for PHP 5.2.
From C:\xampp\php\php.exe I got
Unable to load dynamic library ''
C:\xampp\php\ext\php_.dll (The specified module could not be found.)
I solved by commenting out
C:\xampp\php\php.ini
;extension=
I had the same problem when I tried to use php with sql server, when I added the sqlsrv libraries ... it gave me the error, after several days of researching there, I understood that microsoft does not support x64 in this case so what I did was install laragon x86 and use the corresponding libraries. I hope it helps with something
Go to system env variable and set the php ext dir path as
C:\xampp\php\ext
basically it's finding the ext directory and then locating it's file but it's unable to find the files becuase php path is set as different.
Follow-up from my post yesterday (Enabling cURL with PHP)
The problem is that PHP isn't able to load php_curl.dll. I've tried several steps including uncommenting extension=php_curl.dll, making sure the dependencies libeay32.dll and ssleay32.dll eixst in the path, re-downloading php_curl.dll, replacing the old one, and lastly copying the file into my System32 folder.
I'm using Apache 2.2 and PHP 5.4.14. I installed both using their individual packages; I'm not using XAMP or WAMP. I'm using Windows 7 64-bit.
Any help at all would be appreciated.
libeay32.dll and ssleay32.dll have to be path-accessible for php_curl.dll loading to succeed.
But copying them into Apache's ServerRoot, Apache's \bin\, Window's \System32\, or even worse into the Windows main directory is a bad hack and may not even work with newer PHP versions.
The right way to do it is to add the PHP path to the Windows Path variable.
In Control Panel -> System click on Advanced System Settings or press WIN+R and type SystemPropertiesAdvanced
Click the button Environment Variables.
Under System Variables you will find the Path variable. Edit it and prepend C:\PHP; to it - or whatever the path to your PHP folder is.
(Hint: If your PHP folder contains spaces like C:\Program Files\PHP you may need to use the short filename form here, i.e. C:\Progra~1\PHP.)
Then fully stop Apache and start it again (a simple restart might not be enough).
Update 2017-05:
I changed the instructions above to prepend the Path variable with the PHP path instead of appending to it. This makes sure that the DLLs in the PHP path are used and not any other (outdated) versions in other paths of the system.
Update 2018-04:
If you have already chosen the wrong way and copied any of the PHP DLLs to Apache or Windows paths, then I strongly recommend that you remove them again! If you don't, you might get into trouble when you later try to update PHP. If a new PHP version brings new versions of these DLLs, but your old DLLs still linger around in system or webserver paths, these old DLLs might be found first. This will most certainly prevent the PHP interpreter from starting. Such errors can be very hard to understand and resolve. So better clean up now and remove any of the mentioned DLLs from Windows and Apache paths, if you copied them there.
(Thanks to #EdmundTam and #WasimA. for pointing out this problem in the comments!)
Update 2019-10:
Tip: To find all copies of these DLLs and check whether you might have placed them in the wrong folders, you can use the following commands in a Windows Command Prompt window:
dir c:\libeay32.dll /s
dir c:\ssleay32.dll /s
Be warned that these commands may take some time to complete as they search through the entire directory structure of your system drive C:.
Update 2020-08:
If your PHP folder contains spaces (i.e. C:\Program Files\PHP) you may need to use the short filename form in the Path variable at step 3 (i.e. C:\Progra~1\PHP). Thanks to #onee for this tip!
In PHP 5.6.x version You should do the following:
Move to Windows\system32 folder DLLs from php folder:
libssh2.dll, ssleay32.dll, libeay32.dll and php_curl.dll from php ext folder
Move to Apache24\bin folder from php folder:
libssh2.dll
Also, don't forget to uncomment extension=php_curl.dll in php.ini
WINDOWS Apache 2.4.x + PHP 7.0.x SOLUTION HERE:
Solution: Put libeay32.dll, libssh2.dll, ssleay32.dll files under dir specified in httpd.conf's ServerRoot directive. These dlls can be found compiled under php root folder.
Reasons:
Problem is php_curl.dll requires to access following libraries while loading: libeay32.dll, libssh2.dll, ssleay32.dll and it does not make sense if you put them in ./php/ext dir or if you put PHP extensions in PHP root dir.
Of course you can put them in C:\Windows or in some global folder defined in PATH but if you don't want to do this and you want that your apache+php installation was portable:
The path specified in ServerRoot in httpd.conf is treated as home path for php. The behaviour is similar to situation where you include ./path/to/some.php file in ./index.php and home path for some.php file is still ./ the dir where index.php resides.
In shorts just put those three dlls right in dir you specified in httpd.conf ServerRoot directive and php_curl.dll will not fail to load again.
You are loading .dll so your OS has to be windows.
First check which php.ini file you are using by running phpinfo()
Then check where your extensions folder is by checking extension_dir attribute in that file.
Next make sure that php_curl.dll is present in that folder. If not copy it over.
Restart apache and check if it works.
Since you installed packages individually, also do this:
Copy the dll file from php_installation_folder/extensions to apache_installation_folder/bin
Usually this is an OpenSSL version mismatch error, between Apache and PHP. In case Apache loads PHP as a DSO module, its own OpenSSL versions (dlls and libs) will be used. So, in case the PHP extension requires a newer version, it may not find the appropriate interface inside the Apache-loaded DLLS and it will fail to work.
Since you need the PHP extension to load, you need the relevant DLL files to be at least the version of what the PHP module asks for.
Supposing that you 're using lastest builds for both Apache and PHP and both having been built with the same MVC version, you can copy the following files:
libcrypto-1_1.dll
libcrypto-1_1-x64.dll
libcurl.dll
libsasl.dll
libssh2.dll
libssl-1_1.dll
libssl-1_1-x64.dll
nghttp2.dll
libeay32.dll (if existing in your PHP distribution)
ssleay32.dll (if existing in your PHP distribution)
from the PHP root folder to the Apache2/bin folder, in case you 're confident that the PHP build is newer than the Apache build.
In the opposite case, you can copy the same files from the Apache BIN to the PHP root.
In any case, backup the contents of the APache and PHP folders beforehand.
Adding the PHP path as an enviromental variable will give priority to this path for loading the relevant DLLs and may solve the problem. However, you lose in server portability. Additionally, if you have also added the Apache PATH as a variable and the OpenSSL versions are way different (up to loading different linked DLL files), a lot of shit may happen.
Make sure to have your apache SSH dlls loading correctly. On a fresh install I had to download and load into my apache bin directory the following dll "libssh2.dll"
After ssl dll was loaded cURL was able to load with no issues.
You can download it from the link below:
http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
Solution:
Step1: Uncomment the php_curl.dll from php.ini
Step2: Copy the following three files from php installed directory.i.e "C:\\php7".
libeay32.dll,
libssh2.dll,
ssleay32.dll
Step3: Paste the files under two place
httpd.conf's ServerRoot directive. i.e "C\Apache24"
apache bin directory. i.e "C\Apache24\bin"
Step4: Restart apache.
That's all. I solve the problem by this way.Hope it might work for you.
The solution is given here.
https://abcofcomputing.blogspot.com/2017/06/php7-unable-to-load-phpcurldll.html
After having tried everything here I had to simply upgrade Apache to a newer version in order to make curl extension work.
I was upgrading PHP from 7.0.2 to 7.1.15 after which curl did not work. Only way to fix it was upgrade Apache (which was version 2.4.18) to the latest 2.4.29.
Didn't have to copy any of the lib/ssleay dll files to either Apache or Windows - possibly because I already have the PHP folder in my system path.
Running Windows 10, 64-bit, thread-safe versions, VC14.
Insert to file httpd.conf
LoadFile "D:/DevKit/PHP7.1/libeay32.dll"
LoadFile "D:/DevKit/PHP7.1/libssh2.dll"
LoadFile "D:/DevKit/PHP7.1/ssleay32.dll"
In php.ini you must put the extension_dir static path. extension_dir = "C:\laragon\bin\php\php-7.3.11-Win32-VC15-x64\ext" by example. Don't forget to remove the semicolon before this variable.
I have encountered the same problem before.I resolved it by add php directory to windows system environment variables---Path.
I got this error because, on my system at least, if extension_dir in php.ini is set to a relative path, it is taken as being relative to the root Apache directory, so to get it to point to the correct directory I had to use an absolute path: "C:\Program Files (x86)\PHP\ext". (This was PHP 5.5.31 and Apache 2.4.23 on Windows 10; setting extension_dir to ext worked just fine with the same setup on Windows 7. I first got it to work by putting an ext directory in the Apache folder with the necessary dlls, then figured out what was happening.)
It was also necessary to set the PATH correctly or make sure the dlls mentioned above (libeay32.dll, libssh2.dll, and ssleay32.dll) are in Apache's bin directory (or most likely any of the places other answers mention). The fact that I got the same error message for Apache not being able to find lib_curl.dll as for it not being able to find libssh2.dll did not make things any easier to figure out.
Add your php folder path to the System PATH and everything should work fine. It will also fix some other extensions that are broken.
Maybe not the best approach, but it definitely works. (2019-2022)
"Your install of PHP does not have the 'php_curl.dll' extension enabled."
find "php.ini", if no you have to rename "php.ini-development" to "phh.ini". Open it.
find ;extension_dir = "ext"
add these under that line, there is no ";"
extension_dir = "[php dir]\ext"
extension=php_curl.dll
I followed the manual, I mpved the php_mongo.dll into the PHP extension folder,
and added extension=php_mongo.dll to the php.ini file and it's given me an error when I try and you rockmango that "To make things right, you must install php_mongo module. Here for installation documents on PHP.net." but I have alread done this any solutions? I am running the lattest version of PHP and mongodb
Check php --ini shows the correct config file being used.
Check php -i (phpinfo) and make sure the module is actually loaded.
Double check you have the right flavour of the module for your version of PHP. (VC6, VC8, VC9, TS, NTS, etc.)
I got my mongo module (1.2.9) for PHP 5.4 32bit on windows from stealth35. It works like a charm.
Often there are multiple PHP locations with different php.ini files.
If you are worried about working in mod_php (through apache) or as a fastcgi then create a file with the following contents.
<?php phpinfo();
Then visit that file in a browser. It will have all the settings and modules listed that are currently being loaded. It will also tell you which php.ini file and modules directory being used.
Please make sure that the ini listed is the one you added mongo dll line.