Chriz1977

Well-Known Member
Sep 18, 2006
191
0
166
Hi

I was editing my php.ini earlier and something happened that reduced the file size to 0. Ive tried to backup from an old copy but now im getting a 500 internal server error. Anyone got any ideas if i might have backed up from a copy that isnt too recent. Is there a normal place for php to make a backup of its ini?

Cheers
Chriz
 

Spiral

BANNED
Jun 24, 2005
2,018
8
193
You have several options ...

1. Rebuild your PHP configuration

2. Rebuild PHP itself (/scripts/EasyApache | Manual Compile)

3. Download latest PHP config from PHP.NET site

4. Copy PHP.INI from Cpanel's copy of PHP also running on your server
to /usr/local/lib and make any necessary adjustments.
(locate php.ini)

5. Download PHP source and just copy PHP.INI template out of that

Any way you cut it though, it is fairly simple to get your PHP configuration back and it's a simple matter of updating settings.
 

Chriz1977

Well-Known Member
Sep 18, 2006
191
0
166
Its the one in /usr/local/lib that i lost. Is that the cpanel one as its working ok?
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
To regenerate a new php.ini file, I would move the existing (empty or incomplete) file out of the way, renaming it if needed.

Then, run EasyApache, following through to build completion; this will generate a fresh php.ini file.

Here is the command to run EasyApache via root SSH access:
Code:
# /scripts/easyapache
Here is the menu path to run EasyApache via your root WHM control panel:
WHM: Main >> Software >> EasyApache (Apache Update)

Immediately following the build completion, I recommend saving a custom backup of the php.ini file in case it is needed later to revert back to (e.g., after editing or for testing).
Code:
# cp -pv /usr/local/lib/php.ini /usr/local/lib/php.ini.backup
 

aspardeshi

Member
Oct 22, 2009
15
0
51
change file permissions of php.ini

try changing file permission for php.ini. it worked for me some time long ago. :)