enable curl in xampp, windows - php

trying to enable curl in xampp 3.0.12 in windows environment.
Updated the php.ini in the php folder to enable curl, and there is no php.ini file in the apache/bin folder.
phpinfo() says:
loaded configuration file: C:\xampp\php\php.ini
curl support:enbaled
curl information: 7.24.0
and when i try to run a http_get() command php says:
Fatal error: Call to undefined function http_get()
Restarted both windows and xampp several times to update the changes.
Would be grateful for some advice, as I searched through similar topics on the web but can't get any further.

Note that the function http_get() belongs to the pecl http extension and not to the curl extension. Refer to the documentation of the curl extension to learn how you can use it to retrieve documents via http. You'll also find a lot of posts on stackoverflow
Also note, that the function file_get_contents() can be used to get documents over http in a very simple way. Although it is limited it will fit in much cases. To retrieve a page you can issue:
file_get_contents('http://www.server.com/page.html');

Related

Bitnami unable to enable Curl

i AM USING A aws lightsail instance with a Bitnami Apache2 Lampstack setup on it.
My issue is I am unable to get php curl enabled. I seem to have a bunch of php.ini files all over the server in diffiferent locations. So I edited all of them removing the ; from the line that read extension=curl. I then restarted the instance. However my php file is still giving me the error saying
caught Exception: Shippo needs the CURL PHP extension.
When I run a phpinfo() I see my path to the ini file is /etc/php/8.0/apache2/php.ini
However when I do a which php command I am giving a path like this /opt/bitnami/php/bin/php
when I do a php -v I am also seeing it say PHP 7.4.27 so my php info file seems to say I am using php7.8 and my CLI feels i am using php7.4 which could be part of my issue.
Any suggestions on how to fix this? my other issue is I am having a hard time getting to the path /etc/php/8.0/apache2/php.ini I simply can not find a folder with 8.0 in it

cURL installed on Windows... but how to get it to work with PHP code?

Background:
I'm trying to get tweets from a specified username using PHP and OAuth. This example seems very useful. My problem is that my code doesn't return from the $feed = curl_init(); line near the bottom. There are no errors displayed, I only know that it stops because my debug statements after that line are not executed.
I didn't have cURL installed so I installed it on my Windows machine (using this example). It still doesn't produce any errors, it just leaves and never comes back.
Question:
How do I access cURL from my PHP program where I want to use it?
You need to download the windows php zipped manual installer from windows.php.net, the manual zip comes with all the extensions. Once php has been installed, enable the CURL extensions.. and any other extension that you need in the php.ini file. Copy the php-production.ini to %systemroot% directory and rename it to php.ini.
Hope that helps !!!

Openssl php not working

I am trying to build a twitter feed to search for relevant hashtags and display them in my mobile app. I found a package at http://mlemos.users.phpclasses.org/package/8109-PHP-Generate-RSS-feeds-from-timelines-and-searches.html that seems to do the job. However, opensll isnt loading. i get Error: it was not possible to open the API call URL: establishing SSL connections requires the OpenSSL extension enabled. Now, i have used open ssl on this machine before, and phpinfo says it is enabled. i have checked my php.ini file to make sure the line is uncommented, as well as check my path variable. No success. Google has turned up nothing helpful. Any ideas? Thanks
Ended up using a twitAPI handler package

Unable to use PHP curl on amazon ec2 free tier

I am currently moving my web app to amazon ec2. Since it's only for testing, I use the free version called ec2 free tier with windows server 2008 instance. However, Although I have done all I know and read this thread ( How to enable cURL in PHP / XAMPP ). I just couldn't use curl on my php script. it always creates the error
Call to undefined function curl_init() in C:\xampp\htdocs\index.php on line 2
Here are all thing I have tried
Install Wamp ( I tried it on XAMPP to)
Uncomment out php_curl in php.ini file ( and restart apache)
Copy two dll files to both system32 and syswow64
Could it have to do with the fact that I am using free vps?
Update:
Also, when I started the apache server in XAMPP , this error appeared
'PHP Startup: unable to load dynamic library curl.dll'
However, I have double checked the ext directory and the php_curl.dll was in there.
i think curl need to access remote sever from our web server. so i opened all traffic in my server outbound rule and it works. i think this is not good solution. still look for better way.
nope.
be sure, that you have the files in the right place, usually its in the plugins folder for php! maybe you cann add a absolute path to your php.ini!
be sure, you edit the correct ini file!
php completly independent to your operatingsystem!
just be sure to doublecheck everything. because its not saying, it has trouble loading your extention, its just saying, the function your trying to call, is not there. so i assume your extention ist not loading at all! :)
One reason I did notice for this cURL plugin to malfunction was the availability of copies of libeay32.dll and ssleay32.dll files. Please check whether your system32 folder has such copies and if so, please rename them to some other names and copy the ones found with the php installation. Sometimes you may need to restart your machine. This was documented here some time ago.
I had a similar problem, but it occours just with requests under https. I tried to create a curl request directly from the ec2 machine and got a error: "curl: (77) error setting certificate verify locations".
It looks like some kind of ssl validation fail because of a certificate not found. So I used a parameter -k (or --insicure) in my curl command, to ignore this validation and after that my curls request did directly from ec2 machine worked.
So I tried to apply a similar ideia in my curl command in php, (I suppoused that the curl php extension forward this requests to the operation system) and I found this curl opt:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
After that it works to me.
Probably this isn't the best way to solve the problem, but solved my problem temporarelly.

PHP SOAP cannot connect to an SSL WSDL source

Trying to make Soap connection to a https:// WSDL source via PHP/Win32, but keep getting the error:
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning
: failed to load external entity "https://...
If I try to save the WSDL locally and access it then, the SoapFault->faultstring property has the message "SSL support is not available in this build".
After some Googling, seems like PHP SOAP cannot connect to a HTTPS source. HTTP is OK, though.
Is there a workaround for this? Or is there an alternative SOAP version/module I can install?
HTTPS support for SOAP in PHP5
If you’re seeing error messages about missing https wrappers when trying to use SOAP (”Unable to find the wrapper “https” – did you forget to enable it when you configured PHP?” or “[HTTP] SSL support is not available in this build”), you haven’t installed the SSL libraries to support secure transactions.
Uncomment
extension=php_soap.dll
in your php.ini
Uncomment
extension=php_openssl.dll
in your php.ini
Copy
ssleay32.dll
and
libeay32.dll
to your windows system32 directory
Reboot apache, et voila!
I originally found this answer at: http://webponce.com/rants/2008/04/https-support-for-soap-in-php5-under-windows/
I had the same problem. openSSL, cURL were enabled, initiated a SoapClient with option of location to stored certificated, etc, etc.. tried everything.
Turns out it does work in CLI mode. Thus php_sapi = CLI.
As we almost always run our webservices calls as a cronjob, scheduled task in Windows, this is not really a bad thing. I was really glad to get it working!
Update:
Okay, turns out when PHP is running as an Apache module, it uses the by opensll required libraries libeay32.dll and ssleay32.dll from the Apache install. When using PHP in CLI is uses the libraries from the PHP directory/install. Overwriting the 2 Apache dlls with the dlls from the PHP directory did the trick. It now also runs under Apache.
So your PHP version should match with the working dlls for the specific version. When it still doesn't work in the web interface. Please check that Apache isn't loading these dlls from a Windows System directory, specified earlier in your system defined path, which is picked up by Apache.
I've had success with SSL and SOAP using NuSOAP:
http://nusoap.sourceforge.net/

Categories