how to enable php curl for use in php cli - php

I've installed php on my computer without a server and running it using cli php curl isn't enabled and I don't have a clue how to do it.

In case someone comes across this thread and uses wamp server, here's a quick fix for the problem above http://forum.wampserver.com/read.php?2,47455

How use cURL library when running PHP through Command Line
you need first to install cURL
http://curl.haxx.se/docs/install.html
http://it.php.net/features.commandline [via Web Archive]

Related

Is cURL in PHP tied to the local install of cURL?

IE, does PHP use its own, internal version of cURL or does it use whatever it finds in the local OS (Windows 10)? I'm in the unfortunate position of trying to make scripts written in 7.4 work on a permanent home that's saddled with 7.1. Before I force an update of PHP, I want to make sure chasing the right problem. I've searched php.ini and don't see a path to the local file system.
Thanks!
The curl functions in PHP do not call out to a command-line version of curl, but rather to a library which can be integrated into a C program.
This version may be included "statically" when PHP is compiled, be a separate file installed alongside PHP, or use a shared file installed centrally on the server and used by multiple programs. This will be determined by the distribution package of PHP.
To determine the library version used, use the phpinfo() function, or run php -i on the command line (which just runs that function for you) and search for "curl", which will show the version.
I'm not sure what your question is.
IE is not an issue here.
I always keep a script that gives me the current state of PHP.
PHP Manual, phpinfo()
<?php
phpinfo();
?>
phpinfo will return something like this if curl is (likely) installed.
I learned through the process of installing PHP 8.1 in my dev env and configuring it to use curl (and a comment), that PHP does call it's own curl executable, in the case of windows 10: php_curl.dll, and does not make an external call to curl in the operating system.
My fear was I'd go through the process of getting someone to upgrade PHP then have to have ask, again, to have curl upgraded.
Thanks to all who offered input!
yes, but curl is an extension, you need to enable it in php.ini file

cURL is already installed but still giving this error Elasticsearch-PHP requires cURL, or a custom HTTP handler

I am trying to implement Elastic-search in my Laravel project but it is giving this error.
Elasticsearch-PHP requires cURL, or a custom HTTP handler.
I double checked it for cURL and it is loaded inside my php also I was previously working on some other project and send many requests to different API's through cURL and it is working over there but inside laravel it gives me this error.
Why my xampp is doing so and how can I fix this issue Thank you in advance.
I think you have multiple instances of PHP installed. Check your Windows Enviroment Variables, to see from where PHP is running. Assuming your using Git, do a php -v in your terminal to see which php version is loaded and check if it corresponds with the php from your xampp. Or delete xampp and install it in a new folder like, webserver/xampp. Enables the php modules, restart your apache and mysql and check your phpinfo().

change curl extension in php(xampp)?

I have recently build curl with http2 support using visual studio. I have tested the curl.exe on command prompt. It is working as expected.
My requirement is that i have to use this built curl in my website running in xampp.
I know that the php in xampp already has its curl extension. It is in the file php.ini on line 878.
extension=php_curl.dll
It is in .dll
How can i change this so that it points to my built curl.
If it is not possible in xampp, you can suggest some other away. But my requirement is that i have to use this built curl in my php project.
Thanks.
Copy your version of the DLL's into the \xammp\php\ext folder. That is where PHP gets them from, and thats all you need to do apart from restart Apache.
Better make a backup of the originals in case yours dont work

Working with PHP offline

Is there a tool or extension for a browser to working with PHP offline? I read about you need to install an Apache server.
Is there an easier way to view offline in browser to see how the PHP code executes?
XAMPP sets up a local install of MySQL, PHP, and Apache that you can develop on.
In Windows, install XAMPP or WAMP
Which are Windows Apache Mysql and Php bundles
In Linux install LAMP
Which is a Linux Apache Mysql and Php bundle
Both of which could help
Nope, simpler than xampp is not possible.
This won't be much use to you now, but there has been recent talk (and submission of code) of providing a built-in web server into PHP itself.
See the RFC at https://wiki.php.net/rfc/builtinwebserver
You could then write your script (e.g. app.php), execute php -S localhost:8000 to start the web server and then see the results in your browser at http://localhost:8000/app.php.
In the mean time, you can install Apache/PHP/MySQL/etc. on your local box, as the other answers have suggested, either manually or with a package like XAMPP.
No. PHP code must be processed by a PHP engine, and the easiest way to do so in a web environment is to use a web server. It does not need to be httpd, but it must be something.
if you are on a Mac, you have Apache installed already. the additional instructions you will need to add PHP and MySQL database server can be found here http://www.entropy.ch/software/macosx/
if you are using Windows, XAMPP is a self contained Apache/MySQL/PHP environment that runs as a stand alone application.
that should get you started. good luck

cURL binary location

I have to set up curl on my windows 7 box for development. I've never had to use curl before so I'm lost on the install procedure. I've downloaded the binary executable and unpacked it. There is only the executable and no documentation. I can run the binary from the command prompt with no problems but where do I put this file?
Are there any other libraries that are required to use it with PHP? There is not much documentation on the curl site. Any help would be appreciated.
Also, something that has me a little worried is that I've uncommented the curl option in my php.ini file and when I restart Apache, Apache crashes. Why is this?
apache error 1067
I am not sure I understood your use use case completely, but looks like what you need is the libcurl.dll and not the curl executable itself.
PHP does not use the cURL standalone command line application, but libcurl. As such, you need to make sure php_curl.dll can be found by your PHP executable.

Categories