Ever site have content for cache or pregenerate.
Why cache need to be part of optimization? - if you know what you do and how it is very fast way to lower server load. So, after load is lowered you will have time to think about logical optimization ;)
What we can cache?
Time to time I need to transfer site from server to server very quickly and have not common solution for this, because I have permissios.
Solution is to use http server if you have this one of server with backups or use netcat.
On server side I run
nc -l -p 8080 < mybackup.tar.gz
netcat -l -p 8080 < mybackup.tar.gz
and now can use wget, curl or browser for this url:
http://serveradress:8080
if you sent link to client it will best to do little more:
most of PHP application use session module. Commonly to provide user authentication and most of hoster providers store session files in /tmp directory. Session files from all users/sites at one dir, it is big security risk!
Looks like /tmp is shared between users and used to store authentication information, really bad idea.
Session module allow to change default path for session files (configurable is strong PHP side), so it simple for webmasters and PHP coders to solve this problem, just need to change session path like this:
session_save_path('/home/your_own_dir/tmp');
ini_set('session.save_path', '/home/your_own_dir/tmp');
Some Joomla and Mamaba solutions is so big. I have not problem with size - I just add new disks to my server.
I use control version software for all my projects (SVN or CVS) and it is very easy to share my work with another coders or track what I did here before year(yes, I provide support for all my projects).
So, common problem which I take latest weeks is that I have big applications and just export:
cvs export -r release_X_Y project
cvs diff -N -c -r release_X_Y -r release_X_Y > diffsmany clients ask me why I suggest to use PDO as part of optimization
it is very simple
PDO structures is native PHP drivers, which mean that was designed and optimized for PHP
Just image, libmysql use buffers and PHP interface use buffers. This mean that functionality is doubled! It is absolutely normal step to remove libmysql as layer. As part of server optimization this step require MySQL 4.1 as minimal version.
At the end, migration from libmysql usage to PDO save up to 40% server resources!
A long time ago, when I start to use my first FreeBSD workstation I used ee as simple editor (it is simple and very useful), after ee I use vi it take a lot more time to understand "how" and "why" it works, but... I don't stop it use.
Only one thing stop me to use vi as default environment for PHP based projects - miss XDebug support.
So, at moment at all my servers I use vi as default editor, sometime I have not root privileges and use next lines in .bash_profile
EDITOR=vi
export EDITOR
alias editor=$EDITORdo you have several servers?
do you transfer data between them?
time to time I transfer data between servers and in most cases I use
scp user@host:/path/remove-file
for this task netcat is useful too, so it can be like this
server side
cat local-file | nc host 12121
of course 12121 need to be replaced with something random because "nc" don't provide authentication and encryption
Often I develop and control process using ssh(putty) session. Connection with server allow me monitor and do related sub-task like svn/cvs updates.
I don't like when my session give timeout message - server require activity. I use "top" on my local server, but some third party environment don't allow me this (have not access to top!), so I just thinking about this situation after couple minutes of googling discover 'watch' command.
It is so easy:
watch ls
and you session keep alive