server not picking up cli php.ini

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

what error is it giving?

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).

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

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

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

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.

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

can you post both files?

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

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)

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

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.

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.

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.

Sponsor our Newsletter | Privacy Policy | Terms of Service