无法在php脚本中运行bash命令

时间:2014-07-23 02:37:15

标签: php bash bluehost

我正在尝试使用脚本自动化一些与网站相应的github同步的内容。

违规代码是

 <html>
    <head><title>github_sync script</title></head>
    <body><p>Github sync script working... Although you're probably a github webhook anyways</p><body>

<?php
    `mkdir test_dir`;
    `cd github_sync/`;
    `git clone https://github.com/frczyxw/my-website.git`;
    `cd my-website/`;
    `rm sixdegrees/`;
    `cp -R * ../../`;
?>
</html>

该脚本位于public_html / beta /目录中。我可以登录并浏览ftp并通过点击它来启动脚本(正文显示),但是在重新检查ftp目录后,我发现public_html/beta/test_dir没有出现,/public_html/beta/github_sync/也没有出现有任何东西(我在运行脚本之前手动创建它)。

服务器应该运行php5.3,我正在托管网站vie Bluehost

1 个答案:

答案 0 :(得分:0)

好的,所以我已经解决了这个问题 -

服务器配置正确 - 但是事实证明,要按顺序运行所有这些命令并且在相同的上下文中(即cd到github_sync在该文件夹中创建一个git clone),命令需要一次执行,像

`cd github_sync/;git clone wsgzsgg; rm -rf...`

向所有试图提供帮助的人致敬

相关问题