Skip to content
Advertisement

Symfony Filesystem chmod() sets the incorrect permissions

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.

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement