Extension not loading php

Extension not loading php

On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way.

To load an extension, you need to have it available as a «.dll» file on your system. All the extensions are automatically and periodically compiled by the PHP Group (see next section for the download).

To compile an extension into PHP, please refer to building from source documentation.

To compile a standalone extension (aka a DLL file), please refer to building from source documentation. If the DLL file is available neither with your PHP distribution nor in PECL, you may have to compile it before you can start using the extension.

Where to find an extension?

PHP extensions are usually called «php_*.dll» (where the star represents the name of the extension) and they are located under the «PHP\ext» folder.

PHP ships with the extensions most useful to the majority of developers. They are called «core» extensions.

However, if you need functionality not provided by any core extension, you may still be able to find one in » PECL. The PHP Extension Community Library (PECL) is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.

If you have developed an extension for your own uses, you might want to think about hosting it on PECL so that others with the same needs can benefit from your time. A nice side effect is that you give them a good chance to give you feedback, (hopefully) thanks, bug reports and even fixes/patches. Before you submit your extension for hosting on PECL, please read » PECL submit.

Which extension to download?

  • Different version numbers (at least the first two numbers should match)
  • Different thread safety settings
  • Different processor architecture (x86, x64, . )
  • Different debugging settings
  • etc.

You should keep in mind that your extension settings should match all the settings of the PHP executable you are using. The following PHP script will tell you all about your PHP settings:

Example #1 phpinfo() call

Читайте также:  Python запустить файл txt

Or from the command line, run:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2.0 Windows, Extensions not loading #10076

PHP 8.2.0 Windows, Extensions not loading #10076

Comments

Description

The extensions «curl» and «ldap» don’t load.

PHP Version

Operating System

The text was updated successfully, but these errors were encountered:

This happens when using «Apache 2.0 Handler».
Via CLI, using exact same php.ini, all extensions seem to load fine.

[10-Dec-2022 14:08:43 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: H:\apps\wamp64\bin\php\php8.2.0\ext\curl (The specified module could not be found), H:\apps\wamp64\bin\php\php8.2.0\ext\php_curl.dll (The specified module could not be found)) in Unknown on line 0 
System Windows NT VWORK 10.0 build 19045 (Windows 10) AMD64 Build Date Dec 6 2022 15:26:23 Build System Microsoft Windows Server 2019 Datacenter [10.0.17763] Compiler Visual C++ 2019 Architecture x64 Configure Command cscript /nologo /e:jscript configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=..\..\..\..\instantclient\sdk,shared" "--with-oci8-19=..\..\..\..\instantclient\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--without-analyzer" "--with-pgo" Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path no value Loaded Configuration File H:\apps\wamp64\bin\apache\apache2.4.23\bin\php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none) PHP API 20220829 PHP Extension 20220829 Zend Extension 420220829 Zend Extension Build API420220829,TS,VS16 PHP Extension Build API20220829,TS,VS16 Debug Build no Thread Safety enabled Thread API Windows Threads Zend Signal Handling disabled Zend Memory Manager enabled Zend Multibyte Support provided by mbstring IPv6 Support enabled DTrace Support disabled Registered PHP Streams php, file, glob, data, http, ftp, compress.zlib, phar Registered Stream Socket Transports tcp, udp Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, convert.*, consumed, dechunk, zlib.* 

Источник

Windows : Fixing PHP cURL extension not working when enabled

Windows - Missing PHP cURL extension

The other day I wanted to install a WordPress plugin on a website hosted on my Windows local development machine. Still, the plugin complained that it needs the cURL extension enabled on the php.ini configuration file. This seemed like an easy problem to solve, but after modifying the php.ini file, I was still getting the «curl not found» error. This article will show two different ways to make the cURL extension work on the Windows system.

Whichever solution we use, we first need to enable the cURL extension in the php.ini file. If you have already done that and the cURL is still not available, skip to the next section.

Читайте также:  Название документа

Note: When Enabling cURL in php.ini or use either of the two solutions, we need to restart the web server for changes to take into effect. When running Apache as a service, we can easily do that by using ApacheMonitor.exe utility.

Enabling cURL extension in php.ini file

The php.ini is a PHP configuration file and among other settings, it has a list of extensions that are commented out and disabled by default.

In the steps below, we are going to enable the cURL extension.

    First, we need to locate the PHP folder. It’s usually at C:\php , but it really depends on how it was installed in the first place. You could try to run the following code to find the location of the PHP directory:

Note: On older PHP versions, you might have ;extension=php_curl.dll instead of ;extension=curl in the php.ini file.

Removing the comment of the extension in php.ini , saving the changes, and restarting the server should be enough to enable most extensions, but in my case, with the cURL, it was still not working.

Why cURL extension was still not enabled

It turns out, that the reason why cURL cannot be found is that Windows needs to know the location of the following .dll file:

This dynamic link library file is located in the root of the PHP folder, but the problem is Windows doesn’t look for .dll files there.

In the end, I was able to make it work using two different solutions. One solution is quick, but a little «hacky», while the other takes a bit more time, but is a more complete solution.

Solution 1 — Copy the libssh2.dll into Windows System folder

In this solution, we simply copy the required libssh2.dll into the Windows System folder, so that Windows finds the libssh2.dll file.

  1. In File Explorer, go to the folder where PHP is located.
  2. Inside it, you should see the libssh2.dll file. Copy it.
  3. Go to the C:\Windows\System32 and Paste the file there.
  4. Restart the web server.

Now the cURL PHP extension should work.

This solution is pretty simple, but the problem with it is that if you update the PHP in the future, you might forget to again copy the newer libssh2.dll to the Windows System folder.

A much better solution is to let Windows know about the location of the PHP folder using the Path environment variable.

Solution 2 — Add PHP folder into the System Path variable

Instead of copying libssh2.dll into a Windows System folder, a much cleaner solution is to add the location of the PHP folder into the System Environment Path variable. This way, if you update a PHP in the future on the same folder, nothing else needs to be done.

  1. In Windows Search field, look for «env«. You should see two results, one to edit «environment variables» and the other to edit «system environment variables«. Select the «Edit the system environment variables» from the search result as shown below. Windows 10 - Search to edit system environment variables
  2. The «System Properties» windows should open up. Click on the «Environment Variables. » button at the bottom of the window.
    Windows - System Properties windows - selecting Environment Variables button
  3. The «Environment Variables» window should now open. The first list at the top of the window contains user variables, while the bottom list contains system variables. We need to edit the Path in system variables. In the bottom list for «System Variables«, select the «Path» variable and click the «Edit» button (located near the OK button). Windows - System Environment Variables
  4. You should now see the list of locations that are in the Path variable. Click on the New button to add a new location.
    Windows - Edit Path System Environment Variable - adding a new path
  5. Paste the location of the PHP folder. For example, C:\php as shown below.
    Windows - Edit path system environment variables - Adding path to PHP folder
  6. Click on OK to close the window of Path locations and again click OK to close both the «Environment Variables» and «System Properties» windows.
  7. Restart the web server. If restarting the server doesn’t work, restarting the computer should do the trick.
Читайте также:  Java error memory not available

The PHP cURL extension should now be active, so let’s test if this is indeed the case.

Testing if PHP cURL extension really is enabled

We could confirm that the cURL is working by using the phpinfo() function that outputs all the PHP configuration information, but to just check for the cURL extension, we can use the following code:

If it is enabled, the script will display bool(true), if on other hand it is still not enabled, it will display bool(false). In that case, double-check that you didn’t add the PHP location in Path for user variables. Having a location for PHP folder there will not work.

Conclusion

PHP has many extensions that are disabled by default in the php.ini file. To enable an extension, we just need to uncomment it, but with the cURL extension, just uncommenting the extension=curl line might not be enough.

We learned two different ways to make cURL work on Windows. One way is to manually copy the libssh2.dll file to the Windows system folder, but a better solution is to tell Windows where the .dll file is by adding the location of the PHP folder in the Path System environment variable.

Источник

Оцените статью