Microsoft Azure Symbolic Link Storage folder Laravel - laravel

I am using laravel 5.3 on Microsoft Azure web server...
I am having an issue creating a symbolic link between my /public/storage/ and /storage/app/public/ folders
I do not have the required permissions to create a symbolic link, and I have also tried to use the following command:
php artisan storage:link
Which automatically creates a symbolic link, however it gives the error:
Access is denied.
I have tried to also run the command:
mklink /d "D:home\site\wwwroot\storage\app\public\" "D:home\site\wwwroot\public\storage\"
And the error is something along the lines of:
You do not have sufficient privileges to perform this operation
How can I run command prompt in Microsoft Azure in elevated administrator mode so that I can actually create a symbolic link...
Please help.
Thanks!

Creating symlinks is something that is blocked by the Azure Web App sandbox. You can read more about it here.
If you consist to create symlinks, you can try to leverage Azure VMs.

Related

Laravel 8: Problem creating and using a a new Permission

I have a Laravel 8 Project on my Local Windows PC. I uploaded the project to my shared web hosting on Dreamhost via zip file and copying the entire database to remote host. (I am unable to use Composer and php artisan commands on the remote server) I am using Spatie Roles & Permissions in my project.
Later I had to add a new permission 'holiday_vacation' in my project. I created the new permission using artisan commands on my local system I believe that when a new permission is created, it adds a new record in the permissions table and a when a user is given access to a specific permission, a record is added to the model_has_permissions table. I believe that no other table is changed during this process. The newly created 'holiday_vacation' permission works fine on my local system.
However, after I manually updated the remote tables (permissions and model_has_permissions), the remote system is unable to find the new permission (holiday_vacation). The following commands in a controller display error message, "There is no permission named holiday_vacation for guard web."
if(auth()->user()->hasPermissionTo('holiday_vacation') )
{
dd("Has access");
}
I am absolutely sure that the permissions table has the holiday_vacation permission as I copied the permissions and model_has_permissions tables from the local database to the remote one.
Google search on this issue talks about clearing permission cache (e.g. php artisan cache:forget spatie.permission.cache then php artisan cache:clear). Unfortunately, I can't execute php artisan commands on my shared hosting.
Can someone offer a workaround, please?
#BABAK ASHRAFI's comment did the trick, except that the command needed to be modified slightly. (Ref: https://spatie.be/docs/laravel-permission/v3/advanced-usage/cache)
app()->make(\Spatie\Permission\PermissionRegistrar::class)->forgetCachedPermissions();

azure cli on osx is failing to authenticate

I have to download some files from azure to local, using a Mac.
I have been given this Windows command line:
AzCopy /Source:https://XXX.blob.core.windows.net/YYY /SourceKey:TQSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpbA== /Dest:C:\myfolder /Pattern:c /S
I have downloaded and installed azcopy, but it has a radically different syntax, and despite I've been trying for quite some time, I haven't been able to make it work.
What's the correct syntax, given this one?
Looking at some documentation, I've tried:
azcopy cp "https://XXX.blob.core.windows.net/YYY/TQSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxpbA==" "azcopy_dest" --recursive
but it doesn't work:
failed to perform copy command due to error:
cannot start job due to error: cannot list blobs for download. Failed
with error ->
github.com/Azure/azure-storage-azcopy/vendor/github.com/Azure/azure-storage-blob-go/azblob.NewResponseError,
/go/src/github.com/Azure/azure-storage-azcopy/vendor/github.com/Azure/azure-storage-blob-go/azblob/zz_generated_response_error.go:28
===== RESPONSE ERROR (ServiceCode=ResourceNotFound) ===== Description=The specified resource does not exist.
From you description it seems you are using AZCopy 10, which mean you do not need to specify key. You either need to generate a SAS token or Login before using azcopy.
create a token
azcopy cp "https://XXX.blob.core.windows.net/YYY?[SAS]" "/path/to/dir" --recursive=true
Login azcopy login --tenant-id "your tenantid"
azcopy cp "https://XXX.blob.core.windows.net/YYY" "/path/to/dir" --recursive=true
Used Linux, do not have a Mac but should be the same across all platform.
Hope this helps.

Heroku CLI authentication issue

