How to manually install Curl in a one-off PHP script

630 Views Asked by At

WIN 10 Microsoft PC (not linux). I've installed PHP V 7.1.9.

Right now, i'm trying to install Curl. However I'm getting odd issues,

phpinfo :-

1) Curl is reporting an AUTHOR of Sterling Hughes, however no modules are active / found for curl.

So i'm guessing it knows the author - php knows curl is available ?

2) the file path for the Configuration File (php.ini) shows the path C:\WINDOWS, however Ive checked there & there is NO php.ini file located.

I have checked for hidden files too...

Ive got PHP installed in 2-3 other directories (i guess in one of the PATH directories, so thats why php is loading.)

QUERIES:

3) is there a php code to diagnose the true / correct pathname of where the php.ini is loaded from ? So i can edit it & uncomment the line about installing the curl dll file.

(I have those lines uncommented in the php.ini files I could find).

4) Is there a way in a php script to "load" up Curl if its not in the php.ini file ?

(ive downloaded CURL in a ZIP file & extracted the files).

all the examples so far refer to php.ini, but no examples of PHP code to activate / load up Curl from within a php script itself without being installed via the php.ini file.

1

There are 1 best solutions below

0
On
  1. Retrieve PHP.ini path: You can try with PHP functions. php_info() or php_ini_loaded_file()

    http://php.net/manual/en/function.phpinfo.php

    http://php.net/manual/en/function.php-ini-loaded-file.php

  2. Way to load up CURL dynamically ?

    You can't. There was a function to achieve it but had been removed. http://php.net/dl

To install Curl, follow the instruction below

http://php.net/manual/en/curl.installation.php

Similar question(Very helpful):

PHP and CURL under Windows 7 64 bits and Apache