Fatal error: Cannot redeclare wpb_getImageBySize() (previously declared in plugins/js_composer/include/helpers/helpers.php

WPBakery Install Receives the Error: fatal error: Cannot redeclare wpb_getImageBySize() 

Fatal error: Cannot redeclare wpb_getImageBySize() (previously declared in /srv/www/vhosts/www.busybooks.com/wp-content/themes/busybooks/wpbakery/js_composer/composer/lib/helpers.php:15) in /srv/www/vhosts/www.website.com/wp-content/plugins/js_composer/include/helpers/helpers.phpon line 111

When installing the WPBakery plugin you receive the above error after trying to activate the plugin. 

The Fix

The issue is easily fixed by installing one of the default themes from WordPress. Activating it. Then returning to the plugins and activating the WPBakery Visual Composer.

Mars Edit can’t upload images to WordPress on IIS

MarsEditIcon 

Having Troubles Uploading images to WordPress hosted on IIS

If you are like me and enjoy a Mac, and WordPress, then you have probably discovered MarsEdit. We were experiencing problems uploading images to our WordPress blog.

Upload File Error
Can’t do upload file for “blog name” because the server reported an error. The server returned an unexpected response code: 413.

WordPress Upload File Permissions on IIS

You upload an image in WordPress and either you get an error or the image will upload, thumbnails would work but the actual image would not have read permissions.

If you can’t upload an image at all, it’s probably because you need to give the IUSR account Read/Write/Modify permission on your wp-content folder.  This will allow you to upload, and do the WordPress & plugin updates.

IIS WordPress File Upload Permissions

Alos, you may you need to do is give the IIS_IUSRS group Read permissions on your “C:\Windows\Temp” folder.

Make sure to notice that the two permission changes you make are not for the same user/group.   Give IUSR permissions on your wp-content folder and IIS_IUSRS permissions on your Windows temp folder.

Note: If you have edited your php.ini file and change the upload temp directory then you will need to give IIS_IUSRS group read permissions on that folder instead.

IISWordPressIIS_USERS

That should be about all that is required to fix the issue in IIS.

XML Sitemap Generator for WordPress There was a problem writing your sitemap file IIS Fix

If you are hosted on IIS for your wordpress site, you will notice that when you go to your XMP Sitemap Generator for WordPress, you notice a problem reported:

There was a problem writing your sitemap file. Make sure the file exists and is writable.

There was a problem writing your zipped sitemap file. Make sure the file exists and is writable.

In Red.

This is telling you that the auto update process for the XML Sitemap Generator for WordPress plugin has failed to create the files needed. If you click on the Rebuild the sitemap link it will manually rebuild.

The Fix

Easy one. On IIS servers, all paths for files require a \ (backslash) where the auto detected path will put a / (forward slash) after the end of the true path and before the sitemap.xml file.

image

Just update it in the Custom Location to the correct \ and save the changes. This will address the problem.

image

Setting Up WordPress on Amazon EC2

Last evening I signed up for Amazon Web Services (AWS) free usage tier to test the features and available services. Another reason was to use Amazon Simple Storage Service (Amazon S3) for storing my site’s backups.

The services are available at fairly reasonable price. Especially, if you are using S3 then you are making a very good deal.

Since, the free usage tier comes with 750 free hours of Amazon EC2 for each month for a year I thought of giving it a try and running WordPress.

Here is a step-by-step guide to setting up and running WordPress on Amazon EC2.

Sign up / Log in to your AWS Account:

If you do not have an AWS account then you can signup for the free usage tier and login to your account.

Setting up our server:

After you have logged in to AWS account, click “My Account / Console”  in top right corner of the screen and then click on “AWS Management Console”. You will be presented with something like this :

Click on “EC2″ link and you will be taken to the EC2 Dashboard. Click on “Launch Instance” button to create a new instance. Follow the “Classic Wizard” as shown below :

classic-wizard

Click “Continue” and on the next screen select “Ubuntu Server 12.04.1 LTS”

Quick-StartOn the next screen, you can proceed with the default settings. Make sure that “Instance Type” is set to “Micro” because that comes free with AWS Free Usage Tier. Click “Continue”

Instance-DetailsClick “Continue” on the next screen :

Instance-Details-1Again, click continue on the next screen.

After that you can add a “Name” for your instance for better organization. I have named it as “WordPress”.

Add-TagNow, you need to create a “Key Pair” so that you can connect easily with your server via SSH. Give an easy to remember name to your key pair and download the file. Keep the file in a place that you can remember. As you will need this file to connect with your server.

key-pairNext step is to configure the Firewall and make sure that only required ports are open for our server. Create a new security group. I have named it as “WP”. Now, click the dropdown for “Create a new rule” select SSH and click “Add Rule”. Repeat it for HTTP.

security-group

And we are done, setting up our instance. Click “Launch”.

launch-server

Go to “Instances” page and you will see your new server being initialized and in some time it will be up and running. But, it’s not yet ready to run a WordPress site.

We need to setup the essential services to run WP : Apache, PHP and MySQL.

Connect via Terminal

Select the instance which we created above and click “Instance Actions”, in the pop-up menu click on “Connect”

connect-terminal

Here you will need to enter the path of key file that you saved to your computer while creating the instance. Once that’s done you can click “Launch SSH Client”. If you wish you can also store key location in browser cache so that you won’t need to re-enter it every time you connect.

launch-ssh-client

Setting up Apache :

Now, we are connected to our server. Next step is to setup Apache. By default, you will be logged in as user : ubuntu. Let’s switch the user to “root” so that we can get complete access. Use the following command to do so:

sudo su

view rawSwitch to Root userThis Gist brought to you by GitHub.

Use the following command in terminal to install Apache on your server:

sudo apt-get update

sudo apt-get upgrade

apt-get install apache2

view rawInstall ApacheThis Gist brought to you by GitHub.

After the installation is complete, look for Public DNS of your instance as shown below:

public-dns

Copy this Public DNS and paste it in browser’s address bar. You will see a test page for Apache like below :

apache-test-page

Installing PHP5

Our Apache is working and now we will install PHP5. For installing PHP5 use following commands in your terminal:

12345

apt-get install php5

 

apt-get install libapache2-mod-php5

 

/etc/init.d/apache2 restart

view rawInstall PHP5This Gist brought to you by GitHub.

Note: If your PHP installation fails with a message such as “Unable to fetch some archives…” then run the following command and repeat the above process:

apt-get update

Now, your web files placed in /var/www/ can be accessed in the browser via Public DNS.

Let’s create a test PHP file to make sure that we have PHP running properly. Use the following command to do so :

123

cd /var/www/

 

vi mytest.php

view rawPHP InfoThis Gist brought to you by GitHub.

This will create a new PHP file and open editor. Follow the following steps to add content to file :

  1. Press i to switch to insert mode.
  2. Type <?php phpinfo() ?>
  3. Hit escape key
  4. Type :wq to write the contents to file and quit the editor.

php-info

After creating the file run the file in your browser using the address as your-public-dns/mytest.php and it will show a page like below :

php-test

Now that PHP is running perfectly on our Apache. We need MySQL for creating database.

Install MySQL

Process for installing MySQL is similar to the process we followed for installing PHP. Use the following command in terminal to install MySQL :

1

apt-get install mysql-server

view rawInstall MySQL serverThis Gist brought to you by GitHub.

During installation process you will be asked to create a password for “root” user. Keep this password safe in your memory or computer because this will be required to access the database later on.

mysql-password

Since we need to run PHP5 with MySQL, we will also install PHP module for MySQL using the following command

123

apt-get install php5-mysql

 

apt-get install libapache2-mod-auth-mysql

view rawPHP5 MySQLThis Gist brought to you by GitHub.

After this we can create database and continue with setting up WordPress. But, it will be nice to setup phpMyAdmin visual interface. So, let’s go ahead with it.

Installing phpMyAdmin

Use the following command to install phpMyAdmin and make sure you configure it for “Apache2″ web server :

1

apt-get install phpmyadmin

view rawphpMyAdminThis Gist brought to you by GitHub.

php-myadmin-setup

Follow the instructions on screen and remember the password that you enter in each field. After the installation of phpMyAdmin is complete we need to configure our Apache to make phpMyAdmin accessible via browser.

Use the following command for configuring Apache:

123

ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf

 

/etc/init.d/apache2 reload

view rawConfigure ApacheThis Gist brought to you by GitHub.

We restart the apache web server so that it picks up our changes.

That’s all done. Now, you can access phpMyAdmin in browser via your-public-dns/phpmyadmin

Enter username : root and the password which you created while installing MySQL.

php-myadmin

Login to the admin and create a new database that we will use later for installing WordPress.

Now, we have all essential elements on our virtual server for running WordPress and everything is working perfectly. So, let’s install WordPress.

Downloading WordPresss

First  we will navigate to the home directory of our server and then download the latest copy of WordPress and extract it to /var/www directory by using the following command :

123

cd

wget http://wordpress.org/latest.tar.gz

tar -xzvf latest.tar.gz -C /var/www

view rawDownload WPThis Gist brought to you by GitHub.

By default, all the files will be extracted in a directory “wordpress” so your files are at /var/www/wordpress/ to move the files to root of web server and then remove the “wordpress” directory we will use:

123

cp -avr /var/www/wordpress/* /var/www

 

rm -rf /var/www/wordpress

view rawmove WP to rootThis Gist brought to you by GitHub.

Before we install WordPress we need to map our domain name with the virtual server so that the site is accessible easily.

Mapping Domain Name :

Now we have everything ready in place and all we need to do is map our domain with our virtual server. For this you will have to associate an IP with the instance and map the domain name to that IP.

Head back to EC2 console and click “Elastic IPs” in the left pane. Click “Allocate New Address”

allocate-elastic-ip

Now, you will see a new IP address in the console. Click “Associate Address” to associate this IP with your instance.

associate-ip

Now, switch to back to “Instances” panel and you can check the attachment status.

elastic-ip

You will need to connect to your server by IP address now. Your hostname (public DNS) will no longer work, and if you detach the IP, your instance will be assigned a different hostname (public DNS). So, it’s best to not to change IP or detach it.

You can map your domain name to this elastic IP and it will work perfectly.

For now, I am using IP to access and setup the site. I entered elastic IP in address bar followed by /index.php and it came up with WordPress installation page.

create-wp-config

That’s all! Now, you can use follow the steps of WordPress installation, enter required details and setup the site.

Oh but wait! I came up with this :

cant-create-wp-config

This is because our current apache user doesn’t have rights to write to the file. To fix this error we will grant access rights to our current apache user. First connect to the server via terminal as we did in the beginning and then execute following commands :

12

sudo chown -R www-data /var/www

sudo chmod -R 755 www-data /var/www

view rawFile permissionsThis Gist brought to you by GitHub.

Here, www-datais the default apache user.

There is another issue left to be fixed. That is use of htaccess file and Pretty Permalinks in WordPrses. We will enable use of htaccess file and then enable the rewrite engine for Pretty Permalinks.

Enable htaccess and URL Rewrite

To make .htaccess files work as expected, you need to edit default apache file :

1

sudo vim /etc/apache2/sites-available/default

view rawEdit Apache default fileThis Gist brought to you by GitHub.

Look for :

123456

<Directory /var/www/>

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

allow from all

</Directory>

view rawApache DefaultThis Gist brought to you by GitHub.

Press i to enable insert mode and replace AllowOverride None to AllowOverride All. Now hit escape key and type :wq to write the changes to file and exit the editor.

htaccess-file

Restart the apache web server for changes to take effect.

1

sudo /etc/init.d/apache2 restart

view rawRestart ApacheThis Gist brought to you by GitHub.

Continue with WP installation

Finally! You are all set to run WordPress site on Amazon EC2. Proceed with the installation process and it will work.

Like I have it here:

Amazon-EC2-WordPress-Site

Here comes the end to my tutorial. I am not a server administrator or a linux expert. This was a result of my hit-and-trial experiments. So, if you have any suggestions for improvement then please feel free to share your comments.

Now Auto Tweet Plugin to our WordPress Blog tli.tl Auto Twitter Poster

wordpress-plugin.jpg

We have been using the Feed2Tweet plugin on our WordPress blog site at: http://www.interactivewebs.com/blog

We found that in recent weeks, it has stopped posting data when we blogged with the Windows Live Writer plugin that we normally use. So we decided to find a new plugin to take care of the auto tweeting.

We came across the “tli.tl Auto Twitter Poster” plugin. That from all accounts should work well, if only a little delayed.

The post system configures with a Twitter API registration (normal for this sort of thing), and appears to work well.

Note

There are two versions on the plugin, one is listing as version 3.8 (we found that did not work) the other is the 3.8.1 showing as separate plugin. We found this tested fine.

Your WordPress.com account, is not authorized to view the stats of this blog

imageIf you have been getting this error lately on your WordPress.org blog then don’t worry because you are not alone. This error has been a result of a new plugin introduced but the Makers of the WordPress.com Stats called Jetpack. It is very simple to solve this problem, just Follow the Step below

  1. Got to Plugins> (Click) Add New
  2. Search for the plugin called “Jetpack”
  3. Install  and activate this Plugin
  4. Now either you can got to the plugins menu and under Jetpack click on settings or under the Dashboard DropDown Click on Jetpack
  5. Connect your WordPress.com Account and Authorize it
  6. Now Don’t Click on the activate Button in the Jetpack Settings as it will give the the Following error “Module could not be activated because it triggered a fatal error. Perhaps there is a conflict with another plugin you have installed?” instead go back to your plugins menu and press Activate under “wordpress.com Stats” (as it Jetpack Automatically Deactivates this plugin)
  7. Go back to your dashboard and your stats will there as normal.

Notes


  • If you have had unisntalled and deleted the wordpress.com stats then install it before installing Jetpack and start from Step 1.
  • If you have Deleted wordpress.com Stats and Installed and Activated the the Jetpack then Deactivate and delete Jetpack then install and Activate WordPress.com stats and then Start From Step 1

If you have any Questions you can ask in the Comments Section Below. and I will be more than happy to help.