简体   繁体   中英

include_path = “.:/usr/share/php” in php.ini in php 7 Ubuntu 16.04

Dears, please be patient with me I am really new to this,

I have a PHP 7.0.30-0ubuntu0.16.04.1 (cli) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologieswith Zend OPcache v7.0.30-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

My phpinfo() shows include_path .:/usr/share/php

If I change the php.ini (located in /etc/php/7.0/apache2/php.ini as per phpinfo() )

with for examples include_path .:/usr/share/php-king the phpinfo() shows the change after restarting apache2

but if I add a semicolon (;) in php.ini like ;include_path .:/usr/share/php-king

phpinfo() keeps telling me include_path .:/usr/share/php.

Question is: is there a way to disable the include path /usr/share/php

and have only ./ as the include_path ? (strange thing is that the /usr/share/php directory was not created during installation)

Thanks in advance

P.

If you remove a directive from the system-wide configuration file PHP will just use the compiled-in default value. Most directives (if not all) cannot be completely wiped out from the environment and include_path in particular does not seem to allow empty values:

var_dump(ini_set('include_path', ''));
var_dump(ini_set('include_path', null));
bool(false)
bool(false)

In real life, though, you normally just want to restrict file inclusion to working directory:

var_dump(ini_set('include_path', '.'));
var_dump(ini_get('include_path'));
string(14) ".;C:\PEAR\pear"
string(1) "."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM