All posts by Pramod T P

Upstream sent too big header while reading response

Edit the Nginx Configuration File

Open the Nginx configuration file for your site. This is typically located inĀ  /etc/nginx/nginx.conf.

Increase the Buffer Size

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

Example Code

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 172.26.0.6:9000;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Test the Nginx Configuration

After making changes, test the Nginx configuration to ensure there are no syntax errors:

sudo nginx -t

Reload Nginx

If the configuration test is successful, reload Nginx to apply the changes:

sudo systemctl reload nginx

 

Navigate to a Folder from Any Location by Typing a Letter – Linux

Step 1: Add the alias to your shell configuration file

Open your shell configuration file in a text editor. Depending on your shell, this could be:

nano ~/.bashrc

Step 2: Add the alias

Add the following line to the file:

alias h=’cd /var/www/html’

Step 3: Save and reload

Save the file and exit the editor. Then, reload the shell configuration to apply the changes:

source ~/.bashrc

Step 4: Test it

Now, you can simply type h in your terminal, and it will take you directly to /var/www/html.

React vs next JS

React.js

  • A library for building user interfaces.
  • Great for SPAs (Single Page Applications) where client-side
  • rendering (CSR) is enough.
  • Requires additional setup for routing, state management, and API
  • handling (e.g., using React Router, Redux, etc.).
  • More flexibility but requires manual configuration for things like SSR, SEO, and performance optimizations.

Next.js

  • A framework built on top of React.
  • Provides SSR (Server-Side Rendering), SSG (Static Site Generation), and ISR (Incremental Static Regeneration) for better SEO and performance.
  • Comes with built-in routing (file-based), API routes, and full-stack capabilities.
  • Ideal for fast-loading, SEO-friendly websites, such as e-commerce platforms, blogs, and dashboards.

Difference Between composer.json and composer.lock Files

The composer.json and composer.lock files are both essential in managing dependencies in PHP projects using Composer, but they serve different purposes:

1. composer.json
Purpose: This is the main configuration file where you define your project’s dependencies, scripts, and other metadata.

Content: It includes the list of required packages, version constraints, and other settings like autoload configurations, scripts, and repositories.

Usage: When you run composer install, Composer reads this file to determine which packages and versions to install.

2. composer.lock
Purpose: This file is automatically generated by Composer and records the exact versions of the dependencies installed in your project.

Content: It contains detailed information about each package, including the exact version, source, and dependencies.

Usage: When you run composer install, Composer uses this file to install the exact versions of the dependencies specified, ensuring consistency across installations.

Editable: This file should not be manually edited. It is updated automatically when you run composer update or when you install new dependencies.

Key Differences:
Control: composer.json is manually controlled by the developer, while composer.lock is automatically managed by Composer.

Versioning: composer.json specifies version constraints (e.g., ^2.0), whereas composer.lock records the exact versions installed.

Consistency: composer.lock ensures that all installations of the project use the same versions of dependencies, providing consistency across different environments.

Best Practices:
Development: Use composer.json to define your dependencies and version constraints.

Deployment: Always commit composer.lock to your version control system (e.g., Git) to ensure that all team members and deployment environments use the same dependency versions.

Updates: Run composer update to update dependencies and generate a new composer.lock file when you want to upgrade to newer versions within the constraints defined in composer.json.

By understanding and using both files correctly, you can effectively manage your PHP project’s dependencies and ensure a consistent development and deployment environment.

 

Magento 2 disable captcha from admin login form

Disable Using Command Line

php bin/magento config:set admin/captcha/enable 0
php bin/magento cache:flush

Disable Directly in Database

UPDATE core_config_data
SET value = 0
WHERE path = ‘admin/captcha/enable’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/fonts%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/mode’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/forms%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/enable%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/always_for%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/type%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/timeout%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/failed_attempts_logging%’;

DELETE FROM core_config_data WHERE path LIKE ‘admin/captcha/max_attempts%’;