Debug School

rakesh kumar
rakesh kumar

Posted on

how to run php artisan storage:link through your FTP client to allow your Laravel application to access the files

Unfortunately, you cannot run the php artisan storage:link command through your FTP client as it is a command-line command that needs to be executed on the server's command line interface.

To create a symbolic link between the storage folder and the public folder using FTP, you can follow these steps:

Connect to your server using your FTP client.

Navigate to the public directory of your Laravel application.

Locate the storage folder in your Laravel application's root directory.

Right-click on the storage folder and select "Rename."

Rename the storage folder to something like storage_temp.

Right-click on the storage_temp folder and select "Create symbolic link."

In the "Create symbolic link" dialog box, enter storage as the name of the link.

Click "OK" or "Apply" to create the symbolic link.

Verify that the symbolic link has been created by checking the contents of the public directory. You should see a new folder called storage that points to the original storage folder.

By creating a symbolic link between the storage folder and the public directory, you are essentially making the contents of the storage folder accessible to the public without compromising the security of your Laravel application. Note that you may need to set the correct permissions for the storage folder to allow your Laravel application to access the files.

Image description

how to run php artisan storage:link through your FTP client in laravel

Unfortunately, you cannot run the php artisan storage:link command through your FTP client as it is a command-line command that needs to be executed on the server's command line interface.

However, you can create a symbolic link between the storage folder and the public folder manually using your FTP client. Here are the steps to do so:

Connect to your server using your FTP client.

Navigate to the public directory of your Laravel application.

Locate the storage folder in your Laravel application's root directory.

Right-click on the storage folder and select "Rename."

Rename the storage folder to something like storage_temp.

Right-click on the public directory and select "Create directory."

Name the new directory as storage.

Navigate to the directory where the public and storage_temp folders are located.

Right-click on an empty area and select "Create symbolic link" or "Create symlink".

In the "Create symbolic link" or "Create symlink" dialog box, enter the following:

Target: The path to the storage_temp folder in your Laravel application's root directory.
Link: The path to the storage folder in the public directory of your Laravel application.
For example, if your Laravel application is located in /

var/www/html/myapp, and your public directory is located in /var/www/html/myapp/public, and the storage_temp folder is located 
Enter fullscreen mode Exit fullscreen mode

in /var/www/html/myapp/storage, you would enter the following paths:

Target: /var/www/html/myapp/storage_temp
Link: /var/www/html/myapp/public/storage
Enter fullscreen mode Exit fullscreen mode

Click "OK" or "Apply" to create the symbolic link.

Verify that the symbolic link has been created by checking the contents of the public directory. You should see a new folder called storage that points to the original storage_temp folder.

By creating a symbolic link between the storage folder and the public directory, you are essentially making the contents of the storage folder accessible to the public without compromising the security of your Laravel application. Note that you may need to set the correct permissions for the storage folder to allow your Laravel application to access the files.

Top comments (0)