php.ini does not exist
I recently setup a wordpress server and ran into this same issue.
I used apt-get install php
Everything seemed to be normal except I could not find the php.ini file either. That file is usually located in /etc/php/7.0/apache2/php.ini
My solution, and I guess is also your solution would be that apache mod didn't get installed for php. So all you need to run is apt-get install libapache2-mod-php
I also bounced apache just to be safe, but then my php.ini file was then located where I expected it in /etc/php/7.0/apache2/php.ini
Try using the command php --ini
. Since you're running command line, it won't necessarily show you the config files you may be looking for (apache, nginx, etc), but it will hopefully get you on the right path.
When I run it I see:
$ php --ini
Configuration File (php.ini) Path: /etc/php/7.0/cli
Which tells me if I'm looking for Apache files, I can find the rest up one directory from there:
$ ls /etc/php/7.0/
apache2 cli fpm mods-available
If all else fails, and you're able to browse to a .php file on the server, create a file using phpinfo like this and take a look to see what ini files are in use:
<?php
phpinfo();
Kindly use the locate
command instead. Here is my output:
subroot@subroot:~$ find php.ini
find: ‘php.ini’: No such file or directory
subroot@subroot:~$ locate php.ini
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/apache2/php.ini.ucf-dist
/etc/php/7.0/apache2/php.ini.ucf-old
/etc/php/7.0/cli/php.ini
/etc/php/7.1/apache2/php.ini
/etc/php/7.1/apache2/php.ini.ucf-dist
/etc/php/7.1/cli/php.ini
/usr/lib/php/5.6/php.ini-development
/usr/lib/php/5.6/php.ini-production
/usr/lib/php/5.6/php.ini-production.cli
/usr/lib/php/7.0/php.ini-development
/usr/lib/php/7.0/php.ini-production
/usr/lib/php/7.0/php.ini-production.cli
/usr/lib/php/7.1/php.ini-development
/usr/lib/php/7.1/php.ini-production
/usr/lib/php/7.1/php.ini-production.cli
subroot@subroot:~$
Type man find
and man locate
for the difference between the two commands.