PHP 4.0 Bug #9665 Updated: .netrc sought only in /root

From: Date: Sun, 25 Mar 2001 00:26:44 +0000
Subject: PHP 4.0 Bug #9665 Updated: .netrc sought only in /root
Groups: php.dev 
Request: Send a blank email to php-dev+get-49899@lists.php.net to get a copy of this message
ID: 9665 Updated by: torben Reported By: torben@php.net Old-Status: Open Status: Bogus Bug Type: cURL related Assigned To: Comments: (Thanks to Daniel Stenberg for pointing this out.) This occurs because curl is using the $HOME envvar to locate the .netrc file, so a putenv() before the call enables you to set the directory in which to search: <?php error_reporting(E_ALL); putenv('HOME=/path/to/desired/home/dir'); $url = 'ftp://www.work.loc'; if (!$curld = curl_init()) { echo "Could not initialize cURL session.\n"; exit; } curl_setopt($curld, CURLOPT_NETRC, true); curl_setopt($curld, CURLOPT_URL, $url); curl_exec($curld); echo curl_errno($curld); ?> Previous Comments: --------------------------------------------------------------------------- [2001-03-09 19:12:00] torben@php.net cURL works fine in general, but when told to search for a .netrc file, searches only in /root and not in the httpd user's actual home directory (/home/www). i.e., the following only works if .netrc is in /root: <?php error_reporting(E_ALL); echo id; $url = 'ftp://www.work.loc'; if (!$curld = curl_init()) { echo "Could not initialize cURL session.n"; exit; } curl_setopt($curld, CURLOPT_NETRC, true); curl_setopt($curld, CURLOPT_URL, $url); curl_exec($curld); echo curl_errno($curld); ?> --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9665&edit=2

« previous php.dev (#49899) next »