Jump to content

Curl Working In Php, Not On Linux Command Line


crwork

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

 

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.