How to use PHP to call system commands in LINUX

Source: Internet
Author: User
In LINUX, I use PHP to call System commands. in linux, I use PHP's system () to call System commands. if it is like system (ls), it can be implemented, system (cp & nbsp; file_path1 & nbsp; file_path2) fails. If you use SYSTEM () of C to execute the CP operation, it is successful. I did other tests and wrote a file replication program in C. If you call the system commands in the source file LINUX using PHP
In linux, I use PHP's System () to call system commands. if it is like System ("ls"), it can be implemented, if it is system ("cp file_path1 file_path2"), it will fail. If you use SYSTEM () of C to execute the CP operation, it is successful. I did other tests and wrote a file replication program in C. If the source file path is left in C, the file can be accessed. if, is to pass the file path in the form of parameters, if using C system () can be executed successfully, if using PHP system (), the returned file pointer is NULL. Which of the following situations has I encountered? can I help solve this problem? thank you.
------ Solution --------------------
Note the permissions of the php execution user.
------ Solution --------------------
It should be about permissions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.