Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

cURL using PHP when zend is involved

Posted on 2013-12-20
23
Medium Priority
?
1,504 Views
Last Modified: 2014-01-04
I am having trouble getting curl enabled for us in PHP.
#php -i
shows that curl in enabled via /etc/php.ini and I can use it successfully from the command line.

But <?php phpinfo();?> shows curl in not enabled and uses /usr/local/zend/etc/php.ini

/usr/local/zend/etc/conf.d/curl.ini is being parsed, it contains extension=curl.so, no ; in front. curl.so does indeed exist in /usr/local/zend/lib/php_extensions/ with the other zend extensions that are working.

I have gone around and around on this problem with no success. Help is most appreciated.
0
Comment
Question by:jaw0807
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 4
  • 2
  • +3
23 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39732260
Assuming you've followed the instruction here, right?
http://www.php.net/manual/en/curl.installation.php

Just curious -- have you restarted everything since the install?
0
 

Author Comment

by:jaw0807
ID: 39732277
I had done: #service httpd restart
Doing a full system reboot right now... no change.
Do you mean something else by everything?
0
 

Author Comment

by:jaw0807
ID: 39732291
Sorry failed to respond to first part of your comment. Most if not all the instructions at that link don't apply to my setup (but that didn't stop me from trying them). My server is RHEL6 and I didn't manually compile PHP.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39732387
I'll mark this as a neglected question -- that should get some more eyes on it!
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 39732404
Did you make sure that you added the extension to /usr/local/zend/etc/php.ini ?
0
 

Author Comment

by:jaw0807
ID: 39732433
I have tried adding:
extension=curl.so
extension=php_curl.so
extension=curl.dll
extension=php_curl.dll
to /usr/local/zend/etc/php.ini without success. I assumed all of those were unnecessary since the /usr/local/zend/etc/conf.d/ directory is being scanned and the curl.ini file in that directory was being parsed. I thought perhaps the instance of extension=curl.so in that file (/usr/local/zend/etc/conf.d/curl.ini) was either being ignored or not working so I tried the extensions I listed above just incase.

I did notice that I didn't receive any errors when I added the above extensions to /usr/local/zend/etc/php.ini  and restarted httpd.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39732487
The 'dll' extensions are only for Windows, you should remove them and not use them on Linux.
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 39732488
The dll extensions are windows extensions so if you are using Linux they wouldn't work.

All the instructions that I see say to do this to install

sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart

and then add this

extension=curl.so

to the ini file you are trying to use.

I haven't had any problems using zend and curl on the same site though I am using zend 1.12 and a Windows server and php 5.4.14 which has curl enabled by default the so that may account for some of the differences.
0
 

Author Comment

by:jaw0807
ID: 39732529
I only attempted .dll when everything else didn't work and removed them after they did not work also.

Here is what I can show already done:
#yum install curl
Package curl-7.19.7-37.el6_4.x86_64 already installed and latest version
#yum install php-curl
Package php-5.3-curl-zend-server-5.3.21-8.x86_64 already installed and latest version

phpinfo(); output:
Loaded Configuration File       /usr/local/zend/etc/php.ini

vi /usr/local/zend/etc/php.ini
extension=curl.so

# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

phpinfo(); still shows no curl enabled.
function_exists('curl_init') is still false.
0
 

Author Comment

by:jaw0807
ID: 39732563
To be forthcoming I also have:
# yum install libcurl
Package libcurl-7.19.7-37.el6_4.x86_64 already installed and latest version
# yum install php-common
Package php-common-5.3.3-27.el6_5.x86_64 already installed and latest version
0
 
LVL 19

Expert Comment

by:xterm
ID: 39732637
Please execute the following command and paste the results here:

ls -l `rpm -ql php-5.3-curl-zend-server-5.3.21-8.x86_64 | grep curl.so`
0
 

Author Comment

by:jaw0807
ID: 39732660
# ls -l `rpm -ql php-5.3-curl-zend-server-5.3.21-8.x86_64 | grep curl.so`
-rwxr-xr-x. 1 root root 388959 Jan 23  2013 /usr/local/zend/lib/libcurl.so.4
-rwxr-xr-x. 1 root root  69267 Jan 23  2013 /usr/local/zend/lib/php_extensions/curl.so
0
 
LVL 19

Expert Comment

by:xterm
ID: 39732711
Okay, so "php -i" is php-cli, which is not the same as libphp5.so which is loaded by Apache, and being used by Zend.

Please run this command to see which package that your curl-enabled PHP is part of:

rpm -qf `which php`
0
 

Author Comment

by:jaw0807
ID: 39732727
#rpm -qf `which php`
php-cli-5.3.3-27.el6_5.x86_64
0
 
LVL 40

Expert Comment

by:noci
ID: 39739358
what does this show...

rpm -qa | grep php

if there is a php for apache installed, check the php.ini for the apache version of php.
otherwise install the php for apache variant. and see to adding curl.so to the ini file.
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 1500 total points
ID: 39739435
#rpm -qf `which php`
php-cli-5.3.3-27.el6_5.x86_64


Sorry I didn't respond to this earlier.  The system (non-Zend) version of php which is what you're using when you run the "php -i" command is curl-enabled as it should be.

The php-5.3-curl-zend-server-5.3.21-8.x86_64 package from everything you've shown is indeed curl-capable, and contains the module, and looks like your ini file loads it, but phpinfo() doesn't see it, so something is not loading.

