-2

I am using the Symfony's Filesystem component, specifically chmod function:

$this->filesystem->copy($file_path, $target_file, TRUE);
$this->filesystem->chmod($target_file, '0777');

But on the terminal the permissions are weird:

$ ls -la 1.mp4
-r----x--t 1 user user 3557378 mar 10 07:55 1.mp4

It is supposed to look like this:

-rwxrwxrwx 1 user user 3557378 mar 10 07:55 1.mp4

Am I doing something wrong? I'm using the 5.2.4 version.

rpayanm
  • 6,303
  • 7
  • 26
  • 39
  • 4
    You are passing a string, and `chmod()` expects an octal number ( `chmod($targetfile, 0777);`). Have you tried that? – yivi Mar 10 '21 at 11:12

1 Answers1

2

public function chmod($files, int $mode, int $umask = 0000, bool $recursive = false)

The second param of the function is the number, you are passing a string. And check that you have a correct file owner, usually web servers working with www-data user

rpayanm
  • 6,303
  • 7
  • 26
  • 39