run php from command line with short tags

2019-06-07 06:00发布

I have a framework with a lot of file using

when I include a file from the framework the include doesn't know it's a php file and refer it as a simple text file.

now my php definition in the php.ini is use_short_tags enable, i also see it when I browse the site, it's working.

my question is how to use the framework files and let the php know to use short tags when i run my script from the command line

thanks

标签: php linux shell
2条回答
甜甜的少女心
2楼-- · 2019-06-07 06:32

In ubuntu/debian you have to change

short_open_tag Off

to

short_open_tag On

in

/etc/php5/cli/php.ini

And you no need to restart any service after this, just use your console php.

查看更多
该账号已被封号
3楼-- · 2019-06-07 06:33

The INI tag can be set directly from the CLI:

php -d short_open_tag=On <scriptname>
查看更多
登录 后发表回答