Getting blank page after changing the deploy mode to developer - magento2

fresh installed Magento 2.2.3 with sample data everything worked fine. until I changed the deploy: mode to the developer. now it is showing a blank page, there is no error only blank screen.
refresh the cache, deleted all cache folders, generated folder and cleared pub/static folder too ( leaving .htaccess ) file. recompiled the code, ran setup upgrade commands but without any solution.
please help.

You can try enabling the developer mode to check the error(s) if any.
Also please try changing the permissions of the file and folder to the following:
from the root directory:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
find ./var -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;

You should enable exception printing by renaming local.xml.sample to local.xml in pub/errors. Also check exception and system log in var/log

Related

Magento 2 does not load css or js after setup: upgrade

My website is in default mode only. After run "setup:upgrade" my web does not load the resources css or js. "Refused to apply style from '' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled."
Any idea what might be causing this problem?
If you are using Linux then change the mode to developer and then run php bin/magento cache:flush from the document root of the webserver.
If you are using Windows then please follow the below steps:
change the mode to developer
run php bin/magento cache:flush from the project directory
run bin/magento setup:static-content:deploy -f from the project directory
Please let me know how it goes!
Try this
sudo su
cd /var/www/html/magento2
Set permissions to the files as follows
find . -type f -exec chmod 644 {} \;
Set permissions to the directories as follows
find . -type d -exec chmod 755 {} \;
Set permissions to special directories: as follows (these commands solve your file uploading issue)
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
Please check the .htaccess file in pub/static/.htaccess. If not then please add it.
thanks!!
Solution -
In file /etc/apache2/apache2.conf Navigate <Directory /var/www/>, Change "AllowOverride None" to "AllowOverride All" 2. Add this at last in env.php located at <MagentoRootDirectory/app/etc>
`'system' => [
'default' => [
'web' => [
'unsecure' => [
'base_media_url' => '{{secure_base_url}}pub/media/',
'base_static_url' => '{{secure_base_url}}pub/static/'
],
'secure' => [
'base_media_url' => '{{secure_base_url}}pub/media/',
'base_static_url' => '{{secure_base_url}}pub/static/'
]
]
]
]`
In etc/di.xml, Search <item name="view_preprocessed" xsi:type="object"> Under that Modify this Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Add this in db INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;
Add this in db UPDATE core_config_data SET value = '0' WHERE core_config_data.path LIKE '%web/seo/use_rewrites%';
Run this command, sudo a2enmod rewrite

I change file permitions of root

I didn't check that I'm at root and I ran
chown www-data:www-data -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
I don't have backup thats why I cant restore
all my website's goes 503 :(
The last thing that I saw on command was http://prntscr.com/oags7v before I scream
How can I recover the original ownership of the files and their permissions with chown and chmod?
thank you in advance & best regards...
At this point... first read The Tao of Backup. Better late than never.
Then, back up anything yours. Any apps you made, any data you have. Anything that is not OS.
Wipe the machine clean, reinstall OS. Reinstall any necessary software.
Put your data back, and chown them appropriately.
Make sure everything works.
Then see if you learned anything from The Tao of Backup. Reread as needed.

Unable to determine status of lock file in the data directory

I am trying to run multiple mongod instances on the same centos machine with different config files.
I am getting following error while running the instance as a service:
sudo service mongod1 start
/var/lib/mongo1: boost::filesystem::status: Permission denied: "/var/lib/mongo1/mongod.lock"
I have added the permissions for the /var/lib/mongo1 using:
sudo chmod -R 600 /var/lib/mongo1
I also tried with 700, 755 and 777 at the end but nothing seems to work.
mongod:mongod is the owner of the folder /var/lib/mongo1
Any help is appreciated.
I know this is really late but I was struggling with this for days and just now found the fix. That being said for future users running into this issue the solution if you're using SELinux is to check the context of the default mongodb path against your own to make sure they are the same by executing
ls -dZ /var/lib/mongo/
the output should look something like this
drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 /var/lib/mongo/
if it's not then you can copy it by doing
chcon -R --reference=/var/lib/mongo /your/path
the source can be found here
Maybe the lock file is missing? Which might explain why chmod isn't having the desired effect...
Try:
touch /var/mongo1/mongod.lock
chown mongod:mongod
chmod 600 /var/mongo1/mongod.lock
important :
Don't try to restart mongo using sudo as it tries to change the user to root where as /var/lib/mongodb owner is mongod:mongod
Please remember that Directories needs to have execute permission, but the files within the directories do not need to execute permission.
The following 2 commands worked for me
$ sudo chmod -R 770 /var/lib/mongo1
$ sudo find /var/lib/mongo1 -type f -exec chmod 660 {} \;
This will first give everything under /var/lib/mongo1 execute permission, and then return all the normal files to having only read and write, but not execute.

How to remove all files starting with a certain string in particular path

I used centos 6.5
in / path I have a lot of files that started with this name tmp_
I work with a user franco who has a limit permission ( and I can't add permission to this user )
and with FileZilla when I try to delete these files, I have a permission denied message.
so the solution is to delete these files with command in putty tool
because in putty, I can use command like this sudo rm .....
but I did not find the exact command.
I found this kind of command :
rm ./-tmp_
I want only to delete the files which are only in \ path and not in its subdirectories and which started with tmp_
I work with critical system so I want to be sure before execute any command.
To find target files use :
This will just print files on console.
find / -maxdepth 1 -type f -name 'tmp_*'
To remove files (not directories):
find / -maxdepth 1 -type f -name 'tmp_*' -exec rm -f {} \;
Please use -maxdepth attribute if you want to target files to specific depth.
The command "sudo rm -rf /tmp_" is worked if the /tmp_ directory not used for you.

Apache 2 on Ubuntu shows 403 forbidden on certain urls

I have a Zend Framework application. Almost all of my urls work fine. However, any url that starts with /resources gives me a 403 forbidden error (e.g.: /resources/add, /resources/edit). The strange thing is, when I tested it on my Windows machine via XAMP, everything worked fine. Is there something special about urls starting with /resources that makes Apache2 think it should not allow access?
Your issue seems a permissions problem, nothing related to URLs. Check directories to be 755 and files 644 in the Ubuntu server where you deployed your application.
Run this in the root directory of your application and should get you going:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;