Normal Approach
First setup you have to know where your php.ini file is.
-For this you have to know using phpinfo(); function to know where the php.ini path is.
Here is a screenshot for where the php.ini file path you get.
Find below variable and change it
In the codeigniter config.php file change this.
In this create session folder with writable
This solution sometimes works or sometimes not.
Emergency approach to remove session file
-this command give you count of your current session
After fire below command for remove all session in projects
But please be aware if you remove the session folder so that time web site session is not working.
Follow step by step Command
This is useful when you have so many session files and because the
server is full at that time you can clear the session's folder size.
Crontab Approach
In this we can remove session file using name or all file
So in this we have create both
1)Remove all session file with cronjob
In this we have set -cmin +4320 this means current time 4320 before file count
You can change as per your requirements.
ionice -c 2 nice -n 19 This is useful for checking server memory and priority
We have set server best effort and nice -n 19 last priority
This command description
The command you provided is a combination of several commands in a Unix-like operating system. Let's break it down:
The command you provided is a combination of several commands in a Unix-like operating system. Let's break it down:
sudo: This command is used to execute subsequent commands with superuser
privileges.
ionice -c 2: This sets the I/O scheduling class for the command. In this case, it sets
the I/O class to 2, which corresponds to the "idle" class. This means that the command
will have low I/O priority.
nice -n 19: This sets the process priority for the command. A lower priority value
(more negative) means higher priority, but in this case, it sets the process priority to the
lowest possible value, 19. This means the command will have very low CPU priority.
find /var/lib/php/sessions -type f -cmin +4320: This is the find command that
searches for files (-type f) in the specified directory (/var/lib/php/sessions) that
were changed more than 4320 minutes ago (-cmin +4320).
|: This is a pipe symbol, which is used to pass the output of one command as the input
to another.
wc -l: This command is used to count the number of lines in the input it receives. In
this case, it counts the number of files found by the find command.
So, the entire command is searching for files in the specified directory that were
changed more than 4320 minutes ago, and then it counts the number of such files.
Keep in mind that running commands with elevated privileges (sudo) and modifying
system files or settings can have significant consequences. Make sure you understand
the commands and their implications before executing them.
2)Remove all session with timeout and without time out
sudo su
crontab -e
3) set cron using below
This command run on 5:05 am and remove session file before 72hour (4320/60 = 72)
Some time so many session file so at that time not remove session file 24 hour so
At time some time override our cron for that i have suggest you can set timeout
In cron so after that time cron is automatically closed.
So i have run cron for 20h duration please check below example
/usr/bin/timeout 20h - > you can set timeout in minutes , hours and seconds
For example you have to set for 5 minutes then you can set link this
/usr/bin/timeout 5m
3)Remove all session with timeout and without time out by name
sudo su
crontab -e
3) set cron using below
2) timeout
/usr/bin/timeout 20h - > you can set timeout in minutes , hours and seconds
No comments:
Post a Comment
Thank You For Comment