473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

CLI CURL problem, happens only on the CLI?

I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:

* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted

Again, if I view the script from the browser it runs fine, no errors..

I also tried running it as root on the CLI in case it was a
permissions problem.

When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:

CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:

$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
Jul 22 '08 #1
11 3694
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:

* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted

Again, if I view the script from the browser it runs fine, no errors..

I also tried running it as root on the CLI in case it was a
permissions problem.

When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:

CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6

More info:

$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.

Things to check:

1) are either the web session or the webserver running in chroot jail?
2) is it just this HTTPS URL giving grief or is it all SSL?
3) when you run 'ldd' at the shell are all the libs in directories
described in /etc/ld.so.conf
4) start curl with strace or truss and see if it is able to load the
required binaries.

HTH

C.
Jul 23 '08 #2
On Jul 23, 8:11 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
>
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.
No, the PHP script is not working (throws curl errors) when run on the
command line, but it works when run from the browser. I'm not running
curl on the command line directly, I'm just running the script. So it
is a PHP question.
1. no
2. it's all SSL
3. ]$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
4. stance nor truss are installed. Remember, curl has no problem when
the php script is run from the browser. So presumably curl is working
properly. If I run curl directly on the command line it can hit an
https site no problem.

Jul 23 '08 #3
On Jul 23, 4:21 pm, Flexor <yugyu...@hotmail.comwrote:
On Jul 23, 8:11 am, "C. (http://symcbean.blogspot.com/)"

<colin.mckin...@gmail.comwrote:
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.

No, the PHP script is not working (throws curl errors) when run on the
command line, but it works when run from the browser. I'm not running
curl on the command line directly, I'm just running the script. So it
is a PHP question.

1. no
2. it's all SSL
3. ]$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
4. stance nor truss are installed. Remember, curl has no problem when
the php script is run from the browser. So presumably curl is working
properly. If I run curl directly on the command line it can hit an
https site no problem.
Bit of confusion on my part - there is a CLI tool 'curl' which is a
wrapper around the lib - I'd recommend trying it on the URL.

You need to run ldd with the program its going to use - so in this
case:

ldd php

Check all the libs are where they are expected to be and readable for
your uid.

C.
Jul 24 '08 #4
On Jul 24, 6:37 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 23, 4:21 pm, Flexor <yugyu...@hotmail.comwrote:
On Jul 23, 8:11 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.
No, the PHP script is not working (throws curl errors) when run on the
command line, but it works when run from the browser. I'm not running
curl on the command line directly, I'm just running the script. So it
is a PHP question.
1. no
2. it's all SSL
3. ]$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
4. stance nor truss are installed. Remember, curl has no problem when
the php script is run from the browser. So presumably curl is working
properly. If I run curl directly on the command line it can hit an
https site no problem.

Bit of confusion on my part - there is a CLI tool 'curl' which is a
wrapper around the lib - I'd recommend trying it on the URL.

You need to run ldd with the program its going to use - so in this
case:

ldd php

Check all the libs are where they are expected to be and readable for
your uid.

C.
OK:

$ ldd /usr/bin/php
libcrypt.so.1 =/lib/libcrypt.so.1 (0x00a52000)
libming.so.0 =/usr/local/ming-0.3.0//lib/libming.so.0
(0x0080e000)
libm.so.6 =/lib/tls/libm.so.6 (0x00a0b000)
libpng12.so.0 =/usr/lib/libpng12.so.0 (0x00b33000)
libjpeg.so.62 =/usr/lib/libjpeg.so.62 (0x00111000)
libcurl.so.3 =/usr/lib/libcurl.so.3 (0x00a84000)
libresolv.so.2 =/lib/libresolv.so.2 (0x00aef000)
libdl.so.2 =/lib/libdl.so.2 (0x00a05000)
libnsl.so.1 =/lib/libnsl.so.1 (0x00ad7000)
libssl.so.4 =/lib/libssl.so.4 (0x00d95000)
libcrypto.so.4 =/lib/libcrypto.so.4 (0x00caa000)
libgssapi_krb5.so.2 =/usr/lib/libgssapi_krb5.so.2
(0x00b0e000)
libkrb5.so.3 =/usr/lib/libkrb5.so.3 (0x00c20000)
libcom_err.so.2 =/lib/libcom_err.so.2 (0x00a30000)
libk5crypto.so.3 =/usr/lib/libk5crypto.so.3 (0x00c87000)
libidn.so.11 =/usr/lib/libidn.so.11 (0x0012f000)
libxml2.so.2 =/usr/lib/libxml2.so.2 (0x0015f000)
libpthread.so.0 =/lib/tls/libpthread.so.0 (0x00254000)
libc.so.6 =/lib/tls/libc.so.6 (0x008d7000)
libz.so.1 =/usr/lib/libz.so.1 (0x00a40000)
/lib/ld-linux.so.2 (0x008bd000)

