0

I am trying to make a system('touch 1.test'); inside my server.
So I call systest.php:

<?php
      system('touch 1.test');
?>

the file isn't created.

it works perfectly when called through the command line:

/bin/php /public_html/systest.php

and it creates the file 1.test.

Can it be a permissions error? some other kind of security issue?

Any ideas? Thanks!

1
  • Where is it creating the file when you run it by hand? Where do you expect it to create it when run by the webserver? Commented Jul 7, 2014 at 22:11

1 Answer 1

1

If the folder that the file is to be created in is not owned by Apache and it isn't writable then this will fail.

Make sure it has the correct permissions or it is done in a folder which is owned by apache or created by apache.

Sign up to request clarification or add additional context in comments.

4 Comments

It doesn't have to be owned by apache, it just has to be writable by it.
But if it is owned by apache then it is writable by that group, if not then it has to be writable by everyone
Never heard of access control lists?
I pointed the file to writable area, it fixed the problem, thanks you guys!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.