This might sound really stupid.

But, While developing a PHP extension I accidently deleted all *.so files in extensions folder(named as a long number) located at /usr/lib/php5.

can anyone tell me if there's any way to get back to original state(i.e, recover the files) or maybe reinstall php without compromising any apache/mysql configurations?

  • It would depend on which distro you are using – ALex_hha Feb 10 '15 at 17:04
  • Since you tell us exactly nothing about your environment, the answer is: Restore from backup. In the time you wrote this, the restore could have been complete... – Sven Feb 10 '15 at 17:05
  • Hi I am using Ubuntu 14.04 – user242811 Feb 10 '15 at 17:05
  • php version was 5.9 but now when i do php --version it gives me a long error.. – user242811 Feb 10 '15 at 17:06
  • Really sorry everyone to not properly frame the question and give appropriate info... (was really dissapointed with this problem :/ ) I'll try and update the question to make it more useful for everyone.. Thanks too.. for quick replies. SO rocks! and PS : my php ver : 5.5.9 :) – user242811 Feb 10 '15 at 17:24

If you're using ubuntu, what you can do is:

dpkg -l | grep php | cut -d' ' -f 3 | xargs apt-get install --reinstall

That will reinstall all packages that have php in their name, and return your .so files. You should run this command as a root user. If you run it as a regular user add sudo before apt-get.

  • wow!!! Thank you so very much...!! I really dont have the words enough! That was simply put amazing!! – user242811 Feb 10 '15 at 17:20
  • Always glad to help. – Jakov Sosic Feb 10 '15 at 17:23
  • Happened to find myself in the same situation. While I knew it wasn't a disaster, this solution saved me quite a bit of time. – jeteon Jan 1 '16 at 11:50

I found another answer here: Ask Ubuntu

You can remove it:

sudo apt-get --purge remove php-common

And reinstall it.

sudo apt-get install php-common php-mysql php-cli

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.