Jul 25 '08 #5
Flexor wrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:

* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted

Again, if I view the script from the browser it runs fine, no errors..

I also tried running it as root on the CLI in case it was a
permissions problem.

When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:

CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:

$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

Among other things, check your security settings. For instance, your
web server user may have access to a file or directory that your CLI
user doesn't.

The code doesn't change. Any time a script works on the web server but
not from the CLI (or vice versa), look for external factors - security
settings, library directories, etc.

Even the php.ini file may be in a different place, with completely
different options.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 25 '08 #6
On Jul 25, 1:57 am, Flexor <yugyu...@hotmail.comwrote:
On Jul 24, 6:37 am, "C. (http://symcbean.blogspot.com/)"

<colin.mckin...@gmail.comwrote:
On Jul 23, 4:21 pm, Flexor <yugyu...@hotmail.comwrote:
On Jul 23, 8:11 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.
No, the PHP script is not working (throws curl errors) when run on the
command line, but it works when run from the browser. I'm not running
curl on the command line directly, I'm just running the script. So it
is a PHP question.
1. no
2. it's all SSL
3. ]$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
4. stance nor truss are installed. Remember, curl has no problem when
the php script is run from the browser. So presumably curl is working
properly. If I run curl directly on the command line it can hit an
https site no problem.
Bit of confusion on my part - there is a CLI tool 'curl' which is a
wrapper around the lib - I'd recommend trying it on the URL.
You need to run ldd with the program its going to use - so in this
case:
ldd php
Check all the libs are where they are expected to be and readable for
your uid.
C.

OK:

$ ldd /usr/bin/php
libcrypt.so.1 =/lib/libcrypt.so.1 (0x00a52000)
libming.so.0 =/usr/local/ming-0.3.0//lib/libming.so.0
(0x0080e000)
libm.so.6 =/lib/tls/libm.so.6 (0x00a0b000)
libpng12.so.0 =/usr/lib/libpng12.so.0 (0x00b33000)
libjpeg.so.62 =/usr/lib/libjpeg.so.62 (0x00111000)
libcurl.so.3 =/usr/lib/libcurl.so.3 (0x00a84000)
libresolv.so.2 =/lib/libresolv.so.2 (0x00aef000)
libdl.so.2 =/lib/libdl.so.2 (0x00a05000)
libnsl.so.1 =/lib/libnsl.so.1 (0x00ad7000)
libssl.so.4 =/lib/libssl.so.4 (0x00d95000)
libcrypto.so.4 =/lib/libcrypto.so.4 (0x00caa000)
libgssapi_krb5.so.2 =/usr/lib/libgssapi_krb5.so.2
(0x00b0e000)
libkrb5.so.3 =/usr/lib/libkrb5.so.3 (0x00c20000)
libcom_err.so.2 =/lib/libcom_err.so.2 (0x00a30000)
libk5crypto.so.3 =/usr/lib/libk5crypto.so.3 (0x00c87000)
libidn.so.11 =/usr/lib/libidn.so.11 (0x0012f000)
libxml2.so.2 =/usr/lib/libxml2.so.2 (0x0015f000)
libpthread.so.0 =/lib/tls/libpthread.so.0 (0x00254000)
libc.so.6 =/lib/tls/libc.so.6 (0x008d7000)
libz.so.1 =/usr/lib/libz.so.1 (0x00a40000)
/lib/ld-linux.so.2 (0x008bd000)
So what does

ls -l /usr/lib/libcurl.so.3

tell you? (this is probably a link - what are the permissions on the
link target)

C.
Jul 25 '08 #7
On Jul 24, 11:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Flexor wrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted
Again, if I view the script from the browser it runs fine, no errors..
I also tried running it as root on the CLI in case it was a
permissions problem.
When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:
CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:
$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

Among other things, check your security settings. For instance, your
web server user may have access to a file or directory that your CLI
user doesn't.

The code doesn't change. Any time a script works on the web server but
not from the CLI (or vice versa), look for external factors - security
settings, library directories, etc.

