Jump to content

[SOLVED] Apache PHP Curl


Recommended Posts

Hi

im on kubuntu 7.10 gutsy

 

i have installed apache tomcat 6.*,  php 5* and installed php5-curl, libcurl3 (all through adept except tomcat)

 

but in konsole.. when i typed curl.. it says its not installed

i have the source files

 

i need my webserver to have curl and php support, and php with curl extension

 

 

please do guide me

Link to comment
Share on other sites

No go

i downloaded the curl source and installed it

 

now curl is installed..

 

do i have to make modifications to apache/tomcat?

 

i am referring to this :

http://energy.sdsu.edu/testcenter/testhome/phpinstall.html

 

but since ive installed php5 thru adept

 

and apache tomcat 6.. while installing netbeans 6..

i couldnt configure it exactly

 

 

Link to comment
Share on other sites

i went to systemservices and restarted apache 2.. as it was the only process running.. then i started apache tomcat

but still its the same

 

i think theres a problem with the php file

let me give a run through

 

i am trying to implement OpenID support for a website

they have an example implementation.. which im trying

 

first the index.php is called.. which takes in the open id provided by the user :

 

<html><head><title>OpenID Login</title></head><body>

<form action="forward.php" method="post">

OpenID: <input type="text" name="url" /><br/>

<input type="submit" />

</form>

</body></html>

 

 

forward.php :  takes the input open id and gets the curl page.. and looks extracts XYZ from <link rel="openid.server" href="XYZ"/>

                        it goes to the open id server and authenticates the user and should return to the ' return_to ' url when clicked on it ( presently                                    my own system.. as i havent hosted it yet)

 

<?php

ob_start();

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $_REQUEST['url'] );

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);

curl_close($ch);

$idhtml = ob_get_clean();

preg_match( "<link rel=\"openid.server\" href=\"(.*?)\" />", $idhtml, $found );

$url = $found[1];

 

$return_to = "http://localhost:8080/OpenID/complete.php";

 

$url .= "?openid.mode=checkid_setup";

$url .= "&openid.identity=".urlencode( $_REQUEST['url'] );

$url .= "&openid.return_to=".urlencode( $return_to );

?>

<html>

<body>

<a href="<?php echo($url);?>"><?php echo($url);?></a>

</body>

</html>

 

 

but this is the output im getting on my browser when i enter the id in index.php and submit it : ( goes to forward.php and this is being displayed)

 

", $idhtml, $found ); $url = $found[1]; $return_to = "http://localhost:8080/OpenID/complete.php"; $url .= "?openid.mode=checkid_setup"; $url .= "&openid.identity=".urlencode( $_REQUEST['url'] ); $url .= "&openid.return_to=".urlencode( $return_to ); ?>

 

 

I think there is an error in the preg_match() function, some mismatch

 

Since am new to everything im talking about, pardon my noobness :)

Link to comment
Share on other sites

when i run

<?php

phpinfo();

?>

 

i get a blank page

 

is it fine?

 

No, you should get a page which displays all of php's settings. It would appear mod_php is not configured properly.

 

also need to enable curl support for php/apache..

that requires me to compile php.. with    --with-curl=../curl-7*

 

do i have reinstall php? is there a way to add it with out recompiling?

 

I thought you said you installed apache and php via adept. Adept does not build from source code.

 

You can build an extension and add it into php without recompiling all of php but we will first need to know exactly how you installed php and apache.

Link to comment
Share on other sites

when i do phpinfo() in konsole i get this :

 

# php testphp.php

 

array(9) {

  ["version_number"]=>

  int(462852)

  ["age"]=>

  int(3)

  ["features"]=>

  int(1597)

  ["ssl_version_number"]=>

  int(0)

  ["version"]=>

  string(6) "7.16.4"

  ["host"]=>

  string(17) "i486-pc-linux-gnu"

  ["ssl_version"]=>

  string(15) " OpenSSL/0.9.8e"

  ["libz_version"]=>

  string(7) "1.2.3.3"

  ["protocols"]=>

  array(9) {

    [0]=>

    string(4) "tftp"

    [1]=>

    string(3) "ftp"

    [2]=>

    string(6) "telnet"

    [3]=>

    string(4) "dict"

    [4]=>

    string(4) "ldap"

    [5]=>

    string(4) "http"

    [6]=>

    string(4) "file"

    [7]=>

    string(5) "https"

    [8]=>

    string(4) "ftps"

  }

}

 

but when i run apache tomcat and access that, i get blank page

 

 

This is how i installed the softwares.. in order of installation

 

1) apache tomcat 6.* .. installed it while installing netbeans 6

 

2) php5, libcurl3 , php5-curl through adept .. ( first php5 .. then found out that curl was required.. then libcurl3 )

 

3) then tried curl command in konsole.. didnt work.. downloaded the curl-7.17.1.tar.gz from website.. installed it.. curl seems to work in command line ( atleast the man page now shows up)

 

how do i set right, mod_php ?  o.o

 

am sorry that im wasting time of such a knowledgeable person :(

am happy that im getting help from such a knowledgeable person :)

Link to comment
Share on other sites

ok..

 

i removed and reinstalled stuff

 

now i have tomcat 5.5 , php5 .. libcurl3

php5-curl is uninstalled

 

i put the php page in /var/www

 

phpifo page gives me details about php

 

now i need to enable curl extension

and also need to add a directory to php include path..

 

how do i do these..  i should be done if i do these

 

Link to comment
Share on other sites

Sorry, I forgot about this thread.

 

In your php.ini there is a section on loading dynamic extensions. Simply add...

 

extension=curl.so

 

and providing curl is in your extensions directory it should load on next server restart.

 

As for your include path, there is also a derective for that in your php.ini file. Its all pretty well commented, post again if your stuck.

Link to comment
Share on other sites

i was under a proxy..  and it didnt occur to me that it would be the proxy which was preventing curl from getting the files..

 

had to set proxy in curl..  curl_setopt($c , CURLOPT_PROXY, "proxyaddr:port");

 

i might have made mistakes in actual parameter names.. ( while typing it in here )

 

am so thankful for all your replies

 

thanks again

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.