简体   繁体   中英

PHP.ini showing different values to phpinfo() in Laravel Homestead

I;m trying to modify the PHP.ini file for Laravel homestead to enable short_open_tags .

Following joepferguson 's advice, I've added the following lines into my after.sh file:

sudo sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/5.6/fpm/php.ini
sudo sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/fpm/php.ini
sudo sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.1/fpm/php.ini
sudo sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.2/fpm/php.ini

Now, when I SSH into my homestead server and run the following:

vagrant@homestead:/etc/php/7.1/fpm$ cat php.ini | grep short_
; short_open_tag
short_open_tag = On

It clearly shows that it is on. However, they are still not working and when I run the following code:

It shows that it is indeed loading the same php.ini file: /etc/php/7.1/fpm/php.ini

But that shortopen tags is still set to Off, further down the file phpinfo():

在此输入图像描述

If I run the command php --ini I get the following:

vagrant@homestead:/etc/php/7.1/fpm$ php --ini
Configuration File (php.ini) Path: /etc/php/7.2/cli
Loaded Configuration File:         /etc/php/7.2/cli/php.ini
Scan for additional .ini files in: /etc/php/7.2/cli/conf.d
Additional .ini files parsed:      /etc/php/7.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.2/cli/conf.d/10-opcache.ini,
/etc/php/7.2/cli/conf.d/10-pdo.ini,
/etc/php/7.2/cli/conf.d/15-xml.ini,
/etc/php/7.2/cli/conf.d/20-bcmath.ini,
/etc/php/7.2/cli/conf.d/20-calendar.ini,
/etc/php/7.2/cli/conf.d/20-ctype.ini,
/etc/php/7.2/cli/conf.d/20-curl.ini,
/etc/php/7.2/cli/conf.d/20-dom.ini,
/etc/php/7.2/cli/conf.d/20-exif.ini,
/etc/php/7.2/cli/conf.d/20-fileinfo.ini,
/etc/php/7.2/cli/conf.d/20-ftp.ini,
/etc/php/7.2/cli/conf.d/20-gd.ini,
/etc/php/7.2/cli/conf.d/20-gettext.ini,
/etc/php/7.2/cli/conf.d/20-iconv.ini,
/etc/php/7.2/cli/conf.d/20-igbinary.ini,
/etc/php/7.2/cli/conf.d/20-imap.ini,
/etc/php/7.2/cli/conf.d/20-intl.ini,
/etc/php/7.2/cli/conf.d/20-json.ini,
/etc/php/7.2/cli/conf.d/20-mbstring.ini,
/etc/php/7.2/cli/conf.d/20-msgpack.ini,
/etc/php/7.2/cli/conf.d/20-mysqli.ini,
/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.2/cli/conf.d/20-pdo_pgsql.ini,
/etc/php/7.2/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.2/cli/conf.d/20-pgsql.ini,
/etc/php/7.2/cli/conf.d/20-phar.ini,
/etc/php/7.2/cli/conf.d/20-posix.ini,
/etc/php/7.2/cli/conf.d/20-readline.ini,
/etc/php/7.2/cli/conf.d/20-shmop.ini,
/etc/php/7.2/cli/conf.d/20-simplexml.ini,
/etc/php/7.2/cli/conf.d/20-soap.ini,
/etc/php/7.2/cli/conf.d/20-sockets.ini,
/etc/php/7.2/cli/conf.d/20-sqlite3.ini,
/etc/php/7.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.2/cli/conf.d/20-sysvsem.ini,
/etc/php/7.2/cli/conf.d/20-sysvshm.ini,
/etc/php/7.2/cli/conf.d/20-tokenizer.ini,
/etc/php/7.2/cli/conf.d/20-wddx.ini,
/etc/php/7.2/cli/conf.d/20-xmlreader.ini,
/etc/php/7.2/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.2/cli/conf.d/20-xsl.ini,
/etc/php/7.2/cli/conf.d/20-zip.ini,
/etc/php/7.2/cli/conf.d/25-memcached.ini,
/etc/php/7.2/cli/conf.d/90-blackfire.ini,
/etc/php/7.2/cli/conf.d/zray.ini

So homestead is loading a lot of ini files on top of php.ini, right? Except the website is using FPM, so I went to that directory and ran the following:

vagrant@homestead:/etc/php/7.1/fpm/conf.d$ grep -R "short_open"

But it returned nothing. So there is no other INI file overwriting the first one, so why is short_open_tags still not working on the webpage??

make sure you are running

sudo service php5.6-fpm restart sudo service php7.0-fpm restart sudo service php7.1-fpm restart sudo service php7.2-fpm restart sudo service nginx restart

Or just restart the versions you're editing settings for.

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