• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1557
  • Last Modified:

cURL using PHP when zend is involved

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
jaw0807
Asked:
jaw0807
  • 12
  • 4
  • 2
  • +3
2 Solutions
 
Ray PaseurCommented:
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
 
jaw0807Author Commented:
I had done: #service httpd restart
Doing a full system reboot right now... no change.
Do you mean something else by everything?
0
 
jaw0807Author Commented:
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
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Ray PaseurCommented:
I'll mark this as a neglected question -- that should get some more eyes on it!
0
 
haloexpertsexchangeCommented:
Did you make sure that you added the extension to /usr/local/zend/etc/php.ini ?
0
 
jaw0807Author Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
The 'dll' extensions are only for Windows, you should remove them and not use them on Linux.
0
 
haloexpertsexchangeCommented:
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
 
jaw0807Author Commented:
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
 
jaw0807Author Commented:
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
 
xtermCommented:
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
 
jaw0807Author Commented:
# 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
 
xtermCommented:
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
 
jaw0807Author Commented:
#rpm -qf `which php`
php-cli-5.3.3-27.el6_5.x86_64
0
 
nociSoftware EngineerCommented:
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
 
xtermCommented:
#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
 
jaw0807Author Commented:
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
 
jaw0807Author Commented:
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
 
xtermCommented:
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
 
jaw0807Author Commented:
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
 
jaw0807Author Commented:
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
 
nociSoftware EngineerCommented:
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
 
jaw0807Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 12
  • 4
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now