Please look in /usr/local/zend/logs/error_log and see if you see any module load errors in there when you restart the server.  Perhaps show the output of "grep curl error_log".
0
 

Author Comment

by:jaw0807
ID: 39745443
noci:

I am not sure what I am specifically looking for with the rpm command you supplied, the results are below. I see curl in the list, /usr/local/zend/etc/conf.d/curl.ini is being parsed, and it contains extension=curl.so

# rpm -qa | grep php
php-5.3-ldap-zend-server-5.3.21-7.x86_64
php-5.3-fileinfo-zend-server-5.3.21-7.x86_64
php-cli-5.3.3-27.el6_5.x86_64
php-5.3-mcrypt-zend-server-5.3.21-7.x86_64
php-5.3-ftp-zend-server-5.3.21-7.x86_64
php-pear-1.9.4-4.el6.noarch
php-5.3-posix-zend-server-5.3.21-6.x86_64
php-5.3-calendar-zend-server-5.3.21-7.x86_64
php-5.3-bz2-zend-server-5.3.21-8.x86_64
php-common-5.3.3-27.el6_5.x86_64
php-5.3-pgsql-zend-server-5.3.21-6.x86_64
php-5.3-sockets-zend-server-5.3.21-6.x86_64
php-5.3-ctype-zend-server-5.3.21-7.x86_64
php-gd-5.3.3-27.el6_5.x86_64
php-5.3-tokenizer-zend-server-5.3.21-6.x86_64
php-5.3-bcmath-zend-server-5.3.21-7.x86_64
php-5.3-oci8-zend-server-5.3.21-7.x86_64
php-5.3-gd-zend-server-5.3.21-8.x86_64
php-5.3-common-extensions-zend-server-6.0.1-18.noarch
mod-php-5.3-apache2-zend-server-5.3.21-9.x86_64
php-5.3-pdo-pgsql-zend-server-5.3.21-7.x86_64
php-5.3-intl-zend-server-5.3.21-7.x86_64
php-5.3-exif-zend-server-5.3.21-7.x86_64
php-mysql-5.3.3-27.el6_5.x86_64
php-5.3-pdo-mysql-zend-server-5.3.21-7.x86_64
php-xml-5.3.3-27.el6_5.x86_64
php-5.3-gettext-zend-server-5.3.21-7.x86_64
php-5.3-phar-zend-server-5.3.21-6.x86_64
php-5.3-tidy-zend-server-5.3.21-7.x86_64
php-5.3-mysql-zend-server-5.3.21-7.x86_64
php-pdo-5.3.3-27.el6_5.x86_64
php-5.3-soap-zend-server-5.3.21-25.x86_64
php-5.3-xsl-zend-server-5.3.21-7.x86_64
php-5.3-mbstring-zend-server-5.3.21-7.x86_64
php-5.3-mysqli-zend-server-5.3.21-7.x86_64
php-5.3-curl-zend-server-5.3.21-8.x86_64
php-5.3-imap-zend-server-5.3.21-7.x86_64
php-5.3-sqlite-zend-server-5.3.21-6.x86_64
php-5.3-zip-zend-server-5.3.21-6.x86_64
0
 

Author Comment

by:jaw0807
ID: 39745448
xterm:

#grep curl /usr/local/zend/var/log/php.log
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extension
s/pgsql.so' - libssl.so.0.9.8: cannot open shared object file: No such file or directory in Unknown on line 0
0
 
LVL 19

Expert Comment

by:xterm
ID: 39745580
xterm:

#grep curl /usr/local/zend/var/log/php.log
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extension
s/pgsql.so' - libssl.so.0.9.8: cannot open shared object file: No such file or directory in Unknown on line 0


That cannot be the output of the command you ran - the string "curl" does not appear which is what "grep curl" means.  Furthermore, we need to be looking at the Apache log file (error.log or error_log) not php.log.
0
 

Author Comment

by:jaw0807
ID: 39745946
xterm:
Sorry about that. The grep command results were cut off and I mis-matched the time stamp when I copied it out of the file. AND it was the wrong file anyway. I was focusing on the zend instance of php being different and thought the log file would be too.

I cannot find a  /usr/local/zend/logs/error_log
Running #find / -name error_log only finds one at /var/log/httpd/error_log and that returns no results using the grep command provided (restarted httpd service and rebooted machine). Also could not find any error.log files on the system. Changed my log level to debug (another restart of the service and reboot just in case) but still came up with nothing.

#grep curl /usr/local/zend/var/log/php.log
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/curl.so' - libssl.so.0.9.8: cannot open shared object file: No such file or directory in Unknown on line 0
0
 

Accepted Solution

by:
jaw0807 earned 0 total points
ID: 39746107
copying libssl.so.0.9.8 to /usr/local/zend/lib/ produced a new error:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/curl.so' - libcrypto.so.0.9.8: cannot open shared object file: No such file or directory in Unknown on line 0

another copy to /usr/local/zend/lib/ of libcrypto.so.0.9.8 and curl is now working! xterm thank you very much for helping me track this problem down.
0
 
LVL 40

Expert Comment

by:noci
ID: 39750218
I was looking for this: mod-php-5.3-apache2-zend-server-5.3.21-9.x86_64

Indicating php for apache was installed.
0
 

Author Closing Comment

by:jaw0807
ID: 39755814
Missing files were causing the problem. xterm's idea to check the log file lead me to find /usr/local/zend/var/log/php.log which ultimately showed which files were missing and where they needed to be located.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question