Pierre Buyle
Pierre Buyle

Reputation: 4873

Can libcURL be configured to use my .curlrc when used from PHP

I'm using Drush and Drush Make to automate download of Drupal module from a corporate network behind a NTLM-SSPI Proxy. Drush and Drush Make uses cURL to download files. cURL supports NTLM-SSPI Proxy. I configured cURL for the proxy in my .curlrc file

--proxy proxy.example.com:8080
--proxy-ntlm
--proxy-user user:password

Drush itself is able to download modules from drupal.org because it uses curl from the command line. But Drush Make uses the PHP cURL API (libcurl) . It looks like when used this way, cURL does not use the configuration in my .curlrc file.

Is there a way to configure libcurl/PHP cURL with a .curlrc file ?

Upvotes: 5

Views: 4775

Answers (2)

LeeNX
LeeNX

Reputation: 14

drush really loads the command line tool and runs it, so you can do this in the ~/.curlrc file, but you need to make sure your commands are correctly setup.

leet@test:~$ cat ~/.curlrc
# Proxy manly for drush make
proxy = http://localhost:3128
# Drush make work around for https
#insecure

Can be made with ...

echo -e "\n# Proxy manly for drush make\nproxy = http://localhost:3128 \n /
#Drush make work around for https \n#insecure\n" >> ~/.curlrc

Remember, this will only work for your user, I think you can set a system wide default if you put curlrc in the same folder your bin file is in or /etc/curl, but I have not tested this.

I use this all the time, for quick aegir builds.
Hope that helps.
LeeT

Upvotes: -2

Daniel Stenberg
Daniel Stenberg

Reputation: 58124

No, the entire .curlrc parser and all associated logic is only present in the command line tool code. It is not included in the library at all. (and the PHP/CURL binding is only using libcurl the library, not the command line tool)

Upvotes: 11

Related Questions