Even the php.ini file may be in a different place, with completely
different options.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thanks but as inidicated in my original post: "I also tried running it
as root on the CLI in case it was a permissions problem. " And
regarding the location of php.ini: "When I echo phpinfo() from the
CLI, it looks the same as when I print it in the browser. I even threw
in an obscure setting in there to compare it with both."
Jul 25 '08 #8
On Jul 25, 8:23 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 25, 1:57 am, Flexor <yugyu...@hotmail.comwrote:
On Jul 24, 6:37 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 23, 4:21 pm, Flexor <yugyu...@hotmail.comwrote:
On Jul 23, 8:11 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
On Jul 22, 8:44 pm, Flexor <yugyu...@hotmail.comwrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
So cURL is working in PHP but not from the CLI. So it's not really a
PHP question at all. So somewhat OT.
No, the PHP script is not working (throws curl errors) when run on the
command line, but it works when run from the browser. I'm not running
curl on the command line directly, I'm just running the script. So it
is a PHP question.
1. no
2. it's all SSL
3. ]$ ldd
ldd: missing file arguments
Try `ldd --help' for more information.
4. stance nor truss are installed. Remember, curl has no problem when
the php script is run from the browser. So presumably curl is working
properly. If I run curl directly on the command line it can hit an
https site no problem.
Bit of confusion on my part - there is a CLI tool 'curl' which is a
wrapper around the lib - I'd recommend trying it on the URL.
You need to run ldd with the program its going to use - so in this
case:
ldd php
Check all the libs are where they are expected to be and readable for
your uid.
C.
OK:
$ ldd /usr/bin/php
libcrypt.so.1 =/lib/libcrypt.so.1 (0x00a52000)
libming.so.0 =/usr/local/ming-0.3.0//lib/libming.so.0
(0x0080e000)
libm.so.6 =/lib/tls/libm.so.6 (0x00a0b000)
libpng12.so.0 =/usr/lib/libpng12.so.0 (0x00b33000)
libjpeg.so.62 =/usr/lib/libjpeg.so.62 (0x00111000)
libcurl.so.3 =/usr/lib/libcurl.so.3 (0x00a84000)
libresolv.so.2 =/lib/libresolv.so.2 (0x00aef000)
libdl.so.2 =/lib/libdl.so.2 (0x00a05000)
libnsl.so.1 =/lib/libnsl.so.1 (0x00ad7000)
libssl.so.4 =/lib/libssl.so.4 (0x00d95000)
libcrypto.so.4 =/lib/libcrypto.so.4 (0x00caa000)
libgssapi_krb5.so.2 =/usr/lib/libgssapi_krb5.so.2
(0x00b0e000)
libkrb5.so.3 =/usr/lib/libkrb5.so.3 (0x00c20000)
libcom_err.so.2 =/lib/libcom_err.so.2 (0x00a30000)
libk5crypto.so.3 =/usr/lib/libk5crypto.so.3 (0x00c87000)
libidn.so.11 =/usr/lib/libidn.so.11 (0x0012f000)
libxml2.so.2 =/usr/lib/libxml2.so.2 (0x0015f000)
libpthread.so.0 =/lib/tls/libpthread.so.0 (0x00254000)
libc.so.6 =/lib/tls/libc.so.6 (0x008d7000)
libz.so.1 =/usr/lib/libz.so.1 (0x00a40000)
/lib/ld-linux.so.2 (0x008bd000)

So what does

ls -l /usr/lib/libcurl.so.3

tell you? (this is probably a link - what are the permissions on the
link target)

C.

$ ls -l /usr/lib/libcurl.so.3
lrwxrwxrwx 1 root root 16 Nov 11 2007 /usr/lib/libcurl.so.3 ->
libcurl.so.3.0.0
$ ll /usr/lib/libcurl.so.3.0.0
-rwxr-xr-x 1 root root 189696 May 2 2007 /usr/lib/libcurl.so.3.0.0
Jul 25 '08 #9
Flexor wrote:
On Jul 24, 11:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Flexor wrote:
>>I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted
Again, if I view the script from the browser it runs fine, no errors..
I also tried running it as root on the CLI in case it was a
permissions problem.
When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:
CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:
$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
Among other things, check your security settings. For instance, your
web server user may have access to a file or directory that your CLI
user doesn't.

The code doesn't change. Any time a script works on the web server but
not from the CLI (or vice versa), look for external factors - security
settings, library directories, etc.

Even the php.ini file may be in a different place, with completely
different options.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Thanks but as inidicated in my original post: "I also tried running it
as root on the CLI in case it was a permissions problem. " And
regarding the location of php.ini: "When I echo phpinfo() from the
CLI, it looks the same as when I print it in the browser. I even threw
in an obscure setting in there to compare it with both."
But it could still be a libpath problem or something similar. You could
even be running a different version of PHP between the web server and
the CLI.

Again - when a script works in one environment but not another, there is
almost always a difference in the environments which cause the problem.
The only exception would be some obscure function calls which exist in
one but not the other. But if that's the case you'll get an error
message (function not found).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jul 25 '08 #10
On Jul 25, 12:24 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Flexor wrote:
On Jul 24, 11:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Flexor wrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted
Again, if I view the script from the browser it runs fine, no errors..
I also tried running it as root on the CLI in case it was a
permissions problem.
When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:
CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:
$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
Among other things, check your security settings. For instance, your
web server user may have access to a file or directory that your CLI
user doesn't.
The code doesn't change. Any time a script works on the web server but
not from the CLI (or vice versa), look for external factors - security
settings, library directories, etc.
Even the php.ini file may be in a different place, with completely
different options.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thanks but as inidicated in my original post: "I also tried running it
as root on the CLI in case it was a permissions problem. " And
regarding the location of php.ini: "When I echo phpinfo() from the
CLI, it looks the same as when I print it in the browser. I even threw
in an obscure setting in there to compare it with both."

But it could still be a libpath problem or something similar. You could
even be running a different version of PHP between the web server and
the CLI.

Again - when a script works in one environment but not another, there is
almost always a difference in the environments which cause the problem.
The only exception would be some obscure function calls which exist in
one but not the other. But if that's the case you'll get an error
message (function not found).

I don't disagree that it's the environment. The bang line points to
the same php that apache uses. And a comparison of phpinfo()
indicates the same php path for both.

Jul 25 '08 #11
Flexor wrote:
On Jul 25, 12:24 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Flexor wrote:
>>On Jul 24, 11:30 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Flexor wrote:
I have a php script that runs from command line and makes an https
request to paypal, using curl. It works fine if I run it from a web
page. It fails if I run it from CLI. The error I get from the CLI:
* About to connect() to api-3t.sandbox.paypal.com port 443
* Trying 216.113.191.88... * connected
* Connected to api-3t.sandbox.paypal.com (216.113.191.88) port 443
* successfully set certificate verify locations:
* CAfile: /usr/share/ssl/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to
api-3t.sandbox.paypal.com:443
* Closing connection #0
*** glibc detected *** free(): invalid pointer: 0x00dc8c80 ***
Aborted
Again, if I view the script from the browser it runs fine, no errors..
I also tried running it as root on the CLI in case it was a
permissions problem.
When I echo phpinfo() from the CLI, it looks the same as when I print
it in the browser. I even threw in an obscure setting in there to
compare it with both. CURL shows up in both:
CURL support =enabled
CURL Information =libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.3 libidn/
0.5.6
More info:
$ php -v
PHP 5.1.4 (cli) (built: Jun 8 2006 18:09:19)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
$ php -m
[PHP Modules]
ctype
curl
date
dom
ftp
gd
hash
iconv
libxml
ming
mysqli
pcre
PDO
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
Among other things, check your security settings. For instance, your
web server user may have access to a file or directory that your CLI
user doesn't.
The code doesn't change. Any time a script works on the web server but
not from the CLI (or vice versa), look for external factors - security
settings, library directories, etc.
Even the php.ini file may be in a different place, with completely
different options.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thanks but as inidicated in my original post: "I also tried running it
as root on the CLI in case it was a permissions problem. " And
regarding the location of php.ini: "When I echo phpinfo() from the
CLI, it looks the same as when I print it in the browser. I even threw
in an obscure setting in there to compare it with both."
But it could still be a libpath problem or something similar. You could
even be running a different version of PHP between the web server and
the CLI.

Again - when a script works in one environment but not another, there is
almost always a difference in the environments which cause the problem.
The only exception would be some obscure function calls which exist in
one but not the other. But if that's the case you'll get an error
message (function not found).


I don't disagree that it's the environment. The bang line points to
the same php that apache uses. And a comparison of phpinfo()
indicates the same php path for both.

If Apache is loading PHP as a module, then no, it isn't using the same
one. If Apache is loading as a CGI, it may or may not be the same file.
It all depends.

But what about my other questions - have you checked the rest of the
environment, i.e. libs, etc. Something is different.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jul 26 '08 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Haluk Durmus | last post by:
Hello I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php from cvs. php couse an ERROR I did the following steps:
0
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its...
9
by: Dave Martin | last post by:
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If...
9
by: Conrad F | last post by:
Hi, If any Microsoft people are listening.... Are there any plans for the new web language called "Curl" to be supported in .NET (ASP.NET)? I ask as Curl represents the first step to true OO...
3
by: Leo | last post by:
Can anyone help or offer some explanation with this problem: I'm trying to do a POST from one of my PHP pages, to another page on my site using curl. To maintain the session I'm sending the...
4
by: Terry | last post by:
I'm using curl to invoke a php script on the same site/server. It works great, but if I call it again while it's still running, nothing happens. Why? Can that be fixed? Why use curl? To make...
4
by: zorro | last post by:
Hello there, I can't figure out why is it that when i use an array for my postfields it doesn't work : this works curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" ); this doesn't...
1
by: GeoffreyF67 | last post by:
There is a social bookmarking site here: http:// onlywire.com that I'm trying to login and post to via curl. It's using ajax and I haven't been able to figure out how to post to it so far. ...
3
by: Sarah | last post by:
I was wondering if someone might be able to help me with this issue. I have a feeling this has something to do with my host's server settings as I used to be able to get CURL to follow redirects by...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.