repair broken symlinks / reinstall php5
Asked Answered
P

1

7

How the I repair broken symlinks? / Delete 'dead' files?

Context: Since I messed up my php.ini configuration on one of my local testservers, I decided to re-installed the basic webserver stuff. (apache2, php5,..)

Problem: After installation is /etc/apache2/php5/php.ini missing at all, /etc/apache2/php5/conf.d is a 'broken symlink', I think.

Error: During installation: Not replacing deleted config file /etc/php5/apache2/php.ini

So what's these 'broken symlinks'? I can find them using 'ls /dir', they are colored in red :) I tried "rm /etc/php5 -R -f"? But it doesn't work... And how should I get rid of the php.ini 'zombie-file'? All I want is a new php5 installation.

Priestcraft answered 17/2, 2012 at 6:5 Comment(5)
you can remove your broken symlinks with rm -f linkname. Can you check if Web-Server/PHP are working? If so, you can look at phpinfo() to see which php.ini is used. Also, find /etc/ -name php.ini... What distro are you at?Hillell
I justed removed the file again using 'rm -f conf.d'. It was gone. Then run sudo apt-get autoremove libapache2-mod-php5 php5 / sudo apt-get install libapache2-mod-php5 php5. Same situation: conf.d is a broken symlink, php.ini is missing. Apache is running, but php is not working at all (downloading php-files)Priestcraft
It's ubuntu server 11.10. + there's no php.ini in /etc or in a subfolder.Priestcraft
try to apt-get purge libapache2-mod-php5 php5 && apt-get install libapache2-mod-php5 php5Hillell
That helped - thanks. php.ini and conf.d is back. I was getting a bunch of 'sh: getcwd() failed: No such file or directory' after that, but apt-get update fixed it. You could post it as an answer, and also the apt-get update, so I can mark it as answered.Priestcraft
H
33

You can do it like that:

apt-get purge libapache2-mod-php5 php5 && \
    apt-get install libapache2-mod-php5 php5
Hillell answered 17/2, 2012 at 6:36 Comment(2)
THANK. YOU. So. MUCH ! I've tried everything on this site...your answer workedPheon
in my case I also needed to reinstall php-mysql , modified the command slightly to apt-get purge libapache2-mod-php5 php5 php-mysql && apt-get install libapache2-mod-php5 php5 php-mysql Patricia

© 2022 - 2024 — McMap. All rights reserved.