The issue is related to file permissions. Instead of giving 777 permission to the storage directory, it is recommended to give ownership of the directory to the web server user.
To do this, run the following command in the terminal:
sudo chown -R www-data:www-data /var/www/html/example-app/storage
This command will give ownership of the storage directory to the web server user, which should resolve the permission issue.
If the above command does not work, you can try giving 775 permission to the storage directory instead of 777. This will give read, write, and execute permission to the owner and group, and read and execute permission to others.
To do this, run the following command in the terminal:
sudo chmod -R 775 /var/www/html/example-app/storage
This should also resolve the permission issue.