Solution to gitbash PHP execution output with Chinese scrambled code

不言
Release: 2023-04-02 16:38:01
Original
2264 people have browsed it

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.

Question

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.

Processing method

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"
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!