I have installed PHP on Ubuntu 22.04 using the command: apt-get install php libapache2-mod-php
When I tried to install a Composer package, I got a message saying
The zip extension and unzip command are both missing, skipping
I took the advice of the top answer to an SO question (PHP error: "The zip extension and unzip command are both missing, skipping.") and ran: apt install zip unzip php-zip. The result of that is shown below:
ubuntu#ip<..>:/var/www/html$ sudo apt install zip unzip php-zip
Reading package lists... Done
Building dependency tree... Done
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:
php8.1-zip : Depends: php8.1-common (= 8.1.2-1ubuntu2.2) but 8.1.2-1ubuntu2.3 is to be installed
E: Unable to correct problems, you have held broken packages.
ubuntu#ip-<...>:/var/www/html$ php -v
PHP 8.1.2 (cli) (built: Aug 15 2022 12:24:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
ubuntu#ip-<...>:/var/www/html$
I really have no idea how to react to this. Is there some way I can install php-zip without these dependency related problems?
Related
I have been trying to install laravel for 3 days on ubuntu 16.04. I am following the top search links of laravel installation process. But I failed to execute each and every process I had tried. Now I am facing a different issue on installing PHP on my ubuntu. I had installed maria db once, but did not succeed.
But it might have broken something that resulted in me not being able to install PHP. The issue I am facing:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php is already the newest version (1:7.2+62+ubuntu16.04.1+deb.sury.org+3).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
When I try php -v it gives me this error
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
I am totally new on ubuntu and laravel. And if anyone guide me how to install laravel on ubuntu 16.04 I will be very grateful.
Thank You.
Install git apt-get install git-core
git clone https://github.com/thamaraiselvam/LEMP-Stack-Installer.git
cd quick-lemp-install or cd LEMP-Stack-Installer
chmod +x lemp.sh this command makes bash script executable
./lemp.sh
That's it :)
PHP version - v7.0
Mysql version - Latest Stable
Note: Default mysql password is root. you can change it before running
in the following lines before running the script
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password password YOUR_PASSWORD'
sudo debconf-set-selections <<< 'mysql-server
mysql-server/root_password_again password YOUR_PASSWORD'
Now Install Laravel
Go to cd /var/www/html/
sudo apt-get install php-common php-mbstring php-xml php-zip
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
Try to execute the following commands to solve your problem:
Get the list of MySQL packages installed on the system by executing
the command sudo dpkg -l | grep mysql
Remove the the packages shown above by executing the command sudo apt-get --purge autoremove <packages from the step 1>
Delete /var/lib/mysql
Try to install mysql again. It should solve your problem
I'm trying to install the yaml extension on Ubuntu.
I have PHP 7.1 on my server.
ubuntu#www1:~$ php -v
PHP 7.1.15-1+ubuntu14.04.1+deb.sury.org+2 (cli) (built: Mar 6 2018 11:27:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.15-1+ubuntu14.04.1+deb.sury.org+2, Copyright
(c) 1999-2018, by Zend Technologies
I was following another SO post that said to run
sudo apt install libyaml-dev php-dev php-pear
When I do that, the installer says, in part:
The following extra packages will be installed:
dh-php php7.2-cli php7.2-common php7.2-dev php7.2-json php7.2-opcache
php7.2-readline pkg-php-tools xml2
Suggested packages:
dh-make
The following NEW packages will be installed:
dh-php php-dev php7.2-cli php7.2-common php7.2-dev php7.2-json
php7.2-opcache php7.2-readline pkg-php-tools xml2
0 upgraded, 10 newly installed, 0 to remove and 85 not upgraded.
Need to get 3,073 kB of archives.
After this operation, 18.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
So, why would the installer install PHP 7.2 extensions on a PHP 7.1 server?
I aborted the install and came here to ask:
How do I force my server to stay at PHP 7.1 and install the yaml extension?
Have you tried
sudo apt-get install -y php7.1-yaml
I know this question was answered a lot of times here but I tried many things and I cannot fix it.
I am developing using symfony 3.
First of all I thought I hadn't php-curl so, I decided to install it doing
sudo apt-get install php-curl
It worked! So, I restarted Apache... and tried again.. and the error jumped again. I saw too I should "delete" the ; of a php.ini line but... surprise! There is not any line with:
;extension=php_curl.dll
I thought then maybe I didn't really install php-curl... so I did:
var_dump(extension_loaded('curl'));
And the answer is:
Current PHP version: 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1
EDIT: I followed this:
And now appears
Current PHP version: 5.6.26-1+deb.sury.org~xenial+1
Then I tried to:
sudo apt-get install php5-curl
And is happens:
tureey#tureey:~$ sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-curl
Actually these are my software stats:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
And after do:
php -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
I did and upgrade and update but nothing changes... any solution?
Correct package should be php5.6-curl
I have a vagrant box with LAMP. Linux distribution is Ubuntu 14.04.1
My PHP project has got a composer package and it's package use gd extension. I install php5-gd and added to php.ini file but it's not sold the problem. I type "php -v" to terminal it's return:
PHP Warning: PHP Startup: gd: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match in Unknown on line 0
PHP 5.6.20-3+donate.sury.org~trusty+1
Does anyone help me? I think this problem maybe experienced from anyone before me.
Solve of this problem
PHP 5.6.20+ version is not stable and packages maybe incompatible. You should be see in here which version is stable. I want to find specific version of extensions and found in here.
I get with wget debian package of php-gd extension:
wget http://http.us.debian.org/debian/pool/main/p/php5.6/php5.6-gd_5.6.20+dfsg-3_amd64.deb
And install with dpkg:
sudo dpkg - i php5.6-gd_5.6.20+dfsg-3_amd64.deb
It's continue to return error message like this:
dpkg: warning: downgrading php5.6-gd from 5.6.20+dfsg-3+donate.sury.org~trusty+1 to 5.6.20+dfsg-3
(Reading database ... 73009 files and directories currently installed.)
Preparing to unpack .../php5.6-gd_5.6.20+dfsg-3_amd64.deb ...
Unpacking php5.6-gd (5.6.20+dfsg-3) over (5.6.20+dfsg-3+donate.sury.org~trusty+1) ...
dpkg: dependency problems prevent configuration of php5.6-gd:
php5.6-gd depends on php5.6-common (= 5.6.20+dfsg-3); however:
Version of php5.6-common on system is 5.6.20+dfsg-3+donate.sury.org~trusty+1.
php5.6-gd depends on libgd3 (>= 2.1.1); however:
Version of libgd3:amd64 on system is 2.1.0-3.
php5.6-gd depends on libjpeg62-turbo (>= 1.3.1); however:
Package libjpeg62-turbo is not installed.
php5.6-gd depends on libpng16-16 (>= 1.6.2-1); however:
Package libpng16-16 is not installed.
dpkg: error processing package php5.6-gd (--install):
dependency problems - leaving unconfigured
Processing triggers for php5.6-fpm (5.6.20+dfsg-3+donate.sury.org~trusty+1) ...
php5.6-fpm stop/waiting
php5.6-fpm start/running, process 11382
Errors were encountered while processing:
php5.6-gd
This informations say our "php5.6-common" package must be install at system. For fix this problem is this command:
sudo apt-get -f install
After this command will upgrade "php5.6-gd" and installed correct package. I type terminal "php -v" and it's say me everything is good:
PHP 5.6.20-3+donate.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1-dev, Copyright (c) 2002-2016, by Derick Rethans
During Ubuntu server setup, I got to the point where I need to enable php as apache2 module. I tried running sudo a2enmod php5, but it returned ERROR: Module php5 does not exist!
After a bit of searching, I stumbled upon this tip by gerard :
If sudo a2enmod php5 returns "$ This module does not exist!", you should purge (not just remove) the libapache2-mod-php5 package and reinstall it.
Be sure to clear your browser's cache before testing your site again."
Running sudo apt-get --purge remove libapache2-mod-php5 however, returned Package libapache2-mod-php5 is not installed, so not removed . Naturally, I tried to install it with sudo apt-get install libapache2-mod-php5, but then I get :
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-php5 : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed
Recommends: php5-cli but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I tried to update && upgrade in hopes libxml2 would get updated, but didn't happen. I also tried installing php5-cli, but got :
The following packages have unmet dependencies.
php5-cli : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4.6 is to be installed
Depends: libedit2 (>= 2.11-20080614-4) but 2.11-20080614-3ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
At this point I am lost. Running php -v, indicates that php is running, however:
PHP 5.4.17 (cli) (built: Aug 7 2013 11:40:38)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
You can't install PHP 5.4.17 under Ubuntu 12.04, because the required libxml2 library >= v2.8.0 is only available in Ubuntu 12.10 (Quantal quetzal) or higher.
Solution: Get a newer version of Ubuntu.
oh no! You must use
aptitude -y install php5 libapache2-mod-php5 php5-mysql php5-gd
to install php5 with apache.
libapache2-mod-php5 is a module of apache, but you have to install php5 to compile php code