server not picking up cli php.ini


#1

For the life of me I can’t figure out why php is not loading the cli php.ini though it’s located in the directory. Can someone please tell me?

PHP Version => 7.1.17-0ubuntu0.17.10.1

System => Linux dhcppc16 4.13.0-21-generic #24-Ubuntu SMP Mon Dec 18 17:29:35 UTC 2017 i686
Build Date => May 9 2018 17:28:01
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php/7.1/cli
Loaded Configuration File => b[/b]
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20160303
PHP Extension => 20160303
Zend Extension => 320160303
Zend Extension Build => API320160303,NTS
PHP Extension Build => API20160303,NTS
Debug Build => no


#2

what error is it giving?


#3

There’s no error per se, it’s just that I can’t get the sqlite extension to work (though it’s enabled in the php.ini mentioned above). I assume that’s because the .ini is not being loaded (and thus my original question).


#4

Have you restarted the sever since making the change? Are you sure you changed the CLI and not the CGI file?


#5

Yes, I restarted the server and changed the php.ini in /etc/php/7.1/cli.


#6

Let me revise this… This server is acting as a jailserver for testing student code.

When ssh’ing to the server in command line and I execute php --ini, the loaded config file is CORRECT (it shows the loaded config file as the cli/php.ini). However, when I access the server (send code to the jailserver) over an http connection, the loaded config file is missing (when viewed through phpinfo().

For your reference:
http://vpl.dis.ulpgc.es/index.php/support/2014-09-27-15-06-22/40-how-to-install-vpl-jail-system


#7

I actually don’t need the reference. The issue I see, you are using two different INI’s. The one used by phpinfo() done over http/s protocol is different than the one used by CLI.

So, if you intend to use this for http, you need to update the CGI INI as well.


#8

I thought so as well, but there are only 2 php.ini files on the server and one is a link to the other.


#9

can you post both files?

Granted I am more interested in the one that actually gets listed on the phpinfo function call.


#10

Sure thing. Here’s the search result:

geoff@dhcppc16:/etc/php/7.1/cli$ sudo find / -type f -name php.ini 2>/dev/null
[sudo] password for geoff:
/etc/php/7.1/cli/php.ini
/jail/etc/php/7.1/cli/php.ini

And the two php.ini files are attached.


php.txt (69.4 KB)

php.txt (69.4 KB)


#11

The formatting is lost in a text file. Would you post them in the post with the code tags, and identify which is which?


#12

Sorry, I’ve tried to post the code wrapped in (code) tags but the character limit of each post in 2K chars and the files are 6900+ chars. So, unfortunately, I can’t post them here. When I downloaded and opened the files in Notepad++ however they were perfectly formatted.

In any event, the two files are precisely identical (I ran a ‘Compare’ in Notepad++ and the report says ‘Files Match’ line for line and the bit count is exactly the same).

Thanks again for any insights you can supply.


#13

I am at a loss then. If the extension is uncommented/ added in and actually where it should be, and you restarted the server… I don’t know what to say next.


#14

Me too…

The way it works is that a browser sends the code to the jailserver which then executes the code in CLI mode. I can’t figure out why the jailserver’s not loading the /cli/php.ini.