2012年3月22日 星期四

[SOLVED] Drupal: Move Site and results in 404 Error after login

Tried to move a development environment to another environment, by copying the files in the Drupal root directory , database, and then restored in another server.

Everything works well in the landing page. But returns an 404 page error when accessing the other pages. (such as login, go to the node content, etc..)

To resolve the problem, we have to the following things before exporting the db to the new site:
i. Clear the caches
ii. Disable the clean URLs feature

 



 

System works back to normal after doing the above steps.!

2012年3月20日 星期二

[How-to] Add Virtual Host using different port in apache

This article teaches you how to create multiple websites in an apache server by using different port.
In this example, we use port 80 and 90.

1. Update /etc/apache2/ports.conf
Add the following lines in the file
NameVirtualHost *:80
Listen 80  
NameVirtualHost *:90
Listen 90

2. Update /etc/apache2/sites-available/default
Copy and paste the <VirtualHost *:80> content and make changes as follow


<VirtualHost *:80>
   ...
</VirtualHost>
<VirtualHost *:90>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www_anothersite
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www
_anothersite/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>


3. Create the corresponding folder for the new website (port 90)
mkdir /var/www_anothersite

4. Done and test

2012年3月19日 星期一

2012年3月18日 星期日

[How-to] Install FileZilla in Ubuntu using command

This article teaches you how to install SFTP on Ubuntu.

1. Install Open SSH
Command: sudo apt-get install openssh-server openssh-client

2. Install FileZilla
Command: sudo apt-get install filezilla

After the installation, you can connect to your Ubuntu server via the sFTP.




2012年3月17日 星期六

[SOLVED] Failed to connect to MySQL at :3306 with user root

This article teaches you how to make a remote connection to MySQL server via the MySQL Workbench.

By the default installation, MySQL does not allow remote access to the server. When you tried to directly connect to the server, you will find the following error:

Failed to connect to MySQL at <mysql server ip address>:3306 with user root


Found and tried solutions on how to enables the MySQL connection, but the result is not good. System would returns an error of

ERROR 2002 (HY000) can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)


Solution
As the enablement of remote access may caused potential issue, I go back to MySQL workbench to find any hint for the solution.

At this moment, I found that the remote connection to MySQL server could be achieved by Connection Method "Standard TCP/IP over SSH".


After inputting the corresponding information and click "Test connection", successful result returns and can connect to the remote MySQL server.


[How-to] Uninstall MySQL server in Ubuntu

It can be achieved by the following command.




sudo apt-get remove --purge mysql-server

2012年3月15日 星期四

[How-to] Hide Text format selection in comment area


This article teaches you how to hide the Text format area selection on "Comment" field in Drupal 7.
It also applies to other Filtered HTML textarea in Drupal 7.

Solution:
Add the following style to the css file

.filter-wrapper {    display: none; }


2012年3月7日 星期三

Better Offer on GoDaddy, no need coupon


This is a small trick on GoDaddy.com.
The above special offer could be obtained by add the domain, but not to paid. 
After several rounds of back and fore, a special offer will be shown in the web site.

Known special offer:
i. Special Offer: New .com domain registration: 7.99 per year
By clicking domain registration but not to paid, cancel it, back and fore several times
- can be 1 year to 10 years domain registration
- 1 year is not recommended, better to click the ads with offers $5.99 for 1 year
Tackle the Web with up to 5 new .COMs, $5.99 for the 1st year!


ii.  Special Offer:  Free upgrade to Ultimate plan by Deluxe plan offer
Click web hosting Ultimate plan but not to paid, cancel it, back and fore several times

Reference:
GoDaddy.com


2012年3月2日 星期五

[SOLVED]: Fatal error: Allowed memory size of 33554432 bytes exhausted (Drupal 7 on XAMPP)

In XAMPP, the memory limit for php is set 32MB by default. It would cause a Fatal error in Drupal that runs on XAMPP for the development.

Example
Fatal error: Allowed memory size of 33554432 bytes exhausted
D:\xampp\htdocs\sites\all\modules\ctools\plugins\export_ui\ctools_export_ui.php


Solution
We can resolve the problem by increasing the memory limit in the php.ini file.

Step 1. Locate the php.ini file in XAMPP
e.g. D:\xampp\php\php.ini
 

Step 2. Search for the keyword: memory_limit and replace it in the following way


max_execution_time = 60     ; Maximum execution time of each script, in seconds
max_input_time = 60    ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M 256M     ; Maximum amount of memory a script may consume (16MB)




 Step 3. Restart the Apache via the Control Panel XAMPP


Step 4. Done and check by the phpinfo.php