How to click a link on the PHP web page to execute the SHELL script

Source: Internet
Author: User
On the PHP web page, how does one click a link to execute a SHELL script, such as a question, and create a PHP program to generate EXL? How does one implement this function by clicking a link on the page to call PHP to generate EXL?

Now I have made a link on the WEB page and linked it to getexl. php, as shown below:

WEB call code:
Generate EXL

Getexl. php code:
System ("/usr/local/bin/php/www/xxxx/exllfile. php"); // Generate an EXL program
?>

After clicking the link, the progress bar under IE is very slow and cannot be executed. The/www/xxxx/exllfile. php program has no problem at all. it takes only a few seconds to run in LINUX. what is the problem?


Reply to discussion (solution)

You have no permission.

What permissions are required? My directory and file are already 777

Do I need to configure the server's WEB execution permission?

Does the server need to set the WEB execution permission configuration?

After clicking the link, the progress bar under IE is very slow and cannot be executed.
Whether the file is not generated or the generated file cannot be downloaded.
If an object is generated, it cannot be downloaded. /Usr/local/bin/php/www/xxxx/exllfile. php
After the exl file is generated, do I set the header and echo file content?

For example, the generated file name is 1.xls.
Because you need to notify the browser to download, you need to set the header.

header('content-type:application/octet-stream');header('content-disposition:attachment;filename=1.xls');header('content-length:'.filesize('1.xls'));readfile('1.xls');

Php in system cannot be executed. system ("/usr/local/bin/php/www/xxxx/exllfile. php"); only one echo can be executed.

Whether the system function is disabled in php. Disabled_function parameters

Is the disabled_function parameter configured in php. ini?

Set this parameter to on. in this case, disable_functions = on?

Set this parameter to on. in this case, disable_functions = on?

No, this location is the method you want to disable. For example:
Response = system, exec, shell_exec, passthru, proc_open, proc_close, closed, checkdnsrr, getmxrr, getservbyname, getservbyport, syslog, popen, show_source, highlight_file, dl, comment, socket_create, comment, example, socket_connect, example, ftp_connect, ftp_login, ftp_pasv, ftp_get, example, example, disk_free_space, example, posix_getegid, posix_geteuid, example, example, posix_getgrnam, posix_getgroups, upper, lower, lower, posix_getpid, lower, posix_getpwnam, lower, lower, posix_getsid, posix_getuid, lower, posix_kill, posix_mkfifo, lower, posix_setsid, posix_setuid, posix_strerror, posix_times, posix_ttyname, posix_uname

How should I set up the system function of PHP?

How should I set up the system function of PHP?

Delete the system function from the disable_functions section of the configuration file.

Check security mode ....

In addition, do not generate exl?

Solved. thank you!

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.