Close

Install pure-ftpd on CentOS

1. rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY* 2. rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt 3. cd /tmp 4. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 5. rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 6. rpm –import https://fedoraproject.org/static/0608B895.txt 7. wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 8. rpm -ivh epel-release-6-8.noarch.rpm 9. yum update 10. yum install pure-ftpd 11. cd /etc/pure-ftpd/ 12. vi pure-ftpd.conf UnixAuthentication yes VerboseLog yes PureDB /etc/pure-ftpd/pureftpd.pdb CreateHomeDie yes 13. pure-pw useradd mywebsite -u…

Install VSFTPD and setup user

Install VSFTPD and setup user 1. Type this [code leg=”php”]# cd /tmp[/code] 2. Install VSFTPD [code leg=”php”]#  yum install vsftp[/code] 3. Open vsftpd configuration file – /etc/vsftpd/vsftpd.conf [code leg=”php”]# vi /etc/vsftpd/vsftpd.conf[/code] 4. Make sure following line exists (and uncommented) [code leg=”php”]chroot_local_user=YES[/code] 5. Add user to FTP [code leg=”php”]# adduser -c ‘FTP USER Tom’ -m tom…

MySQL combine two columns and add into new column

MySQL combine two columns and add into new column [code language=”sql”] UPDATE tablename SET combined = CONCAT(zipcode, ‘ – ‘, city, ‘, ‘, state) [/code] Output: zipcode – city, state MySQL combine two columns and add into new column where year is a number [code language=”sql”] UPDATE `tablename` SET cat_path = CONCAT(year, ‘/’, name) WHERE…

PHP: Recursive Directory Navigation

[code language=”php”] function readpath($dir,$level,$last,&$dirs,&$files){ //print $dir." (DIR)\n"; $dp=opendir($dir); while (false!=($file=readdir($dp)) && $level == $last){ if ($file!="." && $file!="..") { if (is_dir($dir."/".$file)) { readpath($dir."/".$file,$level+1,$last,$dirs,$files); // uses recursion $dirs[] = "$dir/$file"; // reads the dir into an array } else{ $files[] = "$dir/$file"; // reads the file into an array } } } } /* From PHP.NET…

PHP: Check broken links using curl

[code language=”php”] function check_url($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $headers = curl_getinfo($ch); curl_close($ch); return $headers[‘http_code’]; } $mainurl = "http://www.google.com"; $myurl = "http://www.google.com/gggg"; $mainsite = check_url($mainurl); $satus = check_url($myurl); if($mainsite == ‘200’){ if($satus == ‘200’){ echo "Its works"; }else{ echo "broken url"; } }else{ echo…