- Log in to Magento using your administrator account.
In the left sidebar, click Stores, and then under Settings, click Configuration. - Click Advanced, and then click Admin.
Under Security, in the Admin Session Lifetime (seconds) text box, - type the session timeout interval in seconds that you want to use. For example, a value of 1200 sets a timeout interval of 20 minutes.
- Click Save Config.
- Log out of Magento, and then log back in. The new session timeout interval is now active.
Tag Archives: Magento 2
Magento 2 Observers
Observers are the particular classes that control the general behavior, performance, or change in the business logic of the store. They are executed whenever a specific event for which they were set to listen is triggered.
To create an observer in Magento 2, you must place your class file under the ModuleRoot/Observer
directory. The observer class file should use Magento\Framework\Event\Observer
and Magento\Framework\Event\ObserverInterface
class and define the executive function.
Magento 2 Events
Events are dispatched by Magento 2 modules whenever specific actions are triggered. When an event dispatches, it passes data to the observer that is configured to watch (or monitor) that event. You can dispatch Magento 2 Events using the Magento\Framework\Event\Manager
class. This class can be obtained through dependency injection by defining the dependency in the constructor method of the class.
To dispatch an event, you have to call the dispatch function of the event manager class, providing the name of the event along with an array of data that you wish to deliver to observers.
Magento 2 Session Factory Does Not Exist
Issue the following command to fix the issue.
php bin/magento setup:static-content:deploy -f php bin/magento setup:di:compile php bin/magento indexer:reindex php bin/magento cache:flush
Magento 2 Default Nginx Configuration
upstream fastcgi_backend {
server unix:/var/run/php-fpm/php-fpm.sock;
}
server {
listen 80;
server_name www.phpcodez.com phpcodez.com;
set $MAGE_ROOT /usr/share/nginx/html/phpcodez;
include /usr/share/nginx/html/phpcodez/nginx.conf.sample;
}
The requested URL /magento/admin/ was not found on this server magento 2
Edit apache configuration file and modify as follows. As per my installation, configuration file is /etc/httpd/conf/httpd.conf
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
To
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
currently unable to handle this request. HTTP ERROR 500 Magento 2
Those who use CentOS 7 , try disabling selinux and save yourself 🙂
Also It can be caused by a number of things, such as:
File Permissions
Fatal Code Errors
Web Server Issues
Disable Selinux
Run the following command to disable SELinux immediately
setenforce 0
getenforce
invalid authorization request bad_request zendesk
Make sure you have configured correct redirect url in zendesk Oauth client details
https://{storeDomain}/zendesk
https://{storeDomain}/zendesk/
Magento 2 Custom Query
<?php use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $params = $_SERVER; $bootstrap = Bootstrap::create(BP, $params); $objectManager = $bootstrap->getObjectManager(); $state = $objectManager->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); $resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); $connection = $resource->getConnection(); $sql = "Select * FROM customer_entity" ; $result = $connection->fetchAll($sql); print_r($result); ?>