crwork Posted October 10, 2012 Share Posted October 10, 2012 Ok, I'm able to get cURL running via PHP code on a dev server. But if I log on to the Debian linux server and try curl from the command line I get the message: '-bash curl:command not found' If I type php -m, 'curl' is in the list; however this server is using the Zend framework so at the bottom of that list it says [Zend Modules]. I can't seem to find where curl is installed on the server. It's working from PHP, but I feel like I'm in the Twilight Zone because I can't run it on the command line. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/269307-curl-working-in-php-not-on-linux-command-line/ Share on other sites More sharing options...
kicken Posted October 10, 2012 Share Posted October 10, 2012 Enabling curl in PHP only requires the libraries for curl, not the binaries which is what you'd need to run curl from the command line. You'll have to install the curl package for that before you can use them. sudo apt-get install curl would install it for ubuntu. I'm not familiar with any other distros. Quote Link to comment https://forums.phpfreaks.com/topic/269307-curl-working-in-php-not-on-linux-command-line/#findComment-1384209 Share on other sites More sharing options...
crwork Posted October 10, 2012 Author Share Posted October 10, 2012 Thanks for clarifying. So to install cURL, or any package for that matter, the package already exists on the Linux distribution, but is "dormant" until you manually install it? Kind of like an add-on? I'm also getting command not found for sudo. Is that another binary to install? Yep, I'm a newb. Quote Link to comment https://forums.phpfreaks.com/topic/269307-curl-working-in-php-not-on-linux-command-line/#findComment-1384213 Share on other sites More sharing options...
kicken Posted October 10, 2012 Share Posted October 10, 2012 So to install cURL, or any package for that matter, the package already exists on the Linux distribution, but is "dormant" until you manually install it? Kind of like an add-on? It doesn't exist already on the system (typically). The command I referenced above will download it from the package distribution site and then install it. As I mentioned too, that command is for Ubuntu, I'm not sure if it will work on Debian or not as I've not used that distro. The reason why you can have cURL enabled in PHP but not have the command is because there are two parts. cURL is mainly a library, which means it is just a bit of software you plug-in to another program to enable certain functionality. In order to use a library you have to have an executable file to run that makes use of that library. When a project develops a library, they will typically include a small executable that uses the library, either for testing or for general use. Package maintainers for the systems will typically separate the library files from the executable files, allowing you to install them separately. They do this because you may need the library for a different program, but not need the executable. For example, PHP needs the library for cURL to use it. PHP doesn't need the executable file though so there is no reason really to install it. I'm also getting command not found for sudo. Is that another binary to install? sudo is part of a base install for ubuntu, it may not be in Debian. If you have root access you do not need to use sudo, just run the apt-get install curl directly. The sudo command is used for running another command as root (kind of like the 'Run as Administrator' option in windows, if you're familiar with that). Quote Link to comment https://forums.phpfreaks.com/topic/269307-curl-working-in-php-not-on-linux-command-line/#findComment-1384230 Share on other sites More sharing options...
crwork Posted October 10, 2012 Author Share Posted October 10, 2012 Thanks kicken for taking the time to explain that. I was banging my head against a wall, but it makes more sense now. Quote Link to comment https://forums.phpfreaks.com/topic/269307-curl-working-in-php-not-on-linux-command-line/#findComment-1384244 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.