怎么在PHP WEB页面点击链接执行SHELL脚本

WBOY
Release: 2016-06-13 11:54:42
Original
1153 people have browsed it

如何在PHP WEB页面点击链接执行SHELL脚本
如题,做了个PHP生成EXL的程序,想在页面点击链接能调用这个PHP生成EXL,如何实现?

我现在做法是在WEB页面做了个链接,链到getexl.php,如下:

WEB调用代码:
生成EXL

getexl.php代码:
system("/usr/local/bin/php /www/xxxx/exllfile.php");//生成EXL程序
?>

点链接后IE下边进度条非常慢,执行不了。 /www/xxxx/exllfile.php这个程序一点问题没有,LINUX下运行只有几秒钟,这是什么问题?

------解决方案--------------------
没有权限了吧
------解决方案--------------------

引用:
点链接后IE下边进度条非常慢,执行不了。 

是没有生成文件还是生成了文件不能下载。
如果是生成了文件不能下载。/usr/local/bin/php /www/xxxx/exllfile.php
生成exl文件后,有设置header与echo 文件内容吗?

例如生成的文件名是1.xls。
因为你是需要通知浏览器下载的,需要设置header。
<br />header('content-type:application/octet-stream');<br />header('content-disposition:attachment;filename=1.xls');<br />header('content-length:'.filesize('1.xls'));<br />readfile('1.xls');<br />
Copy after login

------解决方案--------------------
是否是php关闭了system函数。 disabled_function参数
------解决方案--------------------
引用:
是把这个参数设成on就可以吧,这样disable_functions = on?


不是,这个位置是填写想禁用的方法。例如:
disable_functions = system,exec,shell_exec,passthru,proc_open,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname 
------解决方案--------------------
引用:
那打开PHP的system函数应该怎么设呢?


把 system 函数从 配置文件中 disable_functions 段中删除
------解决方案--------------------
检查安全模式。。。。

另外,生成exl也不用这样吧?
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!