Your Location is: Home > Php

Execute shell (start screen -S) on linux-debian with php-website

From: India View: 3876 Questy 


I want execute a shell-script from an php-file (like you visit on and the file.php exec a file named to execute an screen -S kill & screen -S start

#!/bin/sh screen -S name-X quit && screen -d -m -S screen-name etc....

my currently try looks like this:

<?php shell_exec ("/var/www/html/panel/script/restart6.php"); ?>

But the exec is not working. If i try to create an folder with:

<?php shell_exec("/var/www/html/panel/script/"); ?>

( ->) mkdir zzz The folder will be created! on visit the php-script on website:

Why the command is working with mkdir, but not with screen? Already 777 the folder and chown -R the correct user. If i try to execute the file directly on terminal (with php filename.php) it works with the same file, this file who dont work on php-website. But if i try to execute on php-website.php, nothing happens! Only with the mkdir example a folder will be created. But the screen stop&start is not take over! Someone know a solution? Thanks!

//edit: i also tried to create an file with "exec file.php" and open this .php-file in browser - same result. It seems like, some permission(?)problem or something like that. on terminal in Putty it´s still working if i try: php restart6.php and all works fine! Dont understanding.

Best answer