does exec() function execute the shell commands ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tech.gsr
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 7:16 am

does exec() function execute the shell commands ?

Post 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
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

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

Post by jayshields »

It'll most likely be to do with permissions. You know PHP has it's own mkdir() command?
tech.gsr
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 7:16 am

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

Post 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
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

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

Post 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.
tech.gsr
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 7:16 am

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

Post by tech.gsr »

thanks jayshields and sory for that twice post.

i will check that and report to you.
Post Reply