-1

I have tried these below commands to install PHP 5.6 while installing Lampp:

  sudo add-apt-repository ppa:ondrej/php
  sudo apt-get update 
  sudo apt-get install php5.6
  sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql 
  php5.6-xml

But I am getting this error:

php5.6 is already the newest version (5.6.32-
1+ubuntu16.04.1+deb.sury.org+2).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
21 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
/usr/bin/dpkg: error while loading shared libraries: libselinux.so.1: 
cannot open shared object file: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (127)

I tried many below links:

But I am getting this error still, and now I am unable to use apt-get -f install or install any other software.

sotirov
  • 3,169

2 Answers2

0

Your question seems to be that you want to install php5.6, yet your system says php5.6 is already installed.

Can you use apt-get or dpkg commands at all? It looks like there is a problem with libselinux.so.1 or with the cache.

Run ldconfig as root. That should fix possible errors with shared libraries that are not registered properly in the cache.


References:
SE: Debian dpkg broken after apt-get upgrade
SO: Resolve error while loading shared libraries: libselinux.so.1 in ubuntu 14.04 LTS

ejjl
  • 428
  • Thanks Edmund, I have followed both links but it didn't work for me, I am unable to use apt-get install or install any other software cause of this error. please let me know if you have other way to resolve this error. – Vivek Sharma Jan 04 '18 at 17:02
  • @Vivek Did ldconfig run and exit correctly? If not, you'd need a rescue cd, chroot into the environment and run ldconfig like that. Reference: https://crunchbang.org/forums/viewtopic.php?pid=294666 #36

    Also: which version of Ubuntu are you using? What did you do prior to this error (as stated, you already had php5.6 installed, which doesn't come with most current Ubuntu versions, which makes me think you already had that ppa configured)?

    – ejjl Jan 08 '18 at 19:55
  • I used ldconfig and it exit correctly but problem not resolved, I don't know how to chroot, I do created ** ondej/ppa** for PHP 5.6 that si why it is already showing ppa but I am unable to remove it due to same error. Thanks – Vivek Sharma Jan 10 '18 at 14:01
-1

Your output actually saying you are already having PHP 5.6 latest version on your system. However try the below.

Try apt-get autoremove then apt-get remove <your package> then install again your package apt-get install <your package>

Arut
  • 7