Change save path of PHP interactive shell history

不羁岁月 提交于 2020-01-16 00:56:16

问题


I once found a way to disable session logging by php -a, php's interactive shell. How do I turn it back on? Is there a way to send logging to another, file besides ~/.php_history? I think I may have sent the output to /dev/null.

edit: It apparently still saves to the .php_history file. It doesn't save until you exit completely from the shell. I would still like to know how move the history logging to another file.


回答1:


No, currently (5.3.10 ubuntu) the filename ~/.php_history is hardcoded in the php source code. Watch :

sapi/cli/php_cli.c (line 1127)

If you really need the history file in another location you can use a symbolic link. eg :

touch /tmp/.php_history
ln -s /tmp/.php_history /home/your_name/.php_history

You might also consider sending a feature request to the php developers. They might introduce a php.ini directive for this.



来源:https://stackoverflow.com/questions/13768437/change-save-path-of-php-interactive-shell-history

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!