Install PHP cURL on Amazon EC2 Micro Instance - php

I need to install PHP cURL on my Amazon EC2 Micro Instance.
I found a terminal code which should install PHP cURL through PuTTY.
sudo apt-get install php5-curl
But I get a lot of 403 Forbidden errors.
I'm not good with Linux so I didn't really understand what those errors mean.
This is a screenshot of all the errors.

Please try installing PHP curl with below command (Ubuntu)
sudo apt-get install php-curl
For Amazon Linux
sudo yum install php-curl

the 403 is from the source repository,
Try
sudo-apt-get update
before the install. If that still doesn't fix it, add these lines to the /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu lucid main multiverse universe
deb http://us.archive.ubuntu.com/ubuntu lucid-security main multiverse universe
deb http://us.archive.ubuntu.com/ubuntu lucid-updates main multiverse universe

Related

APT says 'package has no installation candidate' althought it shows it in apt list

I am trying to install ZeroMQ extension for PHP using Docker image php:7.4-apache-buster.
The package is found when running apt list:
$ sudo apt update && apt list php-zmq outputs php-zmq/stable 1.1.3-9 amd64
It is not possible to install it however:
$ sudo apt install php-zmq outputs E: Package 'php-zmq' has no installation candidate
I have checked that the package is not already installed using apt list --installed php-zmq. Underlying libzmq5 library is present on the system.
I wonder how does apt list command work that it suggests packages which apt install is unable to install.
Thanks for any help.
The package php-zmq is available in debian main repository , you need to edit your sources as follows:
deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian-security/ buster/updates main
deb http://deb.debian.org/debian buster-updates main
Edit
Manual install:
sudo apt install gdebi
wget http://ftp.us.debian.org/debian/pool/main/p/php-defaults/php-common_69_all.deb
wget http://ftp.us.debian.org/debian/pool/main/p/php-zmq/php-zmq_1.1.3-9_amd64.deb
sudo gdebi php-common_69_all.deb
sudo gdebi php-zmq_1.1.3-9_amd64.deb

Debian 8 Jessie and PHP > 7.2

I recently restored my personal test server with a completely fresh install of Debian 8.
The Service Provider where I purchased the Virtual Server, has only the Debian 8 option. So there is currently no possibility to upgrade to stretch or buster (9 and 10).
I need to install at least PHP 7.2 on my server to meet the requirements for the project and I'm having a hard time accomplishing that. As www.dotdeb.org seems to be discontinued I am wondering what package source I should add for PHP 7.2. All I found googling around was when dotdeb was still providing 7.2 packages.
My sources.list looks like this:
deb http://debian.mirror.serverloft.de/debian/ jessie main contrib non-free
deb http://debian.mirror.serverloft.de/debian-security/ jessie/updates main contrib non-free
deb http://packages.dotdeb.org jessie all
deb https://packages.sury.org/php/ jessie main
deb-src http://packages.dotdeb.org jessie all
but when I do
apt-get uptate
apt-get install php 7.2
I get
E: Unable to locate package php7.2
E: Couldn't find any package by regex 'php7.2'
Maybe there is no such option anymore and I have to change the provider to get a higher Debian version?
You can install the php 7.2 or later in debian jessie. But you need to follow some steps for getting this. The main reason is debian platform has been stopped the sury package service for jessie. Please check this link https://packages.sury.org/php/dists/
Now you know, it's not have the jessie support.
Okay Now we start the process of php 7.2 installation
Open /etc/apt/sources.list and add deb http://ftp.de.debian.org/debian stretch main.
It helps to get the stretch repos for the supporting dependencies of php 7.2
$ sudo apt update
$ sudo nano /etc/apt/sources.list.d/php.list.
then add deb https://packages.sury.org/php/ stretch main. this is also a stretch repo
$ sudo apt update
Now the php needs the updation of libncurses5 >= 6
check the current available version of libncurses5
$ sudo apt search libncurses5 //it shows you the libncurses5 as 6.0
$ sudo apt install libncurses5
$ sudo apt-get install php7.2 php7.2-readline php7.2-cli php7.2-fpm
$ sudo apt install php7.2-common php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-curl php7.2-gd php7.2-imagick php7.2-dev php7.2-imap php7.2-mbstring php7.2-opcache php7.2-soap php7.2-zip php7.2-intl -y
check unix socket is found in /var/run/php
Now you found php7.2-fpm.sock in this directory
Last step. just start the php service: $ sudo service php7.2-fpm start
Now you check the status and version of php $ sudo service php7.2-fpm status && $ php -v
Hurray. you got the newest version of php. Thanks a lot
Note: Don't forget to stop the previous service for php in your machine
I've got PHP 8.0 from this all-in-one bundle: https://bitnami.com/stack/lapp/installer
It does not depend on Linux distro

