Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem in restoring my php.ini in the server. I was changing some line but I accidentally cut off and save.

Any idea how to restore it back?


CentOS release 6.3 (Final) x86_64 PHP 5.3.17

share|improve this question

closed as not constructive by John Gardeniers, Magellan, rnxrx, Iain Oct 20 '12 at 7:58

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

if you haven't yet restarted apache (and are thus still using the pre-editing php.ini), you could save the info from a phpinfo page to help figure out what options you had. – user16081-JoeT Oct 20 '12 at 0:31
Sorry I'm a noob in this matter. Any way I can export data from phpinfo? – ninjascorner Oct 20 '12 at 1:24

Restore from a backup.

Sorry, there's no magic sysadmin way to recover a file you deleted/saved over/set on fire/etc.

share|improve this answer
Right but my bad that I dont have a backup. Is there any way I can get a default php.ini somewhere? – ninjascorner Oct 20 '12 at 1:23
@ninjascorner, if you don't have a backup you not only don't get any sympathy, you're also on the wrong site. This site is for IT professionals and professionals make sure they backup before changing things. – John Gardeniers Oct 20 '12 at 1:25
@ninjascorner you could do an install on another machine to try to get a "default" php.ini ... not that this is a good idea, mind you, but it's possible. – HopelessN00b Oct 20 '12 at 2:25
Yeah I just tried it now and it works..thanks man...I'm just learning in Unix and this will be my first lesson. Thank you for helping me even if I'm not a professional. Mistake is a key to become a better one I guess. – ninjascorner Oct 20 '12 at 4:45
Other locations exist for the default ini files: /usr/share/doc/php5-common/examples/php.ini-development /usr/share/doc/php5-common/examples/php.ini-production /usr/share/php5/php.ini-production /usr/share/php5/php.ini-development /etc/php.ini.default – StampyCode Sep 24 '15 at 14:11

You're out of luck as far as 'undeleting' it is concerned.

It's possible to restore one file from an RPM, see here for an example.

share|improve this answer
Thanks mate very informative and useful. – ninjascorner Oct 20 '12 at 4:47

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