LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-14-2009, 08:04 AM   #1
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Rep: Reputation: 15
Question Checking PHP_cURL mod


Hi everybody,

I have PHP5 running on Slackware 12. I just need to know if php_cURL is properly installed. I don't remember enabling it during php installation.

If not installed I need to know how to install it without recompiling php.

I doubt it's installed coz even I took ; out in extension=php_curl.dll or even extension=php_curl.so from /etc/php.ini still doesn't work.


Thanks
 
Old 06-14-2009, 11:51 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
To check if curl is enabled in php you can run:
Code:
php -i |grep curl
If you don't want to recompile php, you can use pecl to add curl support as an extension to php:
Code:
pecl install /path-to-php-source/ext/curl/package.xml
Just press <Enter> when asked to where you want to install it.
After pecl finishes, edit php.ini and add a line:
Code:
extension=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/curl.so
Of course the above path may be different in your case. You might also set extension_dir in php.ini accordingly.
Then restart apache and hopefully you'll have curl support in php.

Last edited by bathory; 06-14-2009 at 12:04 PM.
 
Old 06-16-2009, 08:57 AM   #3
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Original Poster
Rep: Reputation: 15
Hi bathory,

I followed your instruction and succesfully enabled curl, thanks a lot. I still have some problem though. when I do curl test through php it still complaining fatal error. I'll try double check my config in php.ini today.


should I only put this? "extension=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/curl.so"

or put

extension=php_curl.ddl

or

extension=php_curl.so

and point to usr/local/lib/php/extensions/no-debug-non-zts-20060613

my module directives?


Thanks
 
Old 06-16-2009, 09:36 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use:
Code:
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
extension=curl.so
Just make sure that the path to curl.so is correct.
As for .dll is for the windows version of php. Of course you must restart apache for the changes in php.ini to take effect.
You can use the folloing inside a php page to test if the extension works:
Code:
<?php
echo '<pre>';
var_dump(curl_version());
echo '</pre>';
?>
Watch apache error_log for errors

Regards

Last edited by bathory; 06-16-2009 at 12:00 PM.
 
Old 06-17-2009, 08:29 AM   #5
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Original Poster
Rep: Reputation: 15
I am still getting error. I tried adding a line in httpd.conf: "LoadModule: php_curl modules/curl.so" as I think the module should be running before you can use it. But it didn't work, I know it's not the right way to do it. Httpd complains that it can't locate the API or something. Do you have any idea? should I load the module at start-up separately?

thanks
 
Old 06-17-2009, 12:09 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
curl.so is not a apache module, so you cannot put it in http.conf. In httpd you need just the "LoadModule php5_module modules/libphp5.so" (without the ":" you've put in LoadModule in our last post)
In normal conditions it's used as a built-in php using "--with-cul" in the ./configure options when compiling from source. In your case you're trying to add curl as an extension to php, and this is can be done through php.ini.
What is the exact error you get in apache error_log?
Does
Code:
php -i |grep -i curl
produce any output when you add the extension?
 
Old 06-18-2009, 12:13 PM   #7
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Original Poster
Rep: Reputation: 15
There is no output after I run php -i | grep -i curl.

I'll remove the line in httpd.conf. that's what I thought it's not a good idea hehe..

error_log only say something RSA doesn't match server name 'Allanitto' or something like that, and can't find favicon.ico.. I don't think it has something to do with curl.


can I just run ./configure --with-curl, and run make but not make install? do you think It's going to modify my current php config in a bad way?

Please let me know.

Thanks
 
Old 06-18-2009, 12:41 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
1.
Quote:
There is no output after I run php -i | grep -i curl.
That means that you have no curl support for php. Are you sure you're editing the correct php.ini? You can find the path to the php.ini your php uses by running:
Code:
php -i | grep php.ini
2.
Quote:
I'll remove the line in httpd.conf. that's what I thought it's not a good idea hehe..

error_log only say something RSA doesn't match server name 'Allanitto' or something like that, and can't find favicon.ico.. I don't think it has something to do with curl.
Apache will refuse to start if you use the code for php.ini into httpd.conf. That makes me ask you if you restart apache when you change php.ini. You should restart apache any time you change things in php.ini. The other errors you see have nothing to do with curl.
3.
Quote:
can I just run ./configure --with-curl, and run make but not make install? do you think It's going to modify my current php config in a bad way?
I don't understand what you mean by php config. Without running "make install" nothing will happen.
BTW, why don't you want to recompile php, adding built-in curl support?

Last edited by bathory; 06-18-2009 at 12:44 PM.
 
Old 06-20-2009, 09:17 AM   #9
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Original Poster
Rep: Reputation: 15
Okay if I run

"php -i | grep php.ini"

it shows "Configuration File (php.ini) Path => /usr/local/lib" and it doesn't have php.ini.

my php.ini is at /etc.

by the way I just chmod curl.so to u+x coz by default installation it's not executable.

Still I'm getting this:
Fatal error: Call to undefined function curl_version() in /home/ftpuser1/curltest.php on line 3


Do you think it would be better if I move my php.ini to /usr/local/lib/php or /usr/local/lib?

I'll try it now.

Thanks
 
Old 06-20-2009, 09:31 AM   #10
Allanitto Newbee
Member
 
Registered: Oct 2007
Location: Montreal
Distribution: Slackware12;Slackware13
Posts: 106

Original Poster
Rep: Reputation: 15
HAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!

it works!!!


php.ini should be in /usr/local/lib and not in etc/ or /usr/local/lib/php.



Thanks a lot bathory and hope someone else will find this thread with the same problem as mine and find it useful.


Ciao
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 mod vhost_alias - problems with .htaccess mod rewrite d_t_baker Linux - Server 1 08-16-2007 07:32 PM
New mod jeremy Linux - Security 12 09-22-2006 08:43 AM
Please Welcome New mod jeremy Linux - General 29 02-01-2004 02:39 PM
Welcome New Mod jeremy LQ Suggestions & Feedback 31 07-14-2003 08:05 PM
New mod jeremy Linux - Newbie 6 07-07-2002 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration