Showing error "Connection string is empty" in magento - magento

When i am installing an extension in my magento admin,it shows Connection string is empty.
I don't know why this problem occurs. I cleared the cache also then also the problem is same.
If anyone knows how to do this,please help me out.
Thanks!

To solve this problem, follow the steps below (I suppose you are using Ubuntu):
1) sudo chmod -R 777 /var/www/html/magentoInstallationFolder/
2) Install Magento Extension
3) Restore correct permissions for directories and files respectively
sudo find /var/www/html/magentoInstallationFolder/ -type d -exec chmod 775 {} \;
sudo find /var/www/html/magentoInstallationFolder/ -type f -exec chmod 664 {} \;
Read more about why 777 permissions are bad and you need to restore good permission code (775) after you install the extension: https://askubuntu.com/a/30635

Magento tries to put the maintenance flag in the root directory. Here is the code that does it:
<?php
//downloader/Maged/Controller.php::startInstall()
if ($this->_getMaintenanceFlag()) {
...
//downloader/Maged/Controller.php::isWritable()
$this->_writable = is_writable($this->getMageDir() . DIRECTORY_SEPARATOR)
If you can't change magento root directory permissions just uncheck "Put store on the maintenance mode while installing/upgrading/backup creation" flag.

There's a couple of suggestions to change the permissions to this:
sudo chmod 777 -R /var/www/html
Which is a really really bad idea. Have a search for 'Magento permissions' and follow the guide instead. Unless you're seeking to get your site hacked wihin a few minutes.

Have to change right recursively (chown -R) to www-data:www-data on a directory containing magento (example : /var/www/magento)
Sorry for bad engish

chown -R www-data:www-data /var/www/your_magento_folder
That did the tick for me, don't change the owner of the www folder

Type the following command in your terminal.
sudo chmod 777 -R /var/www/html/<magento folder name>. Press Enter.
Then it will ask for password if exists for your username.
Once it is done, login and logout the admin and try to install extension which you want
Edited:
Try this for your files:
sudo chmod 777 -R /var/www/html
and follow the above steps.

Related

Getting blank page when error in Laravel Valet WSL

I'm getting a blank page when an error occurs while using Valet WSL.
I can read the error on the "title" of the browser tab but it shows no page content.
I'm on Laravel 7 and valet-wsl 1.0.6 and WSL 1.
Check the following
.env file is present in the project root with proper values
Check whether proper permissions are set on files and folders especially bootstrap\cache and storage
Whether the web-server user has the appropriate permissions on bootstrap\cache and storage
To set proper permissions on all files and folders in the project
# replace /var/www/myproject with path to your project on webserver root
find /var/www/myproject -type f -exec chmod 664 {} \;
find /var/www/myproject -type d -exec chmod 755 {} \;
To ensure proper permissions on bootstrap\cache and storage`
# replace <non-root-sudo-user> with your username
setfacl -Rdm u:www-data:rwx,u:<non-root-sudo-user>:rwx storage
setfacl -Rdm u:www-data:rwx,u:<non-root-sudo-user>:rwx bootstrap/cache
setfacl -Rm u:www-data:rwx,u:<non-root-sudo-user>:rwx storage
setfacl -Rm u:www-data:rwx,u:<non-root-sudo-user>:rwx bootstrap/cache
These are the common pitfalls for getting a blank page

Laravel installation with sudo permissions

I have laravel up and running on my Ubuntu 16.04 LTS and have installed laravel at /var/www/ however, I am concerned with why I have to sudo to make any changes to the folder files which is a bit annoying as I have to run sudo subl . in my directory to be able to work.
Unfortunately I also installed with sudo composer which only after I realised this was a bad move.
Is there a way to either move my installation so that I do not have to sudo to edit changes or is there a better way to do it? Shall I uninstall, delete directory and start again from a usr folder or local folder.
Furthermore I cannot run gulp from this directory which is in my home/node_modules. Should I start again and keep a folder in my home directory or is there a better way to do it in var/www/?
You don't need to use sudo (root) do do anything like serving a page, or worse, stop using root to do things like that on your servers, the more you do that, the less secure your server is becoming. You just need to ensure the webserver has access to your files (mostly reading rights), so two things may happen here:
1) Set your files to be readable by your webserver (www-data?) doing
DIRECTORY=/var/www/yourapp
YOUR_USER=antoniocarlos
sudo find $DIRECTORY -type d -exec sudo chmod 750 {} \;
sudo find $DIRECTORY -type f -exec sudo chmod 640 {} \;
2) Make sure the storage path is writable by the group
sudo find $DIRECTORY/storage -type d -exec sudo chmod 770 {} \;
sudo find $DIRECTORY/storage -type f -exec sudo chmod 660 {} \;
3) Make sure the folder is owned by the proper user and group
sudo chown -R $YOUR_USER:www-data $DIRECTORY
Then you should be able to just do things like
composer require package/name
php artisan make:whatever
All without sudo, and your webserver will be serving your page too.
replace {username} with your actual username
sudo chown -R {username} ~/.composer/
You have to change the owner of the www folder to your user like so
sudo chown -R you_user:your_user /var/www

Get permission to work with files on my Amazon EC2 Ubuntu server using FTP-WinSCP

I have an Ubuntu server on Amazon, I installed everything for working with it (php, mysql, phpmyadmin, apache..), The problem is that I cant move around or edit files using the FTP.
I get the error message:
Permission denied.
Error code: 3
Error message from server: Permission denied
from my WINSCP.
The only way I can trancefer/edit file is using 'putty' with the sudo/nano command.
I found a lot of information about this on google, but there are no updated soulution I can find. Linux isn't my usual work-space.
How do I get the permissions working for the WINSCP ?
A lot of answers say to change permissions on /var/www/ ... however AWS shortcuts out of the WWW folder and into the /var/app/current/ directory. If all else fails try:
sudo chown -R -v ec2-user /var/app/current/
On Ubuntu image in AWS, default user is ubuntu. Instead of using system folders like /var/... better to use /home/your_folder. Then change the ownership using {chown} command. For eg.
$ sudo chown -R -v ubuntu /home/your_folder/
This will change the ownership of 'your_folder' and contents inside it from 'root' user to 'ubuntu'. Then Winscp should be able to upload/delete/create files using SFTP/FTP etc..
I had the same issues. The solution is: You can solve this by changing WordPress ownership type:
sudo chown -R www-data:ubuntu /var/www/wordpress
Then, Change the right permission for the particular files and directories, type command
sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;
Apart from this, set the following important files to chmod 600 so that only the owner can fully read and write access to these files:
sudo chmod 600 /var/www/wordpress/wp-config.php
sudo chmod 600 /var/www/wordpress/.htaccess
Then everything will work. You will be able to access your wordpress files
for me using free tier from cloud providers will not give you root access, to fix this you have to change folder permission from SSH or try this solution
OS: windows 10 Pro
Open WinSCP instead of SFTP you select SCP go to advance settings click on SCP/Shell and change the shell option to sudo su -
Now you will be able to get permission.
Change file permision by command chmod 777 /var/app/current/ and transfer files to the directory

Magento Connect install Error moving uploaded file

I have problem with magento connect. i am not able to install any downloaded packages of magento extensions like mailchimp, onestep checkout package.
While i am uploading package, its shows error like Error moving uploaded file
i dont know what to do. please help me..
Thanks
The solution to this problem is to set all folders permission to 777.
Go to your installation root folder and run the following command (You should have access to SSH on your server to run this command):-
find . -type d -exec chmod 777 {} \;
Now you will not get the error on Magento Connect Manager and you will be able to install any extension from there.
Don’t forget to change the folder permission to 755 after you are done with installing your extension from Magento Connect Manager.
To do this, run the following commands:-
find . -type d -exec chmod 755 {} \;
chmod 777 var var/.htaccess app/etc
find var -type d -exec chmod 777 {} \;
chmod -R 777 media

Can't install Magento due to permissions, what am I doing wrong?

I've run the following commands on my Magento directory on Ubuntu Server.
chmod 0777 var/.htaccess
chmod 0777 var
chmod 0777 app/etc
chmod -R 0777 media
However, now the Magento installer is still complaining with:
Path "/var/www/store/var/package" must be writable.
I tried:
chmod 0777 var/package
With no luck.
I've also tried this guide for resetting permissions, still without any luck. What am I doing wrong?
You should set permissions recursively:
chmod -R 0777 var

Resources