如何启用PHP了shell_exec和exec? [英] how to enable shell_exec and exec on php?

查看:3686
本文介绍了如何启用PHP了shell_exec和exec?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(有这个网上的一些提,但没有一个解决方案的工作。)
我希望能够使用了shell_exec和exec从PHP脚本。

含义,用途:

 &LT ;? EXEC(回声世界你好); ?>

 &LT ;?了shell_exec(回声世界你好); ?>

据一个链接我在网上找到(的http:// forums.cpanel.net/f5/enable-shell_exec-one-user-109601.html ),做到这一点的方法之一是虚拟主机下添加指令:

 < IfModule mod_php5.c>
             php_admin_value suhosin.executor.func.blacklist =了shell_exec
             < / IfModule>

但是当我看了一下配置文件,试图重新启动Web服务器,我得到:

  28/07/14十七时18分26秒:在/etc/httpd/conf.d/serv1.conf第1行语法错误:
           28/07/14十七点18分26秒:php_admin_value有两个参数,PHP值修正(管理员)

和服务器没有重新启动。

任何想法如何使exec和了shell_exec?我找不到这个错误的根源。

编辑:我不是机器上的根源。我找不到一个php.ini文件,但有一个/etc/httpd/conf.d/php.conf文件,它没有disable_functions选项。

下面是:

 
      #PHP是它试图使其成为一个HTML的嵌入式脚本语言
      #方便开发者编写动态生成的网页。
      #
      < IfModule prefork.c>
        的LoadModule php5_module模块/ libphp5.so
      < / IfModule>
      < IfModule worker.c中>
        的LoadModule php5_module模块/ libphp5-zts.so
      < / IfModule>      #
      #原因PHP的跨preTER到以.php扩展名处理文件。
      #
      AddHandler的PHP5脚本的.php
      将AddType text / html的.PHP      #
      #添加index.php来将担任目录中的文件列表
      #索引。
      #
      的DirectoryIndex index.php文件      #
      #取消以下行允许PHP pretty打印的.phps
      #文件作为PHP源$ C ​​$ C:
      #
      #AddType应用程序/ X的httpd - PHP源的.phps


解决方案

您需要通过导航\\ Apache2的\\ bin添加禁用PHP安全模式(而不是文件夹),重新启动服务器。

并的这里。它有助于

(There is some mention of this online, but none of the solutions worked.) I want to be able to use shell_exec and exec from a PHP script.

Meaning, use:

         <? exec("echo hello world"); ?> 

or

         <? shell_exec("echo hello world"); ?>

According to a link I found online (http://forums.cpanel.net/f5/enable-shell_exec-one-user-109601.html), one way to do it is to add under VirtualHost the directives:

             <IfModule mod_php5.c>
             php_admin_value suhosin.executor.func.blacklist = "shell_exec"
             </IfModule>

but when I looked at the configuration file, trying to restart the webserver, I get:

           28/07/14 17:18:26:    Syntax error on line 1 of /etc/httpd/conf.d/serv1.conf:
           28/07/14 17:18:26:    php_admin_value takes two arguments, PHP Value Modifier (Admin)

and the server is not restarted.

Any ideas how to enable exec and shell_exec? I can't trace the origin of this error.

EDIT: I am not the root on the machine. I couldn't find an php.ini file, but there is an /etc/httpd/conf.d/php.conf file and it has no disable_functions.

Here it is:

      #
      # PHP is an HTML-embedded scripting language which attempts to make it
      # easy for developers to write dynamically generated webpages.
      #
      <IfModule prefork.c>
        LoadModule php5_module modules/libphp5.so
      </IfModule>
      <IfModule worker.c>
        LoadModule php5_module modules/libphp5-zts.so
      </IfModule>

      #
      # Cause the PHP interpreter to handle files with a .php extension.
      #
      AddHandler php5-script .php
      AddType text/html .php

      #
      # Add index.php to the list of files that will be served as directory
      # indexes.
      #
      DirectoryIndex index.php

      #
      # Uncomment the following line to allow PHP to pretty-print .phps
      # files as PHP source code:
      #
      #AddType application/x-httpd-php-source .phps

解决方案

You need to disable safe mode in php by navigating through \Apache2\bin(not folder) and restart the server.

Check here and here.It would help

这篇关于如何启用PHP了shell_exec和exec?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