I am running a tweaked webmail application. However, for some reason the openssl extension isn't loading. I have enabled it in the php.ini, but when I run my application and check for loaded extensions using get_loaded_extensions, the openssl is not in the array of loaded extensions. What is wrong here? The php_openssl.dll is physically there - I am running a wampserver and it looks ok. But on the execution end it is not working.
Depending on how php_openssl.dll was built/linked it depends on libeay32.dll and/or ssleay32.dll. Windows must be able to (also) load those two .dlls into the process running php in order to make the php_openssl.dll available/functional.
Since windows searches for .dlls (amongst other places) in the directory of the executable try placing libeay32.dll and ssleay32.dll in the apache/bin directory (where the httpd.exe resides) and restart the webserver.
see also: Dynamic-Link Library Search Order
and How to use Dependency Walker
Have you tried restarting your apache server?
And is the DLL in the right place?
This may help you. Copy dll files in windows and windows/system32 folders and then restart Apache server.
Related
I have Apache 2.4.12 and php 5.6.9 on my Windows 8 computer and I'm trying to enable the curl extension for php however, I haven't had much success. After searching the internet for this issue it appears that other's have had the same trouble. Here are the suggestions I've found:
Uncomment ;extension=php_curl.dll in php.ini
Uncomment ;extension_dir = "ext" in php.ini
Download and replace the php_curl.dll file in the ext directory of php with one from this website
Add to the PATH environment variable where php is installed
Copy libeay32.dll and ssleay32.dll from where php is installed to C:\Windows\System32
I've tried every single suggestion with no success except the third item in the list because it doesn't have a .dll file for curl with php 5.6, in fact the highest version avaible is one for php 5.4. There has to be way to enable this extension without having to downgrade my php version to 5.4 and using a .dll file from that website. I've tried searching the internet for a .dll file like the one on the linked website for php 5.6 opposed to a version of php that's outdated but I've had no luck in finding one so I'd like help with this issue.
How can I enable curl for php 5.6 on my Windows 8 machine?
Locate your php folder and follow these instructions:
Move to Windows\system32 folder:
libssh2.dll, php_curl.dll, ssleay32.dll, libeay32.dll
Move to Apache24\bin folder
libssh2.dll
Uncomment extension=php_curl.dll
Note: Don't overwrite when prompted.
Source
I give you an example of a set up that just worked perfectly for me :
downloaded the VC11 x86 Thread Safe version of PHP,
unzipped it within a directory C:\php,
edited the php.ini-development, uncommenting 2 lines :
extension=php_curl.dll
extension_dir = "ext"
saved this file under php.ini.
I just tested it via the CLI (windows CMD here) on a PHP a file (i.e. C:\php\php myFile.php) and cURL worked.
If you have Apache installed and prefer to test it in a browser, you obviously have to adapt this installation with your own files structure and to do not forget to restart Apache.
Running apache service with a specific user other than local system solved the problem for me. You can test this easily by stopping the apache service and running manually <apache dir>\bin\httpd.exe.
I fixed this problem by adding C:\php and C:\php\ext to PATH system variables.
Press window + pause to bring up the System Properties page.
Click Advanced System Settings
Click Environment Variables
You'll see the Path variable in the System Variables box in the bottom.
Append your PHP path to that variable. Now the system will be able to load the extensions.
In addition to uncommenting the line
;extension_dir = "ext"
Try also setting it to the absolute path of the PHP installation's ext folder and then restarting apache.
e.g.:
extension_dir = "C:\PHP 5.6.19\ext"
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 can't get cURL to work from inside Apache by any means. It's actually fairly strange too provided that:
I can execute my PHP pages from the CLI and it POSTs my requests perfectly fine
When I look at my error logs, I get "PHP Fatal error: Call to undefined function curl_init()" as if the extension isn't installed at all. Similarly, a quick `phpinfo()` also yields such as if the extension isn't installed.
Additionally, when I built PHP, I opted the "--enable-curl" flag.
You are probably not loading the extension in the appropriate php.ini. The file should include something like:
[PHP_CURL]
extension=php_curl.dll
Also, --enable-curl is not a PHP configure option. --with-curl=[DIR] is the one you'd want. Check out the cURL installation instructions.
php_curl.dll should be inside PHP's ext directory when configured correctly.
I had same problem after installing php5-curl. I rebooted apache and that fixed it.
sudo /etc/init.d/apache2 restart for ubuntu 12.04
I had similar problem - worked from cli, silently failed from Apache 2.4
I've tried:
1) copying ssleay32.dll and libeay32.dll from php folder into apache\bin folder - didn't work
2) deleting ssleay32.dll and libeay32.dll from apache\bin folder completely - WORKED.
You should restart apache server each time you make change to make it work.
Also you should install both x86 and x64 versions of C++ Resistributable Visual Studio from Microsoft.
I cannot install PHP-CURL on IIS. I think I have tried everything.
My phpinfo() output does not list cURL as available.
I have C:\PHP in my path and working correctly.
I have edited the registry to read from C:\PHP\php.ini. phpinfo() output shows the correct .ini path loaded.
I have uncommented 'extension=php_curl.dll'
I have ssleay32.dll and libeay32.dll availble in C:\PHP
Windows Server 2003
IIS 6
PHP 5.2.4
Try running:
php-cgi.exe -v
and see if any errors come up.
Also make sure the php is correctly in your path by going to the command line and typing:
echo %PATH%
As well make sure the php_curl.dll is in the correct directory and that ssleay32.dll and libeay32.dll are the same versions.
If all else fails try reinstalling PHP as I remember there being some issues a while back with the Curl Module not working on 5.1.4.
As well someone else mentioned installing the thread safe PHP package versus the non-thread package resolving a similar issue.
Did you definitely put php_curl.dll in the directory that PHP reads extensions from? Are the file permissions on it ok? And the big question: where did you get the php_curl.dll from? If you got a precompiled one it might be compiled for a different version of PHP than you are running. Check your webserver logs and see what comes up from PHP when you restart the server/container/whatever.
PHP 5.2.8 is refusing to load php_pgsql.dll, with the following error:
Warning: PHP Startup: Unable to load dynamic library 'D:\PHP\ext\php_pgsql.dll' - The specified module could not be found.
in Unknown on line 0
The .dll exists in PHP/ext/.
Has anyone else had this problem with PHP on Windows before?
Check out the info on the PHP PostgreSQL installation page: http://us.php.net/manual/en/pgsql.installation.php
On a Windows server, configured with Apache, adding the following line to httpd.conf to load libpq.dll can save you a lot of time :
LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"
Note that you will have to change your folder accordingly to the installation path and version of PostgreSQL you have installed. Also note that having Apache and PostgreSQL on the same server for production environments is not recommended.
This fixed my setup instantly.
This happened to me also with PHP 5.4.1
Copying the offending DLL everywhere didn't work, and I don't have PostgreSQL installed in the server, but I also planned to use PHP against different Postgres versions, so the only solution I found that worked was to put in httpd.conf a line like this:
LoadFile "C:/Program Files/PostgreSQL/8.4/bin/libpq.dll"
And referring to the libpq.dll that comes bundled with PHP, like this:
LoadFile "C:/php/libpq.dll"
After that it worked fine to me.
For those willing to make their PHP install only capable to access PostGres servers, without actually installing PostGres, you need to:
enable php_pgsql.dll (and php_pdo_pgsql.dll, if using PDO) extension in PHP.INI,
make sure libpq.dll, libiconv-2.dll and libintl-8.dll are in the path. These are the php_pgsql.dll dependencies.
These 3 DLLs can be found in the PostGres install. I just copied them into apache\bin, that way I keep everything self contained. Doing that, apache can start the PHP engine just fine, with PostGres support.
The problem is with the related libraries used by php_pgsql.dll - like libpq.dll, the OpenSLL ones etc. You need to find them (from the zip distribution of Postgres, from an installed psqlODBC driver etc.) and put them in a folder which is in the PATH. As for the list of all DLLs - use MS Dependency Walker (depends.exe).
Another important bit - Apache (if you use Apache that is) has its own set of OpenSSL DLLs. Replace or just rename those so to not clash with those from the Postgres distribution.
You need to copy libpq.dll from wamp\bin\php\php5.3.5 to wamp\bin\apache\Apache2.2.17\bin. Again restart the Wamp Server. By now we are done with the php configuration. Next we will install phpPgAdmin and use it.
Just a thought -- make sure that the Postgres binaries are in the SYSTEM path, not your user-specific path. As it happens, that was the problem on my machine. :-)
Edit:
Come to think of it, that explains why Dependency Walker would report all A-OK but the problem would still persist -- you run DW under your own account, while Apache runs as SYSTEM, and hence won't have your personal PATH settings available.
Just to share what worked for me, without dealing with libpq.dll. I uncommented both extension=php_pdo_pgsql.dll and extension=php_pgsql.dll in php.ini. At first, apache refused to start.
I then add "C:\Program Files (x86)\PostgreSQL\9.4\bin\" (depending on your installation) into windows environment PATH, started apache successfully and works.
Specifically for WAMP server setups here, you need to copy the libpg.dll file into "C:\wamp\bin\apache\Apache2.2.21\bin\", or similar. Copying it to ..\php\ext\ and also adjusting the PATH env variable simply wasn't enough (if effective at all).
Original answer sourced here: http://www.wampserver.com/phorum/read.php?2,40270,57932
Specifically for XAMPP setups, I found that I only needed to copy the libpg.dll file into ..\php\ext\ directory.
As Ondřej Bouda mentioned: Setting up Windows environment variables is enough. No copies of dlls, no entries to http-conf. Just add the php-directory (C:\xampp\php) to PATH. Don't forget to restart XAMPP-Control-Panel if you use this, otherwise it won't know the changes. (And restart Apache of cause.)
For instance, on XAMPP, it was sufficient to put the PHP directory
(i.e., C:\xampp\php) to the system PATH variable. – Ondřej Bouda
This is an update to #Dayron Armas Peña 's answer. The php bundled pgsql 'dll' is found in the following location:
LoadFile "C:/wamp/bin/php/php5.4.12/libpq.dll"
Adding the above line to the httpd.conf file apart from uncommenting the required lines in the php.ini files has solved my problem.
The only time I've seen this error (and the file name and ext path were definitely correct) was when I tried using an incorrect version of the DLL ie. I used one that was compiled against a different version of PHP to the one I was running.
Make sure your version is definitely the one compiled against PHP 5.2.8.
Edit: or, the permissions on the file were set incorrectly.
LIBPQ.DLL problem with php on Vista...
Check to make sure you actually have postgres installed. If you install php on windows with postgres API, without postgres being installed, you may get this warning. It's too easy to just click everything on the Windows installer...
Comment out the relevant line in php.ini.
I got the solution:
1) If you want to load php_pdo_pgsql extension, please load php_pdo, too. (in php.ini)
2) php_pgsql.dll and php_pdo_pgsql.dll depend on libpq.dll and php5ts.dll. libpg.dll is the library from postgreSQL, but it has been bundled into PHP's binary package.
When configuring PHP to work as a module with Apache, it can't load the depending library correctly. And so you need to load it in Apache.
config in httpd.conf and the two lines should be before LoadModule php5_module
LoadFile "Full path to /php5gs.dll"
LoadFile "full path to libpg.dll"
Hope it be helpful.
You have to add the following lines to you httpd.conf file:
PHPIniDir "c:/PHP/"
Loadfile "C:\php\php5ts.dll"
Loadfile "C:\php\libpq.dll"
LoadModule php5_module "c:/PHP/php5apache2_2.dll"
Source: http://www.php.net/manual/en/pgsql.setup.php
I just did this and it worked just fine
in php folder inside php.ini I changed this line
extension=php_openssl.dll
to
extension=C:\php\ext\php_openssl.dll
the php_openssl.dll is inside ext folder which couldn't be found.
Copy file libpq.dll from location /bin/php/ to
location /bin/apache//bin. Restart the wamp server.
I found this to work for me:
After installation of PostgreSQL, you need to copy libpq.dll from wamp\bin\php\phpX.X.X to wamp\bin\apache\Apache2.2*\bin. And restart the Wampserver.