Page 1 of 1

does exec() function execute the shell commands ?

Posted: Wed Mar 25, 2009 7:52 am
by tech.gsr
Hi,

i want to create a directory with the function exec() on my server using shell command 'mkdir' when a custom.php file executes. i have written the following code in custom.php file. :banghead:
<?php
exec('mkdir hello');
?>

but it is not not creating the directory.

any help.....

thanks

Re: does exec() function execute the shell commands ?

Posted: Wed Mar 25, 2009 8:27 am
by jayshields
It'll most likely be to do with permissions. You know PHP has it's own mkdir() command?

Re: does exec() function execute the shell commands ?

Posted: Wed Mar 25, 2009 8:47 am
by tech.gsr
hi, jayshields
thanks for reply

well php has its mkdir function. but actually i want to execute the linux shell commands in php file. and next thing Is there any permissions i have to provide to execute such things?

thanks

Re: does exec() function execute the shell commands ?

Posted: Wed Mar 25, 2009 9:36 am
by jayshields
I'm not that sure, but it's something to do with the user under which PHP or Apache is running. The PHP manual will probably have something about it, or it'll be in the comments http://www.php.net/manual/en/function.exec.php

Also, please don't post the same thread twice.

Re: does exec() function execute the shell commands ?

Posted: Wed Mar 25, 2009 9:44 am
by tech.gsr
thanks jayshields and sory for that twice post.

i will check that and report to you.