problems install php in debian

I have been tried install php in debian 9 but not working to me.
I did this command:
sudo apt-get -y install php7.0 libapache2-mod-php7.0
Error after it:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php7.0 : Depends: php7.0-cli but it is not going to be installed
Depends: php7.0-opcache but it is not going to be installed
Depends: libc6 (>= 2.27) but 2.24-11+deb9u3 is to be installed
E: Unable to correct problems, you have held broken packages.
(i tried to install this dependencies but i cant, always it depends to another one)
the /etc/apt/sources.list
#
# deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ - Official amd64 NETINST 20180310$
# deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ - Official amd64 NETINST 20180310$
deb http://ftp.br.debian.org/debian/ stretch main
deb-src http://ftp.br.debian.org/debian/ stretch main
deb http://security.debian.org/debian-security stretch/updates main
deb-src http://security.debian.org/debian-security stretch/updates main
# stretch-updates, previously known as 'volatile'
deb http://ftp.br.debian.org/debian/ stretch-updates main
deb-src http://ftp.br.debian.org/debian/ stretch-updates main
deb http://http.us.debian.org/debian/ wheezy main contrib non-free
Anyone can help me?
Thanks advance
It seems you've merged in your apt file wheezy and stretch releases of debian. Try removing the last line of your file :
deb http://http.us.debian.org/debian/ wheezy main contrib non-free
and then try an apt-get update command. Then you could try to install php7.
But be aware that if you're starting from an wheezy install, you must upgrade it to stretch before trying to install php7.0

Unable to install PHP zip archive with PHP 7.2

I am running into some issues installing the PHP zip archive and not sure how to fix this. I am running Ubuntu 18 with PHP 7.2
The error I receive in terminal is
The following packages have unmet dependencies.
php7.2-zip : Depends: php7.2-common (= 7.2.5-0ubuntu0.18.04.1) but 7.2.5-
1+ubuntu17.10.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
Any help would be appreciated, thanks
I tried changing the repository list with:
http://security.ubuntu.com/ubuntu bionic-security main universe
http://archive.ubuntu.com/ubuntu bionic main restricted universe
But none of them seem to work, but I finally found a repository that works running the following command
add-apt-repository ppa:ondrej/php
And then updating and installing normally the package using apt-get
php7.2-zip Installed
As you can see its installed at last.
On Ubuntu 18.04, this can happen if your missing the "security.ubuntu.com/ubuntu bionic-security main universe" repo.
Add it to your /etc/apt/sources.list, update and then it will install normally.
echo "deb http://security.ubuntu.com/ubuntu bionic-security main universe" >>
/etc/apt/sources.list
apt update
apt install php7.2-zip

Ubuntu 16.04 The mbstring extension is missing

I want to migrate my web server from unsupported version of ubuntu 12.10.
I installed 16.04 and installed apache2, php7, mysql and phpmyadmin.
When I want to use phpmyadmin I have error that mbstring missing.
In PHP.ini file, there is only to enable this extension for windows only.
When I install mbstring package, then when I reload phpmyadmin page, I get blank page without any error.
I installed following packages:
apache2, php, libapache2-mod-php, php-mysql, php-mbstring, php7.0-mbstring, mysql-server, phpmyadmin
When i uninstall mbstring packages, after phpmyadmin reload I see mbstring extension error...
What to do? I spent two days to fix this but have been unsuccessful...
Thanks
After you have installed the php7.0-mbstring module, you'll need to restart apache2 for it to take effect: sudo apachectl graceful
I found the correct way (for me) to correct it... and it's fairly simple :)
Just add "universe" on the xenial-updates.
# cat /etc/apt/sources.list.d/*
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-backports main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial main universe
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-proposed main
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-updates main universe
to do that, just
sudo nano /etc/apt/sources.list.d/*
and then close all the windows, except the ones with xenial-updates where you add universe at the end of the line!
You could also just do this:
sudo add-apt-repository universe
On older versions of Ubuntu, you might have to add a full deb source line:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
After adding the repositories, do sudo apt-get update to update the package list.
check installed modules using;
php -m
in here you couldn't see mbstring module
Then check the php version
php -v
Then install module using following command
php5.6-mbstring
Restart the apache server
service apache2 restart
finally thats work fine.
I solve this problem from this post.
1-Install mbstring module according to your php version
$ sudo apt-get install php7.2-mbstring
2-Install libapache2-mod module according your php version
sudo apt-get install libapache2-mod-php7.2
3-Restart your apache2 services
sudo service apache2 restart
Ressource Link

Categories