Unable to instal MySQL on to my Debian 7 with puTTY - php

I've been searching through the internet trying to find answers to this all morning but everytime I find a solution, it seems to bring up another problem that a previous solution should have fixed. I seem to be going round and round at the moment. And some help would be appreciated.
I am setting up a MySQL Database on my OVH VPS which is running Debian 7 by using puTTY. It's all relatively new to me since I only bought the server yesterday morning but as I've tried to setup MySQL and phpMyAdmin I've ran in to some problems. I've followed several tutorials, and asked a friend who has also setup his own OVH MySQL Database.
These are the two main tutorials I've been following:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian
https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-debian-7
I seem to be doing fine until I get up to the point when I actually need to install the MySQL
sudo apt-get install mysql-server
When I run this, it asks my password then installs it. However, at the end it print this
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Firstly to solve this, I tried to install mysql-server-5.5 (since that is what it says it depends on). However, it then says mysql-server-5.5 depends on something else, and that something else depends on something else and so on.
It keeps repeating this until I get to 'libc6', which I then install using the same command
sudo apt-get install libc6
But this time, it prints a long error
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up phpmyadmin (4:3.4.11.1-2+deb7u1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing phpmyadmin (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
It was talking about locked files so I did another Google search and came to this
https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process
However its suggestion was to remove the locked file with the command
sudo rm /var/lib/apt/lists/lock
However, it said it should only be used as a last resort so I decided not to do it. Anyway, the original MySQL setup tutorial I was following didn't mention anything about installing all these dependencies, therefore I went back to the error I got when I first did 'sudo apt-get install mysql-server'
(Here's the original error again)
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I pretty much just pasted the whole thing in to Google search and found this result
https://askubuntu.com/questions/489815/cannot-install-mysql-server-5-5-the-following-packages-have-unmet-dependicies
The first answer was talking about removing and changing the version of MySQl (this solution didn't apply to me) so I tried the second solution which was to use the command 'sudo aptitude install mysql-server'. I did this and returned a similar error to before about the locked files
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up phpmyadmin (4:3.4.11.1-2+deb7u1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing phpmyadmin (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
So now, I've realised I've screwed something up. So how can I unlock this file so I can install the other items? I didn't quite understand and wasn't confident using the post about unlocking locked files so how would I use it in my situation?
I've concluded that I've messed something up whilst setting up phpMyAdmin and MySQL since the error message contains something about that. And my overall question is how can I unlock these files? And then install the MySQL stuff correctly? Because right now, I've not installed something right...
Any suggestions are greatly appreciated! Thankyou so much in advance

Related

Laravel composer install giving error "Your lock file does not contain a compatible set of packages please run composer update"

I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install

Homestead Installed PHP7 but I need PHP5

Homestead randomly stopped working for me, so I tried to remove the whole thing and reinstall, but it's not gone well.
I have it "running" after a day and a half of muddling my way through various issues. However, for reasons that I cannot understand, my Homestead box is now running PHP 7.
The instructions I was following had optional options for installing PHP 7, but I intentionally skipped that because we are on PHP 5.
For the life of me, I can't figure out how to fix this. Things I have tried:
I have destroyed and reinstalled the box multiple times.
I have deleted the VirtualBox box multiple times and redownloaded it.
I tried installing v0.3.3 of the box based on one suggestion. (I also updated the homestead.rb script accordingly.) At one point, something failed during the install process with php7.0-fpm: unrecognized service and the configured sites were returning 502 Bad Gateway errors.
After reinstalling with v.0.4.0, it has started "running" as I described (serves the sites as expected, etc.), but with PHP 7.
Searching for solutions has persistently led to a dead-end.
I'm just a dummy front-end developer. :) Laravel, Vagrant, Homestead, all this stuff makes my head hurt. I just want this to work again so I can go back to my actual work. Any advice or alternate avenues of pursuit for researching this problem would be appreciated.
I've been through this issue too and I solved it by installing an old homestead box v0.3.3 and I've used an old release of homestead installer, so I suggest that you remove your current box v0.4.0 and delete your homestead folder then do this:
$vagrant box add laravel/homestead --box-version 0.3.3
and then download an older version of Homestead installer from git, I'm using v2.1.8 it works fine.
Enjoy php 5.6 :)
I had a similar problem where I tried to upgrade Homestead to the most recent Homestead 7.0 box and configure it to run PHP 5.6 instead of PH7, which various sources said was possible via adding a line to the .yaml file specifying the PHP version.
sites:
- map: myproject.local
to: /home/vagrant/Code/craven/public_html
php: "5.6"
What actually happened when I tried that was that I got a 502 CGI gateway error. Here is a summary of the steps I had to take to fix it:
1) SSH into the Homestead virtual machine.
ssh vagrant#127.0.0.1 -p 2222
Taking a look at the nginx error log in /var/log/nginx/ reveals that the PHP 5.6 files the server is looking for don't exist.
You can get confirmation of this by having a look at the executables.
ls -la /usr/bin/php*
2) To install PHP 5.6, run
sudo apt-get update
sudo apt-get install php5.6-fpm
You can confirm that the php 5.6 service is running via the command
service --status-all
3) Once all this is working, refresh the web page for your site and it should now work. In my case, because I was running a Laravel 4.2 site, I then to install Mcrypt:
sudo apt-get install php5.6-mcrypt
4) In order to get my mysql database up and running, I also had to install mysql.
sudo apt-get install php5.6-mysql
And of course after all that, I had to re-import the database contents from the file I'd exported before upgrading the Homestead box.
Note that if you ever destroy and recreate the Homestead box, you will need to repeat all these steps again.

travis CI pear PHP dependency doesn't get installed

I've got a Python project at github, which I test on travis-ci.org. There is a small client in PHP that I use for testing it (it should be a cross-language tool).
Recently I changed the username in my github repo, committed it and it triggered the travis build. It failed, because of a PHP/pear error:
The command "sudo pear channel-discover pear.phpunit.de" failed and exited with 1 during .
You can see the build matrix below:
https://travis-ci.org/ducin/pycached/builds/65778230
https://travis-ci.org/ducin/pycached/jobs/65778231
https://travis-ci.org/ducin/pycached/jobs/65778232
The previous commit was submitted and tested on travis last year and everything was ok, the pear channel-discover command worked. I changed nothing but the github username, which is not a problem for sure, so I expect that certain service became unavailable since then.
Please point me out what is wrong with my build and how can I make it work again.
http://pear.phpunit.de has been closed down in favour of using phar files or installing phpunit via composer. You should uninstall the PEAR version of phpunit and install it from another source.
https://thephp.cc/news/2015/01/phpunit-migration-from-pear-to-phar

Pyrus problems on Ubuntu 12 installing ZF2

I tried to install zend framework 2 on Ubuntu 12.04.1 64 bit but have run into difficulties.
# sudo pyrus install zf2/Zend_Framework-beta#Standard
failed mid transaction with no other previous errors that I can recall other than warnings about timezone not being set. ( Unfortuantely my terminal history has lost the original output)
Pyrus\Installer\Exception: Installation failed
Pyrus\AtomicFileTransaction\MultiException: ERROR: commit failed
Pyrus\IOException: CRITICAL - unable to complete transaction, rename of actual to backup path failed
Pyrus\AtomicFileTransaction\RuntimeException: Cannot rollback - not in a transaction
Now when I try to rerun
# sudo pyrus install -f zf2/Zend_Framework-beta#Standard
it fails with
Pyrus\Registry\Exception: Cannot retrieve package file object for package packages.zendframework.com/zend_framework, it is not installed
Uninstall just tells me that it's not installed.
I restored /usr/share/.old-php to /usr/share/php however I still get the same error.
Please help.
You can just try to download and unzip Zend Framework 2 archive into your project's library folder.
It looks like it's a problem with the metapackage according the Matthew. I'm having the same problem.
Error Installing full framework with Pyrus
So if I installed pyrus here: "/usr/share/pear/pyrus" , then should I create a directory "/usr/share/pear/pyrus/zf2" and download and unzip the full Zend Framework in zf2 and it should work?
thanks

PEAR - Package installation (XML_Query2XML)

I was trying to install XML_Query2XML package but I am getting below error (I tried to install without -o parameter too, but got same error)
C:\Users\devdiu>pear install -o XML_Query2XML
No releases available for package pear.php.net/XML_Query2XML
install failed
Then I tried to install with specific version (which is latest as on today)
C:\Users\devdiu>pear install -o XML_Query2XML-1.7.2
No releases available for package "pear.php.net/XML_Query2XML"
install failed
Does any one know the issue?
I already tried that too. I have no clue why its giving error. I have installed it 3 times before I started getting this error. I actually wanted to ask different question but I stuck up at this one now.
Alternate way
I am manually copying the files into PEAR folder, to avoid further wastage of time
SOLUTION:
I got the solution in the link Lukas reconmended and resolved using this command (there are multiple accepted solutions there)
shell>pear clear-cache

Categories