Linux Tips
Adding the following to a command being executed, especially through your php exec or system function will return standard error output to the browser so it is easier to figure out why php may not be able to execute the command when the php script is being accessed via HTTP (Apache)
Add this : 2>&1
To the end of the command
Apache Control
apachectl -k graceful
This command is used to restart Apache in a "graceful" way by closing off httpd processes only after they have served requests. Thus, users won't be forcefully disconnected. Its nice and I use it.
Service start and stop
You can start or stop a linux service in the following format
service start
service stop
service restart
Show all network connections
ps -auxf
FFMPEG Command via php to convert FLV videos to JPEG video screen shots
You must have FFMPEG installed on your linux box.
You must put the videos in the directory your run the script below in.
You must have a subdirectory /videoshots as well.
$dir would be the directory the videos are in
$files[$i] would be the list of video files in an array where $i would start at 0 I suppose.
$cmd = "/usr/local/bin/ffmpeg -i " . $dir . $files[$i] . " -r 1 -t 00:00:30 -f mjpeg -s 200x150 -qscale 20 ";
$cmd = $cmd . $dir . "videoshots/" . $filepath[0] . '-1.jpg 2>&1';
system($cmd);
Installing on linux got a lot easier with YUM
So you installed linux but didn't install Window system like Gnome or KDE to run rpm package installers etc. NO PROBEM!
Try this out in your console
yum install
would be the rpm package in your linux rpm source cd.
For example, want to have apache up and running?
Type
yum install httpd
Hit Enter
It will automatically connect to the internet, download the package and any dependencies required for apache to work on your machine.
Just type y to agree to install
and BAM, its installed