After a fresh install of Heroku on Windows 7, I can't seem to authenticate from the command-line.
Running the command: heroku login prompts me to enter my credentials. After doing so, I received an error:
heroku: Enter your login credentials
Email: my_email
Password: ************
Error: ENOENT: no such file or directory, open 'z:/_netrc'
I am using PowerShell, and when I run the command cat z:/_netrc, I get this error:
cat : Cannot find drive. A drive with the name 'z' does not exist.
Z: is a network drive, and it is accessible from the file explorer.
I already have a .netrc file in my %HOME% path, but it does not contain the heroku login credentials.
Looking at the official documentation and CLI help, I couldn't find anything useful to fix this. How can I login to my heroku account?
> heroku version
heroku/7.16.6 win32-x64 node-v10.11.0
So, the issue is arising from not finding _netrc file on your local computer that is required to complete login with Heroku. I have decided to create the file into following location of my windows 10 computer:
cmd>set HomeDrive=C:/Users/your Windows username/AppData/Local/heroku
In my case,
cmd>set HomeDrive=C:/Users/CrazyMoby/AppData/Local/heroku
Finally I ran heroku login
The above step resolved heroku login issue in my case.
Use setx HOME <netrc_default_location>
where <netrc_default_location> can be:
<%NETRC%>\_netrc
<%HOME%>\_netrc
<%HOMEDRIVE%%HOMEPATH%>\_netrc
<%USERPROFILE%>\_netrc
Some clarification can be found here and here.
Probably it's your user <%USERPROFILE%>.
But if you don't need it, just remove _netrc file, reboot and log in again.
Run the following command in powershell and the problem should be solved.
$Env:HOMEDRIVE = "C:"
If you need more information, check out the docs on windows environment variables.
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7
This way work for me. Write in PowerShell next code , where "paulob" need change to your user, because folser "_netrc" exist in:
$Env:HOMEDRIVE = "C:\Users\paulob\"
Try running it from GIT BASH cmd instead of PowerShell if you can, I had the same problem and it worked in my case.

Ultimo console errors in Magento 2

I'm trying to install ultimo on my copy of Magento 2. The theme is appearing in the content configuration panel but it doesn't seem to apply the theme and I'm getting a large number of console errors such as those in the following screenshot:
This may be because I have been unable to enable the theme properly as I'm having some issues with the SSH.
When I try to enter the following command
bin/magento module:enable Infortis_Base Infortis_Brands Infortis_Cgen Infortis_Dataporter Infortis_Infortis Infortis_Ultimo Infortis_UltraMegamenu Infortis_UltraSlideshow
It keeps coming up with messages such as:
-bash: bin/magento: No such file or directory
I should probably also mention that on this occasion the server where the files are stored is being run by a third party and controlled through a Plesk panel.
If anyone could clarify what it is that I'm doing wrong here I would greatly appreciate it.
Thanks
verify that you are executing the command from the right location, maybe you did not change the directory to DocRoot where magento is installed:
# cd /var/www/vhosts/domain_name/httpdocs/
After that execute the command query once again
go to your magento root via cd command
then fire below command
php bin/magento module:enable Infortis_Base Infortis_Brands Infortis_Cgen Infortis_Dataporter Infortis_Infortis Infortis_Ultimo Infortis_UltraMegamenu Infortis_UltraSlideshow
if still you face issue this may be permission issue then you can reset file/folder permission via below
https://magento.stackexchange.com/questions/91870/magento-2-folder-file-permissions
Thank you to everyone who posted. It was actually a combination of the answers provided by other contributors plus something from my server provider.
I had to CD into httpdocs (the magento installation folder) and enter the below command
/opt/plesk/php/7.0/bin/php bin/magento module:enable Infortis_Base Infortis_Brands Infortis_Cgen Infortis_Dataporter Infortis_Infortis Infortis_Ultimo Infortis_UltraMegamenu Infortis_UltraSlideshow
Then run 'setup:upgrade', this seems to have fixed the issue and I can now use Ultimo.

Access is denied on mklink

I am trying to get a symlink working over a network drive.
I have already tried suggestions on questions already asked, such as running as administrator and checking if the directory already exists. Unfortunately it still gives me the following error:
C:\Windows\system32>mklink /d \\myserver\someLink \\myserver\mydir
Access is denied.
Any ideas how I could get this working? The local machine is running windows 7 and the remote machine is running windows server 2008 R2 standard.
I jumped through all the hoops:
Create a non-admin account (in my case, activated the guest account).
As Admin, run secpol.msc and grant this account Create Symbolic Link permissions.
runas /user:guest cmd to open a command window as the guest.
only to get caught on the simplest problem: because I was running as guest, I didn't have write permissions within the directory. So,
As admin, change permissions in the target directory (where you want to make the link) to give write access to the non-admin user.
I had this while I wanted to create a hard link with mklink /H ....
By removing the /H, the error vanished as well.
So if a symbolic link does the trick for you as well, you should try this.
This is a little silly, but make sure you're using /D (soft) or /J (hard) for directories or you'll get access denied.

Resources