|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45419 curl_exec returns output when called from command line, FALSE from apache
Submitted: 2008-07-02 16:14 UTC Modified: 2008-07-24 01:00 UTC
From: circular at pctechnology dot gr Assigned:
Status: No Feedback Package: cURL related
PHP Version: 5.2.6 OS: Debian sarge
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: circular at pctechnology dot gr
New email:
PHP Version: OS:


 [2008-07-02 16:14 UTC] circular at pctechnology dot gr
When the CURLOPT_RETURNTRANSFER option is set curl_exec returns the correct output when called from the command line, but FALSE when called through apache.

curl version: 7.18.2, apache 2.0.54

'./configure'  '--prefix=/usr/local' '--with-apxs2=/usr/bin/apxs2' '--with-config-file-path=/etc/php5/apache2' '--disable-debug' '--with-regex=php' '--disable-rpath' '--disable-static' '--with-pic' '--with-layout=GNU' '--with-pear=/usr/share/php' '--enable-calendar' --enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db4' '--with-iconv' '--enable-exif' '--enable-ftp' '--with-gettext' '--enable-mbstring' '--with-pcre-regex=/usr/local' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--enable-xml' '--with-xmlrpc' '--with-zlib' '--without-pgsql' '--with-kerberos=/usr' '--with-openssl=/usr' '--enable-zip' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--with-exec-dir=/usr/lib/php5/libexec' '--without-mm' '--with-mysql' '--without-sybase-ct' '--with-gd=/usr/local' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-freetype-dir=/usr/local' '--enable-gd-native-ttf' '--with-curl=/usr/local'

Reproduce code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://some.url");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$converted = curl_exec($ch);

Expected result:
curl_exec returning the same output when the code runs either from the console or apache.

Actual result:
the expected output when the code runs from the command line, FALSE when run from within apache.

The error code returned is 28 (connection time-out), and curl_getinfo returns a negative value for CURLINFO_NAMELOOKUP_TIME.

No errors are logged in apache or system logs.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-16 22:33 UTC]
Did you compile everything yourself? Including Apache?
This is very unlikely to be any bug, just some misconfiguration.
Try recompiling PHP without any extra stuff. Just using --with-apxs2 and --with-curl options.
 [2008-07-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 04:01:29 2023 UTC