Solution to php exec command failure on the server

Source: Internet
Author: User
For security reasons, the server does not allow php or other languages to execute the exec command. when you have special requirements for php to execute the exec command on the server, you need to set two places, otherwise, the execution will fail. This article does not discuss the linux system in the windows php environment.

For security reasons, the server does not allow php or other languages to execute the exec command. when you have special requirements for php to execute the exec command on the server, you need to set two places, otherwise, the execution will fail.

1. modify php. ini

Find the php configuration file php. ini. if you use the out-of-the-stars php automatic installation program to configure the php environment, this file is in the C: \ WINDOWS \ directory.

Search for "disable_functions" in the file, find it, remove "exec" and "shell_exec", and save the file.

2. modify attributes of the cmd.exe file

Go to C: \ WINDOWS \ system32, find the cmd.exe file, right-click-> properties, and add the Internet guest account in "security" settings, that is, the IUSR _ ****** account, then Grant "Read and run" and "read" permissions.

In this way, php can execute the exec command on the server.

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.