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
Related
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?
I tried many times to update PHP from 5.5 to 7 on CentOS 7 but always unsuccessful. The installation seems always going well but when I checked php-v it is always:
PHP 5.5.7 (cli) (built: Jul 5 2017 12:03:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
Any idea how can I update?
Base repository of CentOS has no php7 packages.
You can use remi repo to install php7 on your CentOS 7.
Why Remi?
PHP package installed from remi repo will work as drop-in replacement for your current php5 binaries.
Remi repo is managed by one of PHP internals
Why not?
To install the Remi repository, we need to enable the EPEL repository first.
sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Then Enable php 7.0 (You can use php 7.1+ too)
sudo yum-config-manager --enable remi-php70
Now it's time to install php7
yum install php php-common php-cli php-mysql
Great!!!
Now you have php7 on your system. You can confirm with :
php -v
Details Instruction on how to setup php on different OS : https://rpms.remirepo.net/wizard/
"PHP module gd: Missing" I received such an error. and I'm trying to install php5-gd.
apt-get install php5-gd
I am using Ubuntu 16.10 and PHP version 7. I made all the updates.
When I tried to install php5-gd, I got an error like below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-gd' has no installation candidate
First check which php version you have by sudo php -v. I have php7 so the result is:
PHP 7.0.18-0ubuntu0.17.04.1 (cli) (built: Apr 26 2017 23:59:48) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
since i have php7, I will do the following to list the php packages
sudo apt-cache search php7-*
this returned
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
...and do on
now to install packages run the following command with your desired package
sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode
note:php7.0-mysql php7.0-gd php7.0-curl php7.0-recode are the package that are listed above.
UPDATE
dont forget to restart apache sudo service apache2 reload
You can use the meta-paclaget php-gd, which is an alias of php7.0-gd
sudo apt-get install php-gd
Please check php version and install modules
apt-get update
apt-get install php5.6-gd
If you want other modules then use this command to get all available modules
apt-cache search php5.*
you have php7 installed but you are trying to install a package of php5 that is the problem
Same issue here.
Use RUN rm /etc/apt/preferences.d/no-debian-php in dockerfile
Also you can see here the solution https://hub.docker.com/_/php
I have an error saying MongoClient class is not found.
I've tried both the instructions on the MongoDB website and these answers.
Upon php -v there is
PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/mongo.so'
PHP 5.6.30-1+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
with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
with sudo grep -rnw /etc -e "mongo.so"
I have
/etc/php/5.6/fpm/php.ini:2033:extension=mongo.so
/etc/php/5.6/cli/php.ini:2032:extension=mongo.so
/etc/php/5.6/apache2/php.ini:2033:extension=mongo.so
Then I tried the manual installation.
When I run phpize
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
At the make test output I get
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
How do I compile the correct module?
I've removed php 7 entirely
sudo apt-get purge php7.*
I guess you had installed the wrong extension for your system.
I suggest to start fresh and use pecl to install and compile mongo extension properly.
Install pecl (assuming that you are using Debian-based distribution with correct apt repos, pecl comes bundled with php-pear)
sudo apt-get install php5-dev php-pear
Install the legacy mongo driver from pecl
sudo pecl install mongo
Add extension=mongo.so on php.ini
sudo su
echo "extension=mongo.so" >> /etc/php5/mods-available/mongo.ini
ln -rs /etc/php5/mods-available/mongo.ini /etc/php5/cli/conf.d/30-mongo.ini
ln -rs /etc/php5/mods-available/mongo.ini /etc/php5/fpm/conf.d/30-mongo.ini
ln -rs /etc/php5/mods-available/mongo.ini /etc/php5/apache2/conf.d/30-mongo.ini
Note that the legacy driver is not compatible with PHP 7+ and the lastest version of MongoDB one can use with this driver is 3.0. See the compatibility chart from MongoDB Docs.
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