Skip to content

[11.x] use exec function if the symlink function is unavailable#54651

Merged
taylorotwell merged 3 commits into
laravel:11.xfrom
aisuvro:11.x
Feb 17, 2025
Merged

[11.x] use exec function if the symlink function is unavailable#54651
taylorotwell merged 3 commits into
laravel:11.xfrom
aisuvro:11.x

Conversation

@aisuvro

@aisuvro aisuvro commented Feb 17, 2025

Copy link
Copy Markdown
Contributor

If the symlink function is unavailable, it falls back to using the exec function to run the ln -s command, creating a symbolic link using the shell.

I have tried both GitHub actions and cpanel. By default, the symlink() function does not exist for security reasons. We usually fix it by manually using the bash command "ln -s" to fix this issue.

GitHub action image below.
image

Cpanel image below.
image

 If the `symlink` function is not available, it falls back to using the `exec` function to run the `ln -s` command, which creates a symbolic link using the shell.
@aisuvro aisuvro changed the title Update Filesystem.php [11.x] use exec function if the symlink function is unavailable Feb 17, 2025
Comment thread src/Illuminate/Filesystem/Filesystem.php
@taylorotwell taylorotwell merged commit 834a024 into laravel:11.x Feb 17, 2025
@aisuvro

aisuvro commented Feb 17, 2025

Copy link
Copy Markdown
Contributor Author

Thank you for the merge.
@taylorotwell

return symlink($target, $link);
if (function_exists('symlink')) {
return symlink($target, $link);
}else{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess, you are missing an additional space on both sides for the style check to pass:

Suggested change
}else{
} else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants