简体   繁体   English

需要某种设置来在php中调用linux命令

[英]Need some kind of setting for calling linux commands in php

Here the content of my test-file called test.php 这是我的测试文件test.php的内容

<?php
echo exec('ls -al');
?>

When I ftp this to my host and run it by calling /test.php it nicely shows the content of my directory. 当我将该文件通过ftp传送到主机并通过调用/test.php运行它时,它很好地显示了目录的内容。 But when I put this file on my personal server (ubuntu 12.04) it don't show any content. 但是,当我将此文件放在我的个人服务器(ubuntu 12.04)上时,它没有显示任何内容。 I've tested more commands and they all went well on my domain but not on my personal server. 我测试了更多命令,它们在我的域上都运行良好,但在我的个人服务器上却运行不佳。 So, I think it's a setting of somekind but I don't no what. 因此,我认为这是某种环境,但我没有。 Could anybody tip me what to set so I can call linux-commands from php? 有人可以提示我设置什么,以便我可以从php调用linux命令吗?

check your php.ini definitions, must be a flag not set corretly. 检查您的php.ini定义,必须是未正确设置的标志。

Give a look here, it explains well what you'll need. 在这里看看,它很好地解释了您所需要的。

http://php.net/manual/en/function.system.php http://php.net/manual/zh/function.system.php

It's probably a file permissions issue. 这可能是文件权限问题。 Check the webserver error log on the system where it's not working. 在不起作用的系统上检查网络服务器错误日志。 Also compare the file permissions for the directory it's running in on both systems. 还要比较两个系统上运行的目录的文件许可权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM