sábado, 28 de julio de 2012

Remove spaces from several filenames

I need to make a backup in a linux server of several files created by MS Windows system. This files has spaces in the filename.  As a linux doesn't like spaces in the filenames I decided to change those filenames to another that has a underscore replacing the spaces.

Here we go:

We go to the directory were have the files to change and execute this comand:

for a in * ; do b=`echo $a |sed 's/ /_/g'` ; echo "$a" " ---> ""$b" ; mv -f "$a" "$b" ;done

The command doesn't change the files that hasn't spaces, it gives as
mv: 'fileswithoutspace' and 'fileswithoutspace' are the same file

So don't worry about that.





viernes, 27 de julio de 2012

Remove PHP version 5.1.6 and install PHP 5.3.3

I have a problem in a wordpress installation that I found in a server of a client.
Somebody install a apache server.

httpd -v
Server version: Apache/2.2.3


It was a standard installation from yum.

WordPress 3.3.1 was installed too.

The problem was a diferent PHP version and I got this error

Your server is running PHP version 5.1.6 but WordPress 3.3.1 requires at least 5.2.4.

The server was unnused due to this incident never works fine so I don't waste time trying to update the php version.

Stop apache:
/etc/init.d/httpd stop

Remove al the php packages
yum remove php*

Install new version of PHP
yum install php53 php53-cli php53-common php53-gd php53-imap php53-intl php53-mbstring php53-mysql php53-odbc php53-pdo php53-pspell php53-snmp php53-xml php53-xmlrpc

Start apache:
/etc/init.d/httpd start

Working fine!!