For a while now, I'm trying to install the php7-mysql driver into different PHP docker containers from php/docker with no luck.
My Dockerfile looks like this:
# Dockerfile
FROM php:7.3-rc-apache-stretch
RUN apt-get update && apt-get upgrade -y
When I attach to the container and try to run
apt-get install php7.0-mysql
Debian stretch says that it has no installation candidate.
E: Package 'php7.0-mysql' has no installation candidate
What can I do to be able to install php7.0 modules to Debian Stretch?
Thanks in advance, this really took me some pomodores now!
It appears you are missing the repository for php7.
Adding the php7 ppa:
sudo add-apt-repository ppa:ondrej/php
Then update:
sudo apt-get update
Now do a search to confirm php7 is there:
sudo apt search php7
Now install the php7 package:
sudo apt install php7.0-mysql
Did not work with ppa:ondrej/php but this works:
sudo apt-get update
sudo apt-get install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update
sudo apt-get install php7.0-mysql
You can also install php7.0 from there
Related
I have installed xampp for linux from https://www.apachefriends.org/index.html in my Ubuntu 22.04 OS
After successfully installed, my project is running fine but when I install the php-memchached in my system with the below command but it is not showing in my phpinfo() page.
Command:
sudo apt-get install -y php-memcached
Also I tried with the code to check my Memcached Successfully installed or not. But I got the error message that Class 'Memcached' not found
Code:
$memcached = new Memcached();
$memcached->addServer("127.0.0.1", 8080);
$response = $memcached->get("sample_key");
if($response==true) {
echo $response;
} else {
echo "Cache is empty";
$memcached->set("sample_key", "Sample data from cache") ;
}
Error Output in Yii console:
Class 'Memcached' not found
Please let me know how to install the php-memcached in Xappp for my ubuntu system?
php-memcached extension uses the libmemcached library to provide an API for communicating with memcached servers.
So, This extension requires libmemcached client library.
The steps. Tried successfully from a basic ubuntu:22.04 image:
FROM ubuntu:22.04
RUN apt-get update && apt-get upgrade -y && apt-get install -y net-tools sudo wget nano
And xampp install:
cd /home
sudo wget https://downloadsapachefriends.global.ssl.fastly.net/8.1.6/xampp-linux-x64-8.1.6-0-installer.run
sudo chmod 755 xampp-linux-x64-8.1.6-0-installer.run
sudo ./xampp-linux-x64-8.1.6-0-installer.run
Then, there are a lot of dependencies to install:
sudo apt-get update
sudo apt-get install -y memcached
sudo apt-get install php-pear
sudo apt-get install libcurl3-openssl-dev
sudo apt-get install php-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libmemcached-dev
sudo pecl install memcached #note the path to memcached.so
sudo nano /opt/lampp/etc/php.ini
add extension=/usr/lib/php/20210902/memcached.so #path noted before
sudo /opt/lampp/lampp restart
Or another possible install:
sudo apt-get update
sudo apt-get install autoconf
sudo apt-get install build-essential
sudo apt-get install -y pkg-config
sudo apt-get install zlib1g-dev
sudo apt-get install libmemcached-dev
sudo /opt/lampp/bin/pecl install memcached #note the path to memcached.so
sudo nano /opt/lampp/etc/php.ini
add extension=/opt/lampp/lib/php/extensions/no-debug-non-zts-20210902/memcached.so #path noted before
sudo /opt/lampp/lampp restart
With your code:
$memcached = new Memcached();
$memcached->addServer("127.0.0.1", 8080);
$response = $memcached->get("sample_key");
if($response==true) {
echo $response;
} else {
echo "Cache is empty";
$memcached->set("sample_key", "Sample data from cache") ;
}
Results:
Cache is empty
And phpinfo:
Reference for more details:
https://www.php.net/manual/en/book.memcached.php
Steps for installing php-memcached in ubuntu
first, go to the /opt/lampp/bin/ then run the below command
> sudo apt-get install libmemcached-dev
> sudo pecl install Memcached
OR
> /opt/lampp/bin/pecl install memcached
Once installed then open php.ini(my ini path /opt/lampp/etc/php.ini) and add the below line in that file
extension=memcached.so
Finally, restart XAMPP
> sudo /opt/lampp/lampp restart
I installed php7.4 (previously running 7.0.33) on my server and now every time I try to visit my website, it just downloads the laravel index.php file instead of displaying it.
I understand that this means something is not configured correctly with apache (I don't have Nginx), but I can't figure out what! I've been looking for hours!
This is what I did to install (based on this guide https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/)...
sudo apt-get update && apt-get upgrade
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4
sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y
sudo apt install php7.4-fpm //(I don't think this was needed)
sudo a2dismod php7.0
sudo a2enmod php7.4
sudo service apache2 restart
I am able to make my website work again by doing this... (but the PHP version reverts back to 7.0 of course)
sudo a2dismod php7.4
sudo a2enmod php7.0
sudo service apache2 restart
I am using Linux Mint 19.1. My PHP configuration is like below
I am getting below error while I am trying to install mcrypt.
Try out using these commands
To install the dependencies :
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev
Once the dependencies have been installed, you can install mcrypt with the command:
sudo pecl install mcrypt-1.0.1
Upgraded to Ubuntu 16.04 and facing problem after installing PHP5.
Installed PHP-5 with following:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.5 # for PHP 5.5
Trying to install php-curl but its not working.
sudo apt-get install php5-curl
Error: E: Unable to locate package php5-curl
In Ubuntu 16.04 default PHP version is 7.0, if you want to use different version then you need to install PHP package according to PHP version:
PHP 7.4: sudo apt-get install php7.4-curl
PHP 7.3: sudo apt-get install php7.3-curl
PHP 7.2: sudo apt-get install php7.2-curl
PHP 7.1: sudo apt-get install php7.1-curl
PHP 7.0: sudo apt-get install php7.0-curl
PHP 5.6: sudo apt-get install php5.6-curl
PHP 5.5: sudo apt-get install php5.5-curl
This worked for me.
sudo apt-get install php-curl
This works for me:
sudo apt-get install php5.6-curl
Do:
apt-get update
And then:
apt-get install php5-curl
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0-curl
To Install cURL 7.49.0 on Ubuntu 16.04 and Derivatives
wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar -xvf curl-7.49.0.tar.gz
cd curl-7.49.0/
./configure
make
sudo make install
For Ubuntu 18.04 or PHP 7.2 users you can do:
apt-get install php7.2-curl
You can check your PHP version by running php -v to verify your PHP version and get the right curl version.
sudo apt-get install php5.6-curl
and restart the web browser.
You can check the modules by running php -m | grep curl
Recently the new php7 has been released. However, when I am trying to install the gd package, the library can not be found.
I have tried through
sudo apt-get install php70-gd
and
sudo apt-get install php70-php-gd
Does anybody have an idea if gd is available for php 7?
PHP7 packages for Ubuntu including php7.0-gd can be installed via PPA for PHP by Ondřej Surý:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Next, install the desired version:
sudo apt-get install php7.0-gd
# or
sudo apt-get install php7.1-gd
# or
sudo apt-get install php7.2-gd
# or
sudo apt-get install php7.3-gd
# or
sudo apt-get install php7.4-gd
EDIT:
As MacroMan stated, under Ubuntu 16.04 you don't need to add the repository any more. Simply issuing sudo apt-get install php7.0-gd works.
just try
sudo apt-get install php7.0-gd
i got it working that way.
Greetings.
In 2018, there is an alias package for this:
sudo apt-get install php-gd
Use this to retrieve the last version.
my php version is 7.1
sudo apt-get install php7.1-gd
this command is work for me
For
Ubuntu 16.04.4 LTS
this is the command:
sudo apt-get install php7.0-gd
check php verison first using
php -v
It will give version number suppose your version is 7.0.1 then use this command to install GD Library
sudo yum install php70-gd
OR use this command depending upon server specification
sudo apt-get install php7.0-gd