Home > Backend Development > PHP Problem > How to solve the problem that php exec Chinese does not execute

How to solve the problem that php exec Chinese does not execute

藏色散人
Release: 2023-03-13 17:30:01
Original
1805 people have browsed it

Solution for php exec not executing in Chinese: 1. Set the language of the environment through "$set_charset = 'export.UTF-8;';"; 2. Execute "exec($set_charset.$cmd, $ ret, $out);" That's it.

How to solve the problem that php exec Chinese does not execute

The operating environment of this article: linux5.9.8 system, PHP7.1 version, DELL G3 computer

How to solve the problem that php exec cannot work in Chinese Execution problem?

The pitfalls of PHP calling exec to execute Chinese commands:

Server system Linux

Execute rar x through php exec. The decompression command maintains the directory structure and compresses the package. The English directory is decompressed normally

The Chinese directory decompression failed, is there any way to solve it

There is no problem in decompressing it directly using the terminal command

Final solution

$set_charset = 'export.UTF-8;';
exec($set_charset.$cmd, $ret, $out);
Copy after login

Before executing the command, set the language setting of the environment to solve the problem

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to solve the problem that php exec Chinese does not execute. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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