giovedì 19 settembre 2013

How to upload WordPress Blog to New Domain or Location from localhost or Old Domain

For blogger who self-hosts the WordPress blog publishing system on a web hosting server with own registered domain name, sometimes, you may decide to reorganize the blog link URL to make it tidier or to reflect new focus or theme of the blog. If you decide to change the URL or link location of your WordPress blog due to changing of domain name (such as from to or the blog to another directory location (such as from to, there are some steps that should be done to ensure the proper migration and no breaking links.

The tricky part when moving WordPress blog to another location is that WordPress is using absolute path in URL link instead of relative path in URL link location when stores some parameters in database. Within blog posts’ contents itself, users may also use the old URLs when creating reference backlinks. All these values in the database will need to be changed when WordPress is moved. The following guide will show you which database fields that has references or values related to blog’s URLs that you want to modify. Note that this guide is not about how to move WordPress blog from one server or host to another new hosting service.

Once the blog has been moved (all files copy over in case of moving location or server or new domain name properly propagated across Internet for new domain name), the first thing to change is to tell WordPress the new blog location (wp-config.php should be no changes, and .htaccess file should be also no changes. If for some reason mod_rewrite rules for friendly URLs no longer works, you can always regenerate the .htaccess file via WP Administration’s Update Permalinks page).
This value can be changed via WordPress Options page, but if you no longer able to access to old blog URL, you have to modify the value via MySQL database.
Note: The guide uses SQL statements based on MySQL replace() function to modify the database. To run SQL queries, login to MySQL database that houses WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.

To update WordPress options with the new blog location, use the following SQL command:

UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';

After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

UPDATE wp_posts SET guid = replace(guid, '','');

If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content, '', '');

Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.

Fixing WordPress’ Plugin FTL download permissions (WordPress 3.3.1 on CentOS Linux)

Hav­ing trou­ble with Word­Press’ auto update fea­ture? Con­fronting errors like "could not copy file…"  or is Word­Press ask­ing for FTP information?

Your prob­lem is most likely server per­mis­sions. If you have shell access to your own VPS/dedicated server, use the lines below. If you’re using a shared host­ing setup, try option #4 below, or con­tact your admin­is­tra­tor for help.

Option #1: chmod 777

Sure, you could CHMOD 777 your whole site. That would tech­ni­cally work, but it’s switch­ing per­mis­sions when­ever you need to update is incon­ve­nient. And, leav­ing per­mis­sions this way leaves you open to a whole host of secu­rity issues.
chmod -R 777  (Not Secure!)

Option #2: apache file permission

This gives apache full per­mis­sions. This works, but if you use FTP, users no longer have per­mis­sions to write files. No good! I want my FTP access intact.
chown -R apache:apache  (No FTP!)

Option #3: apache /w group permissions

I cre­ated a “word­press” group and added my FTP users to it and gave the wp-content direc­tory group write per­mis­sions. It’s a bit of a com­pro­mise, but it worked for me.
groupadd wordpress
useradd -G wordpress 
chmod -R 775 /wp-content/
chown -R apache:wordpress 

Option #4: wp-config constants

Another option for those who are unable to change file per­mis­sions, and/or have a rel­a­tively new ver­sion of Word­Press, is to bypass enter­ing FTP infor­ma­tion by defin­ing your FTP info in your wp-config.php file. More infor­ma­tion can be found in the Word­Press codex.
define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/path/to/wordpress/');
define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
define('FTP_USER', 'username'); 
define('FTP_PASS', 'password');
define('FTP_HOST', '');

mercoledì 11 settembre 2013

Install Apache2 With PHP5 And MySQL Support On CentOS 6.2 (LAMP)

1 Preliminary Note

In this tutorial I use the hostname with the IP address These settings might differ for you, so you have to replace them where appropriate.

2 Installing MySQL 5

To install MySQL, we do this:

yum install mysql mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Set passwords for the MySQL root account:

[root@server1 ~]# mysql_secure_installation


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
 <-- nbsp="" span="">
New password: <-- nbsp="" span="" yourrootsqlpassword="">
Re-enter new password: <-- nbsp="" span="" yourrootsqlpassword="">
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 <-- nbsp="" span="">
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 <-- nbsp="" span="">
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 <-- nbsp="" span="">
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 <-- nbsp="" span="">
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

[root@server1 ~]#

3 Installing Apache2

Apache2 is available as a CentOS package, therefore we can install it like this:

yum install httpd

Now configure your system to start Apache at boot time...

chkconfig --levels 235 httpd on

... and start Apache:

/etc/init.d/httpd start

Now direct your browser to, and you should see the Apache2 placeholder page:

Apache's default document root is /var/www/html on CentOS, and the configuration file is /etc/httpd/conf/httpd.conf. Additional configurations are stored in the /etc/httpd/conf.d/ directory.

4 Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

yum install php

We must restart Apache afterwards:

/etc/init.d/httpd restart

5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www/html. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/html/info.php

Now we call that file in a browser (e.g.

As you see, PHP5 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.

6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

yum search php

Pick the ones you need and install them like this:

yum install php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc

Now restart Apache2:

/etc/init.d/httpd restart

Now reload in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases.
First we enable the RPMforge repository on our CentOS system as phpMyAdmin is not available in the official CentOS 6.2 repositories:

Import the RPMforge GPG key:

rpm --import

On x86_64 systems: 

yum install

On i386 systems:

yum install

phpMyAdmin can now be installed as follows:

yum install phpmyadmin

Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the stanza):

vi /etc/httpd/conf.d/phpmyadmin.conf

#  Web application to manage MySQL

#  Order Deny,Allow
#  Deny from all
#  Allow from

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Next we change the authentication in phpMyAdmin from cookie to http:
vi /usr/share/phpmyadmin/

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

Restart Apache:

/etc/init.d/httpd restart 

Afterwards, you can access phpMyAdmin under

martedì 3 settembre 2013

Install SugarCRM on Ubuntu

Installed required packages

• LAMP (Apache, MySQL and PHP)
• libapache2-mod-php5
• libapache2-mod-perl2
• php5-cli
• php5-common
• php5-curl
• php5-dev
• php5-gd
• php5-imap
• php5-ldap
• unzip
• php5-mhash
• php5-mysql
• php5-odbc
• curl
• libwww-perl
• imagemagick

Install all the required packages using the following commands

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install libapache2-mod-php5 libapache2-mod-perl2
sudo apt-get install php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-imap php5-ldap unzip
sudo apt-get install php5-mhash php5-mysql php5-odbc curl libwww-perl imagemagick

Creating Database for SugarCRM

mysql -u root –p

Then type your MySQL password and run this command

mysql> create database sugarcrm;
mysql> exit

Installed SugarCRM

Now you need to go to your webserver document root directory (default location is /var/www) or your choice…
cd /var/www

Download SugarCRM

Now unzip file for using this command

Changed the folder name
sudo mv sugarcrm

Changed the ownership of this folder
sudo chown –Rf apacheuser:apachegroup and folder name like….
sudo chown –Rf www-data:www-data sugarcrm

Give Write permitions for apache on some of SugarCRM Files

cd /var/www/sugarcrm
sudo chmod 766 config.php
sudo chmod 766 custom
sudo chmod -R 766 data
sudo chmod -R 766 cache
sudo chmod -R 766 modules

Need for some changing to edit the php.ini file using the following command
Location of php.ini file

sudo nano /etc/php5/apache2/php.ini

;memory_limit = 16M
memory_limit = 50M

;upload_max_filesize = 2M
upload_max_filesize = 10M

Restart web server using the following command
sudo /etc/init.d/apache2 restart

Configure sugarCRM

Now open your webbrowser and enter the following address

http://domain-name or server-ip/sugarcrm/install.php

Please let me know in case any problem regarding this setup…..