Update Drupal Modules using FTP in localhost

When you’re going to update Drupal 7 modules using FTP, you need to have a FTP server running in your computer. In Ubuntu/Linux, we can have one named vsftpd (Very secured FTP Daemon) by running following command in the terminal:

Configuration:

Drupal: 7.0+

OS: Ubuntu/Linux

Step 1: Install VSFTPD

sudo apt-get install vsftpd

Step 2: Have an FTP account

Next, we need to add your Ubuntu user account to the FTP group. You can do it either by:

Open Users & Groups > Manage Groups. Double-click on FTP. Put tick-mark on your user-account, and click OK.

In the screenshot above, I’ve added my user account “giga” to the FTP group. So, I can use my username “giga” and my account’s password to run FTP.

3. Configure VSFTPD

Run in terminal:

gksudo gedit /etc/vsftpd.conf

Make sure you have following lines in the configuration file. Also check that they’re not preceeded by a “#”:

listen=YES
local_enable=YES
write_enable=YES
local_umask=022

Save and close the editor. Now we restart vsftpd by the following command:

sudo /etc/init.d/vsftpd restart

Step 4: Own your Drupal site

Run following command to own all of your Drupal scripts.

chown -R your-username /path-to-drupal

Finally…

Yes, we’re done. ūüôā Use your username (“giga” in this example) and system password to connect to FTP while upgrading modules.

 

 

Advertisements

Running many sites on single Drupal installation

Yup, you may call it “multisite installation”. That means, you may run more than one site with only a single Drupal core.

Configurations:

Drupal 7.0+

Linux Machine

Step 1: Create a new virtual host

To run multiple sites, we need to create Virtual Hosts in our machine. For example, If I type http://mydrupal I’ll be taken to my drupal site. For that, first we need to change ‘/etc/hosts’ file. Run following command in terminal and provide root password when promted:

gksudo gedit /etc/hosts

Next, add following line to the file and save the file:

127.0.0.4    mydrupal

Step 2: Restart networking interface

Type in terminal:

sudo /etc/init.d/networking restart

Step 3: Configure Apache2

For the easiest way, go the directory /etc/apache2/sites-enabled. Here, you will see a file named something like 000-default (or whatever), open it for editing. Place following code for opening it for editing:

gksudo gedit /etc/apache2/sites-enabled/000-default

Now, you need to create a <VirtualHost> directive:

<VirtualHost 127.0.0.4:80>
    ServerAdmin [your@email.com]

    DocumentRoot /path-to-your-drupal/

    ServerName mydrupal

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /path-to-your-drupal/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

    RewriteEngine On
    RewriteOptions inherit

</VirtualHost>

Note that <VirtualHost 127.0.0.4:80> should contain the IP address you provided in step 1, we chose “127.0.0.4” since it will be pointing to your own machine. Also, note the line ServerName mydrupal – here “mydrupal” is the name we chose in step 1.

Step 4: Restart Apache2

Type in terminal:

sudo /etc/init.d/apache2 restart

Yup, that’s all!

Finally…

Type http://mydrupal in your browser, you will see the new drupal site running! Now you can create all the necessary files (database settings, modules, themes etc.) under sites folder of your Drupal path. Copy the path-to-drupal/sites/default folder and rename it to path-to-drupal/sites/mydrupal.

Next, you can (should):

  • Edit “path-to-drupal/sites/mydrupal/settings.php” – for database settings. Change database username, password, database name etc.
  • Create a new database if necessary, using PHPMyAdmin, or whatever.

Qt Error: undefined reference to `vtable for

I was receiving this error once, when I was trying to add signals & slots to one of my classes. I figured out that Qt was having problems with moc files, and there were no moc files being generated.

To solve the problem, I specified “moc directory” in the project’s .pro file:

OBJECTS_DIR = debug/obj
MOC_DIR = debug/moc

And my problem was solved ūüėÄ

Using a View to diplay a single node/content in Drupal 7

Using the View module you can display nodes of any content-types.¬† Usually, in a “Page” type view you can display many contents/nodes, with pagination support. But what to display only a specific node? perhaps, using an url like http://yoursite.com/viewname/10 where 10 is the Node-ID (nid)

You can achieve this using Contextual Filters. In this example, I’m assuming you want to display a single node of ‘Article’ content type.

1. First, create the View generally, simply in the way you’d create a view for displaying paged Articles. Next, like the image below, Click on Advanced > (Contextual Filters) add.

 

2. In the new window, type “nid” in Search text-field, select Nid as shown in the image below:

3. Look at the image below carefully, and apply all the changes marked.

4. Click on Apply. Contextual filter window will close.

5. Finally, on the main view page, click on Use Pager: Full under PAGER section (see image below).

6. On the new window, select “Display a specified number of items” and click Apply.

7. Type 1 in the “Items per page” text-field. Click Apply. The dialogue window will close.

That’s all. Hit Save on the main page.