How to Clear cache in Laravel

Many times you face an issue that any changes to the Laravel application are not reflecting on web interfaces. This occurred due to the application is being served by the cache. This tutorial will help you to clear cache in the Laravel application.

Clear Cache in Laravel (Terminal)

Log in to the system running your Laravel application and open a terminal. Then navigate to your Laravel application code. Here you can issue the commands to clear cache as followings:

1. Clear Application Cache

Run the following command to clear application cache of the Laravel application.

php artisan cache:clear

2. Clear route cache

To clear route cache of your Laravel application execute the following command from the shell.

php artisan route:cache

3. Clear config cache

You can use config:clear to clear the config cache of the Laravel application.

php artisan config:clear 

4. Clear compiled view files

Also, you may need to clear compiled view files of your Laravel application. To clear compiled view files run the following command from the terminal.

php artisan view:clear 

Clear Cache in Laravel (Browser)

Most of the shared hosting providers don’t provide SSH access to the systems. In that case, you can clear Laravel cache by calling URL in the browser. You can simply place the below code in your routes/web.php file of Laravel application. Then access this URL in the browser to clear the cache of Laravel application.

Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    return "Cache is cleared";
});

change mysql password

Stop the MySQL service

(Ubuntu and Debian) Run the following command:

sudo /etc/init.d/mysql stop

