This article mainly introduces the solution to the Chinese chaos of gitbash PHP execution output. It has a certain reference value. Now I share it with you. Friends in need can refer to it.
During the development process, it is often necessary to execute the PHP script written under the test in gitbash under Windows. If there is Chinese output in the script, garbled characters will appear. This problem has been bothering me for a long time.
1. Check whether the system passes My Computer》Properties》Advanced System Settings》Environment Variables
Whether there is a PHP installation path, if it exists, remove it , this point is very critical, otherwise there will still be garbled characters;
2. After the first step is completed, open gitbash and execute echo $PATH
to confirm whether PHP still exists in the environment variable path; if it exists, please go to Computer>>Properties>>Advanced Properties>>Environment Variables to check whether it is completely removed;
3. By executing in gitbash, vim ~/.bashrc
add the following Content (set the environment encoding and add the PHP path to the environment variable)
export LANG=en_US.utf-8 export PATH="$PATH:/f/phpStudy/PHPTutorial/php/php-7.0.12-nts"
4. Execute source ~/.bashrc
Re-close and then open gitbash
5. Execute php test.php
and try to output Chinese to see if the problem of Chinese garbled characters has been successfully solved.
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
The above is the detailed content of Solution to gitbash PHP execution output with Chinese scrambled code. For more information, please follow other related articles on the PHP Chinese website!