Can't install PDO_SQLITE? Later version - php

I am trying to get the PDO_SQLITE extension because I have to read a SQLite database. I know I miss this module because I get the error message "could not find driver".
But when I try to install it through "sudo apt-get install php5-sqlite" it says I have a later version of it and cannot install it.
Anyone know how I can go around this problem? Even tried with aptitude and it just had one option which was to not install it.

This is probably due to some sort of problem with dependencies or a weird third party repository.
While I've never had an issue with this myself, doing a little bit of research shows that this might work.
$ apt-get --purge remove php*
$ sudo apt-get install php5 php5-sqlite php5-mysql
$ sudo apt-get install php-pear php-apc php5-curl
$ sudo apt-get autoremove
You'll of course want to backup any special configurations that you've put in place and keep note of all the php 'plugins' you need to have installed before doing this.
You can also try instead of purging all of everything that has to do with php, just doing sqlite
$ sudo apt-get --purge remove sqlite3
$ sudo apt-get --purge remove php5-sqlite
and trying to install them at this point.
I would also like to state that personally, I try to use apt-get as little as possible. I tend to use aptitude as it seems to have better dependency management. If you want to give that a go you can install it by: sudo apt-get install aptitude. It accepts most apt-get commands, and if you just type aptitude into your console it has a nifty console interface.

Related

PHP5-Curl install error no installation candidate

I want to install PHP5-Curl in my Debian server. But when I run this command:
apt-get install PHP5-Curl
I got an error like:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package PHP5-Curl 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-Curl' has no installation candidate
Use sudo apt-get install php5.6-curl
Try searching for the available version that suits for you with sudo apt-cache search curl | grep php and then sudo apt-get install php<x>-curl.
In my case it was php7.0-curl.
First search for your php version using command php -v and then download the respective version of php(version)-curl.
It looks like you have multiple, conflicting versions of PHP installed. First, let's clean up. Back up your configuration files first, as this will remove them.
dpkg --purge --force-all php5-curl
apt-get remove php5-*
apt-get purge php5-*
apt-get autoremove
Now, run dpkg -l | grep php5 again, and make sure that no php5-... packages are installed.
Then, let's start fresh:
apt-get install php5-cli php5-curl
If you need the Apache module:
apt-get install libapache2-mod-php5
Or if you need the FPM module:
apt-get install php5-fpm

Updating GoDaddy's PHP versions through SSH

So I'm using GoDaddy (Deluxe/shared/linux) for hosting, but the PHP there only goes up to 5.3.2, and that's way too far back for me. I'd have to change so much of my project's code to get it to work with that version...
Is it possible to SSH into my server, and type something like:
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5
or would that just make a mess of things?
Try the following
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get install php5
This will install PHP 5.4

How do I install Imagick on C9.io: an online IDE?

I've tried out various things, yet have not found out how to make it work.
I was looking for a solution to this as well. I posted this question on the Cloud9 Community about it. Thanks to information from there and from here, I finally got it working in my C9 workspace. :)
Here are the steps that worked for me:
1. Update apt-get packages inside the C9 terminal
$ sudo apt-get update
2. Install imagemagick command-line tools via apt-get
$ sudo apt-get install imagemagick
3. Install php5-imagick module via apt-get
$ sudo apt-get install php5-imagick
You can then confirm the php5-imagick module is installed with:
$ php -m
I see the answer here kinda broken into many posts. the command in the Cloud 9 terminal is "sudo apt-get install imagemagick"
once it is installing you will get a message asking => "After this operation, 8852 kB of additional disk space will be used. Do you want to continue? [Y/n]
enter "Y" and you are good to go.
In my case, entering:
$ sudo apt-get install imagemagick
resulted in the following response:
Package imagemagick 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 'imagemagick' has no installation candidate
By first updating the apt-get packages inside the C9 terminal as suggested by bou2you:
$ sudo apt-get update
I was then able to execute the install imagemagick command-line tools via apt-get:
$ sudo apt-get install imagemagick

Error installing php5-mcrypt

Just today I signed up with Google Cloud Compute Engine. I did everything but then I stuck into an error while installing php5-mcrypt extension.
Error:
root#instance-2:~# sudo apt-get install php5-mcrypt
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:
php5-mcrypt : Depends: phpapi-20121212
Depends: php5-common (= 5.5.24+dfsg-1+deb.sury.org~vivid+1) but 5.6.4+dfsg-4ubuntu6 is to be installed
E: Unable to correct problems, you have held broken packages.
I searched everywhere and then I came here. Please help.
sudo service apache2 restar
apt-get install php5-common
Or, if you dont need to keep configurations:
apt-get purge php5-common
apt-get install php5-common
Do you get any output from apt-mark showhold?
If it does not solve your problem, you should try install it with aptitude:
sudo apt-get install aptitude
sudo aptitude install php5-mcrypt
Finally reatast the server
sudo service apache2 restart
Had exactly the same problem. The accepted solution did not work for me. Took me eternities to figure a way.
sudo add-apt-repository -r ppa:ondrej/php5
sudo add-apt-repository -r ppa:ondrej/php5-oldstable
sudo add-apt-repository -r ppa:ondrej/php5-5.6
sudo apt-get purge php5* apache2* mcrypt*
sudo apt-get update
sudo apt-get upgrade
(WARNING: You'll lose all settings for your PHP and Apache installation!)
reinstall:
sudo apt-get install php5 php5-mcrypt php5-curl apache2
and enable the extensions
sudo php5enmod mcrypt
sudo php5enmod curl
Magic.
This is horrible, horrible, horrible. Adding ppa:ondrej/php5-5.6 together with ppa:ondrej/php5 and ppa:ondrej/php5-oldstable will bring you nothing at all, as you need exactly one of these (as one contains PHP 5.4, second PHP 5.5 and third PHP 5.6). Purging php5* and apache2* is also not necessary, you might want to purge apache2.2-common if you encounter an error upgrading, but that's it. And then mcrypt and curl modules will get enabled automatically (unless you have disabled them in the past), so php5enmod mcrypt and php5enmod curl is extra (but not harmful).

How to install PHP and a SQL database on a VPS?

I'd like to know a basic run down of command line inputs to install Apache, PHP and a SQL database on a VPS.
I'm not sure if sudo apt-get install php5 is enough to install php5 while getting the dependencies such as gcc.
I'm looking at Debian (Wheezy) as that is what a friend of mine suggested. I'm testing different websocket/wamp router solutions probably alongside if not dependent on node.js eg. socket.io or crossbar.io.
sudo apt-get install mysql-server
sudo apt-get install apache
sudo apt-get install php5-common libapache2-mod-php5 php5-cli
There are additional instructions for installing the mysql-server:
http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

Categories