(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following command:

sudo /etc/init.d/mysqld stop

Start MySQL without a password

Run the following command. The ampersand (&) at the end of the command is required.

sudo mysqld_safe --skip-grant-tables &

Connect to MySQL

Run the following command:

mysql -uroot

Set a new MySQL root password

Run the following command:

use mysql;

update user set authentication_string=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

Stop and start the MySQL service

(Ubuntu and Debian) Run the following commands:

sudo /etc/init.d/mysql stop
...
sudo /etc/init.d/mysql start

(CentOS, Fedora, and Red Hat Enterprise Linux) Run the following commands:

sudo /etc/init.d/mysqld stop
...
sudo /etc/init.d/mysqld start

Log in to the database

Test the new password by logging in to the database.

mysql -u root -p

Enter your new password when prompted.

How to Get a Sprint Call Log

A cell phone can usually retain a log of both incoming and outgoing calls. However, the handset’s call log is limited to a certain number of days, after which the entries automatically get deleted. To access a log that is not available on your phone, you can go to your Sprint account and access your phone’s call history. You will see the date, time, duration phone number and destination of each outgoing and incoming call.

Step 1

Go to Sprint’s website and log in to your account by entering your username and password. Once your account page opens, click the “My Account” tab.

Step 2

Click “See All Usage” at the bottom of the page.

Step 3

Click “See Call Log.” This will show you a detailed call log with each call made and received on the current billing cycle.

Step 4

Click “See my Bill” if you want to review the call log of the previous month.

How to Find a Server’s IP Address

The Internet protocol TCP/IP implies a unique IP address depicted in the dot-decimal form (such as 193.45.12.4) for every computer or server in the network. In the Internet, special domain name system (DNS) servers translate computer names into their IP addresses. Both Windows and Linux operating systems have simple commands for accessing the DNS service that allow you to find an IP address of any server worldwide.

In Windows XP/Vista/7

Step 1

Log on to a user account in Windows and go to the Start menu.

Step 2

Type “CMD” and press “Enter” to open the command prompt window in Windows Vista/7. Click “Run” and type “CMD” followed by pressing “Enter” in Windows XP.

Step 3

Type “nslookup” and press “Enter.” For instance, type “nslookup www.yahoo.com.”

Step 4

Read the command output. A line will contain the server’s name. In our example, the line contains “Name: www.yahoo.com.” The next line that begins with the word “Address” will include the the server’s IP address.

In Linux

Step 1

Click the GNOME menu “Applications” and “Accessories.” Then choose “Terminal” to open a command prompt window (terminal) in Linux.

Step 2

Type “host” and press “Enter.” For example, type “host www.amazon.com.”

Step 3

Read the server’s IP address in the command output. For instance, www.example.com has the IP address 144.5.210.250.

How to View a BIOS System Log

The Basic Input/Output System, or BIOS, of every computer or server is a vital component in the operation of that computer’s system. It stores essential information such as the system’s internal clock, hardware configuration, passwords and enabled/disabled devices. Computer users are allowed to access the BIOS system log to examine operations and make necessary changes, but there is a protocol for doing so. This protocol varies from manufacturer to manufacturer.

Accessing BIOS for Windows

Step 1

Turn on the computer. As the computer is booting up, look toward the bottom of the screen. You will notice directions that read “BIOS = F2, Boot System = F12” or something similar to those commands. Again, this will vary according to the manufacturer. Press the button indicated for BIOS.

Step 2

Press the button for “System Log” or “Event Log” on the menu that appears. The menu will offer you a variety of options that are accessed by pressing the indicated buttons.

Step 3

View the system log. If you do not see any of the prompts instructed in the previous steps, you may have to contact the BIOS manufacturer. To find the BIOS manufacturer for your system, go to the Search area on the desktop and type in “System Information.” Click “System Information” in the result, then view “System summary.” The BIOS manufacturer will be listed.

Accessing BIOS for Mac

Step 1

Turn on the computer and wait for the desktop screen to load.

Step 2

Go to “Applications,” “Utilities,” then “Console” or type “Console” in the Spotlight area.

Step 3

Go to “system.log” to view the BIOS system log.

Accessing BIOS for Gateway Servers

Step 1

Open the Gateway System Manager console and log in using your adminstrator ID and password

Step 2

Click on the “+” sign that is next to the icon labeled “GSM.”

Step 3

Click the “+” sign next to the server that you wish to view, then click “Events.”

Step 4

Click the “IPMI SEL” (short for Intelligent Platform Management Interface System Events Log) icon to show the system events log.

How to Change the Username of a Linux Account

Linux is a multi-user operating system. Each account on the system has a unique username. This is the name the user uses to log in to the system. It is also the name of the user’s home directory. Every Linux distribution uses the “usermod” command to modify user accounts. This includes changing the user name for a particular account. The “usermod” command can only be used by the root user. The root user can modify every account that accesses the operating system.

Step 1

Click on the main “Applications” or “Programs” menu.

Step 2

Click on the “Terminal” or “Konsole” menu option to open a terminal window and access the command prompt.

Step 3

Type the command “su -” to become the root user. Ubuntu and Linux Mint users type “sudo” before the following command.

Step 4

Type the command “usermod -l new_user login” to change the user name for an account. Replace “new_user” with the new username for the account. Replace “login” with the current username for the account.

Step 5

Type the command “exit” to close the root session.

How to Find UID and GID

The Linux and Unix operating systems use the UID — user ID — to identify a particular user. The GID, or group ID, is used to identify a group. Each user will have a single, unique UID and a primary GID. The user can belong to several secondary groups and each secondary group will have a unique GID. The “id” command can be used to show the UID and GIDs for a particular user. The root (super) user can view the UID and GID for any user. If you do not have root privileges, you can only view your own UID and GID.

Step 1

Open a terminal window. The terminal application is usually found in the “Accessories,” “Utilities” or “Tools” section of the main “Programs” or “Applications” menu.

Step 2

Type the command “su” to become the root user. Skip this step if you do not have root user privileges or want to find the UID or GID for your own account.

Step 3

Type the command “id -u” to find the UID for a particular user. Replace “” with the user’s Unix or Linux username.

Step 4

Type the command “id -g” to find the primary GID for a particular user. Replace “” with the user’s Unix or Linux username.

Step 5

Type the command “id -G” to list all the GIDs for a particular user. Replace “” with the user’s Unix or Linux username.

Step 6

Type the command “exit” to close the root user session.

How to View Linux Login History

Linux is a multi-user operating system, meaning that more than one person can be logged into a computer at the same time. To see the login history of all the computer’s users, use the “last” command in the Linux terminal window. Variations of the “last” command can show you the history of one particular user, or the IP addresses of any computers used to log in from, provided the Linux system can be accessed by remote computers.

Step 1

Open the Linux terminal window. The terminal window can be found under the “System Tools,” “Utilities” or “Accessories” section of the main menu depending on your distribution.

Step 2

Type the “last” in the terminal window and press Enter to see the login history of all users.

Step 3

Type the command “last” in the terminal window, replacing “” with the username for a particular user.

Step 4

Type the command “last -a” to see the login history and the IP addresses of the computers used.

Step 5

Type “exit” and press the Enter key to close the terminal window.

How to disable PHP error logs

By default, PHP errors and warnings generated by your websites are logged in error_log files in the directory where your PHP files are located. The PHP error_log files can grow to a large size.

If you do not need the error_log file you can disable PHP error logging using one of the three ways listed below:

PHP Selector in cPanel — Recommended

  1. Log in to cPanel.
  2. Click Select PHP Version.
  3. Click Switch To PHP Options
  4. Set log_errors to Off
  5. Click Save

.htaccess

  1. Edit .htaccess in your public_html folder
  2. Enter the following code:1php_flag log_errors off
  3. Save the file.

php.ini

  1. Create a new file named php.ini in your public_html folder.
  2. Enter the following code:1log_errors = off
  3. Save the file.

Verify your changes

Create a phpinfo php page to check your settings are active.

Delete existing PHP error_log files

  1. View your webspace using FTP or cPanel File Manager
  2. Select your error_log file
  3. Delete

How to convert MBps to IOPS or calculate IOPS from MB/s

Most SSDs have two speed ratings for reading as well as for writing.  The first rating is the sustained MB/s performance, which is the main marketing most manufacturers use.  The second rating is the 4K Random IOPS performance, which gives a much better idea of how the drive will perform in the real world.  The sustained MB/s rating is the sequential transfer rate the SSD will maintain continuously, such as over a period of 30 seconds.  The 4K Random IOPS on the other hand is how many 4K (4096 byte) operations the drive will handle per second with each block being read or written to a random position.

Usually when a Random 4K IOPS figure is given, it may state that this is at a certain queue depth, such as 4, 16, 32 or 64.  With a queue depth of 4, this means that there are 4 separate threads taking place with the drive, each thread independently running its own transfers.  With the use of Native Command Queuing (NCQ), the SSD can handle these threads simultaneously to improve the overall throughput compared to running a single thread.  While many hard disks use native command queuing to line up read/write operations to minimise seek times between each read/write operation, SSDs can read from and write to multiple NAND cells simultaneously, where as the read/write head in a hard disk can only be in one physical place at any time.
While it is nice to see how many IOPS a drive is capable of, it is also useful to see how this translates into actual throughput or even vice versa.  For example, most benchmark tools such as CrystalDiskMark and AS SSD report the random 4K performance in throughput, i.e. MB/s, while the SSD’s specifications usually rates the 4K performance in IOPS.To see how to translate MBps into IOPS and vice versa, we need to do a little math:

IOPS = (MBps Throughput / KB per IO) * 1024
Or
MBps = (IOPS * KB per IO) / 1024

So let’s say we have an SSD claiming a Random 4K write speed of 20,000 IOPS and it achieves 76.2MB/s in the CrystalDiskMark with the QD32 write test.

To convert the 76.2MB/s to IOPS, we perform the following calculation:

IOPS = (76.2 / 4) * 1024
IOPS = 19.1 * 1024
IOPS = 19,558.4

To see what throughput we need to achieve to match the actual 20,000 IOPS claim, we can perform this calculation in reverse:

MBps = (20,000 * 4) / 1024
MBps = 80,000 / 1024
MBps = 78.125MB/s

Note that each manufacturer uses its own method of coming up with their SSD IOPS ratings.  Besides separate IOPS ratings for read and write speeds, a given SSD can behave quite different depending on the type of data being read or written, as well as the duration this transfer takes place.  For example, an SSD that achieves 5,000 Random 4K IOPS sustained write over a period of 30 seconds may only achieve 1,000 IOPS sustained write over a period of 5 minutes.  For SSDs using the SandForce processor, the compressibility of the data also has an impact, so two benchmark tools may show completely different IOPS readings if one tool sends uncompressible data and the other tool sends highly compressible data and also if one runs the benchmark for longer duration than the other.

🙂

Happy calculating.