Install php-curl in Openwrt - php

I have to install php5-curl in my OpenWrt. I followed the steps of the official site
When I type, I see available packages:
$ opkg list php5*
but, I don't see php5-culr or php-curl. However, I change the line:
;extension=sockets.so
To:
extension=sockets.so
In php.ini file And also, add a file php_curl.ini in etc/php5/ and restart the server (lighttpd) and nothing happened.
Any help to get CURL in OpenWrt?

Related

How to enable php5 curl on Ubuntu 14.04?

I have installed curl on Ubuntu 14.04 running PHP 5.6 with the following commands:
sudo apt-get install php5-curl
sudo service apache2 restart
It returns a successful message, but when I run:
php -m
the curl module is not listed, and phpinfo(); does not recognize it as installed or active. I also tried adding:
extension=curl.so
to my php.ini file, but that had no effect. How do I get PHP to recognize that curl is installed?
I got it working based on the second answer listed here: https://askubuntu.com/questions/9293/how-do-i-install-curl-in-php5
Basically:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.6-curl
sudo service apache2 restart
I'm not really sure what made the difference. The repository reference is the most significant difference from previous attempts, but it seems odd as prior installation attempts didn't appear to have any problem accessing or installing/updating php-curl. And I had made sure everything was updated several times. But whatever it was, the above resolved it.
ssh to your server and cd to /
find / -name 'curl.so'
Run the above find command to locate where the curl binary is hanging out at. If you can't find the file, you might need to install curl and run the find command again.
apt-get install php5-curl
You'll now want to edit the php.ini being used for php files run from the cli (it's different than the one used by apache), and is likely at /etc/php5/cli/php.ini
nano /etc/php5/cli/php.ini
You can also run
php -i | grep 'php.ini'
To get the file path, just to be sure.
In your php.ini file search for [curl] by pressing ctrl + w
You'll now want to add the extension to the file and it should look something like the following, though your path to the curl.so file and such might be a little different:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
extension=/usr/lib/php5/20131226/curl.so
After doing the above, I was able to use curl in php scripts run from the cli.

Wordpress Plugin - cURL is not installed on this server

I'm getting the following message in a Wordpress plugin - OneSignal.
OneSignal Push: cURL is not installed on this server. cURL is required to send notifications. Please make sure cURL is installed on your server before continuing.
I'm running WordPress 4.6.1 on LEMP stack - Ubuntu 14.04.5, Php5.5.9
As per few suggestions from Stackoverflow, I've installed php5-curl and have the curl.so file in the extension_dir. I've added the line extension=curl.so in php.ini file in /etc/php5/fpm
Still the error doesn't seem to go away. What needs to be done here?
You probably need to install php5.6-curl like this: sudo apt-get install php5.6-curl

Error while running PHP project

Am running a project based on PHP for the first time in my machine, got error in php-sdk path saying Facebook needs the CURL PHP extension. What should be done to make it work ?.
Enable the curl php extension.
Follow this steps to enable
Install php curl
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
Open php.ini file and add this line after finish installation
extension=curl.so
Restart the apache server
/etc/init.d/apache2 restart
Then in a new php page type:
<?php
phpinfo();
?>
You will find curl is included in php info page.

php5 curl: Recompiling does not reflect in phpinfo

I am trying to get curl to work on my Oracle Linux OS, but I am running into some walls. I am loading my phpinfo() page using an Apache + Django combined server. Furthermore, I have made sure to uncomment the extension=php_curl.dll line in the php.ini file, and I have added the extension=curl.so line. I have also attempted to compile php again using ./configure --with-curl=/usr/include/curl/, followed by the make and sudo make install method calls. However, this recompiling is not reflecting in the phpinfo() page, which still shows a later build date and a different configuration command. As an added note, I am pretty sure I have curl installed. I've run sudo yum install php-curl and sudo yum install curl, and both have responded to me, saying that the php-common and curl packages, respectively, have already been installed.
Does anyone have any advice? Thanks.
I had a similar problem and the solution was to install libcurl & libcurl-devel.

Can't Install libcurl PHP on Ubuntu Linux

I am trying to use the new facebook api and it requires libcurl PHP. I used
sudo apt-get install php5-curl
sudo apachectl -k restart
And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl.
The source of this problem is probably that I built some of the tools from source (apache2, php), but then I got bored so installed a lot of the extensions with the package manager. But I'm not exactly how to go about diagnosing the point of failure.
The apt-get install for curl definitely worked, and can be found in
/usr/lib/php5/20060613/curl.so
I think a lot of my confusion stems from not knowing which files go where, and what purpose they have. Any help would be appreciated, and please tell me if I need to provide more information.
edit:
The specific error I get is:
Exception: Facebook needs the CURL PHP extension.
from line
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
Ubuntu: 9.10
PHP: 5.2.13
Loaded Configuration File: /etc/php5/apache2/php.ini
In general it's a bad idea to mix and match software from your distribution's package manager with stuff you've built yourself. The package manager will not know anything about the stuff you've built yourself and so can get confused.
Not only that but who's to say the stuff from the package manager is even binary compatible with the stuff you've built yourself? If you build it all yourself then at least you know it will all be compatible.
Sounds to me like you should uninstall the extensions and build them yourself. If you can't or don't want to do that then go back and install apache and friends through your package manager but I would recommend having patience and going for the former option.
Answer of Questions
What version of Ubuntu?
What version of PHP?
How is Apache and PHP set up?
What ini files does phpinfo() say is parsed? (should be near the top)
Perhaps apt failed to properly modify your php.ini file to load the curl extension?
Check out your php.ini and see if you have line like:
extension=curl.so
or maybe:
extension=/usr/lib/php5/20060613/curl.so
To check if php-curl is installed please follow these steps:
Create a file in your web server (in Ubuntu it would be in /var/www folder), name it info.php
Open that file and type this command:
<?php phpinfo(); ?>
Save that file
Open your favorite browser and open that file (ex: http://localhost/info.php)
Now you will see the Information about your PHP installation
Search for Curl, and if you cannot find it, it mean your php doesn’t have curl installed.
To install php-curl please follow these steps:
Open your terminal and type this command:
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
After it finish open php.ini file (mine is at /etc/php5/apache2/php.ini ) and add this command: extension=curl.so
Save the file and restart apache with this command:
/etc/init.d/apache2 restart
Check the PHP information page again, you will find PHP-CURL installed
That’s it
Source: http://www.ivankristianto.com/os/ubuntu/howto-install-curl-in-php-apache/379/

Categories