Salina & IT Mind
Wednesday, May 23, 2012
CodeIgniter: How to check CodeIgniter version.
Open CodeIgniter root file:
# cd /data/form/system/core
# ee CodeIgniter.php
Check the version in this code:
define('CI_VERSION', '2.0')
Labels:
CodeIgniter,
version
Monday, May 14, 2012
Drupal: Clean URL Error after migrate to Ubuntu Server
Clean URLs with Apache 2 on Ubuntu
Step 1 - Method A: "Virtual Host" Setup
First, from the Linux command line, enable the rewrite module for apache with this command:
sudo a2enmod rewrite
You can check to see if this worked by running:
apache2ctl -M
and seeing if it is on the list.
Next, use an editor (such as
nano) to edit the appropriate Apache configuration file for your Drupal site in the /etc/apache2/sites-available/ directory. For a single site, the file is /etc/apache2/sites-available/default; if you have multiple sites, the file names should reflect the names of the sites to which they refer. Thus, to edit the default site configuration, usesudo nano /etc/apache2/sites-available/default
Look for the
Directory section referring to the folder where your Drupal site lives (in /etc/apache2/sites-available/default, this is typically ), and change the line:AllowOverride None to AllowOverride All
(This directive permits an .htaccess file, such as Drupal's, to be used to override Apache's default settings, and is necessary to allow the URL rewriting to work. Seehttps://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).
Save this file and then reload Apache as follows:
sudo /etc/init.d/apache2 reload
Subdomain Setup
Instead of creating multiple virtual host files, you can create one virtual host file that uses a wildcard in the ServerAlias. Both a simple multi-site Drupal setup and multiple Drupal versions can run this way, if the different subdomains are defined for each site in settings.php.Consider the following and modify your configuration file to fit your needs.Here is a partial listing of a virtual host configuration file that would support the last two lines in the above example. Note this is not intended to be a COMPLETE configuration file, but rather provide guidance for your development setup.
DocumentRoot "/www/Dr6"
ServerName example
ServerAlias *.dr6.example
AllowOverride All
Edit & save your config file to suit your development needs. Assuming the site is already enabled, then reload Apache.Step 1 - Method B: apache2.conf
In Apache version 2, httpd.conf has been deprecated and the new file is located at:
/etc/apache2/apache2.conf.
Thus, it's no longer necessary to do the following in httpd.conf to enable the rewrite module (mod_rewrite):
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
AddModule mod_rewrite.c
Simply run the following from the Linux command line:
sudo a2enmod rewrite
To disable the module you can run:
(**Note that this would cause clean URLs to break.)
sudo a2dismod rewrite(**Note that this would cause clean URLs to break.)
Once mod_rewrite is enabled, open apache2.conf in a text editor. Note that it will probably be read-only, so you will need sudo privileges to edit it. Use a command such as:
sudo nano /etc/apache2/apache2.conf
Find where the sections are in your apache2.conf and add another one for your Drupal site similar to this:
AllowOverride All
After you edit apache2.conf as listed above, you need to restart the server by:
sudo /etc/init.d/apache2 reload
Step 1 - Method C: Add Rewrite Rules Directly to Virtual Host or apache2.conf
If you do not wish to allow .htaccess overrides, you can add the rewrite rules directly to a virtual host file or apache2.conf. The following should work:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This can provide slightly faster server performance since Apache will not look in every directory for an .htaccess file.Note that, for proper security, you will need to add in the rules from the Drupal files directory's .htaccess file as well.More info >> http://drupal.org/node/134439
Labels:
apache setup,
Clean Urls,
drupal,
ubuntu,
vhost setup
Wednesday, May 9, 2012
FreeBSD: Enter full pathname of shell or RETURN for /bin/sh
I got this error after scp a big file yesterday.. I thought my server was crash.
But it actually run in single user shell.
Solution:
Enter full pathname of shell or RETURN for /bin/sh: > Enter
# Exit or ctrl-D to leave the single-user shell.
Then login like usual to your server.
**********Standard way of dealing with single user mode:
But it actually run in single user shell.
Solution:
Enter full pathname of shell or RETURN for /bin/sh: > Enter
# Exit or ctrl-D to leave the single-user shell.
Then login like usual to your server.
**********Standard way of dealing with single user mode:
Code:
fsck -y mount -u / mount -a -t ufs swapon -a
Linux/Ubuntu: How to extract .tgz file
.tgz and tar.gz files are pretty much the same. You extract them like this:
tar xvzf file.tar.gz
tar xvzf file.tgz
.
tar xvzf file.tar.gz
tar xvzf file.tgz
.
Linux/UBUNTU: Download Multiple Files(http) From Command Line
The following command is used to download a single file using wget:
wget URL
Replace URL with the exact url of the file to download.
wget http://cloud.addictivetips.com/wp-content/uploads/2009/12/InternetTesterUpdate.jpg
.
Labels:
download file in ubuntu,
fetch,
ubuntu,
wget
Tuesday, May 8, 2012
Mysql: My Own Notes( Backup & rename )
- Get db backup for www from daily backup server
- Copy the db to the nearest linux server (eg: 75)
- Bunzip the file:
#bunzip filename_xxx.bz2 - Use vi command to rename the db
#vi filename_xxx.sql - Esc > Shift + :
:%s/oldurl.my/newurl.org/g
** If the cursor already can move up and down then its done. - Esc > Shift + : > :wq > Enter
**Wait until the process finish - mkdir folder
- mv filename_xxx.sql folder/
- tar -cjf folder.tar.bz2 folder
- scp folder.tar.bz2 your@locationserver.my:
- Open related db server to restore the db.Copy the file from yourlocation server.
#scp your@locationserver.my:/home/you/ folder.tar.bz2 ./ - Untar the file first:
# tar -xjvf folder.tar.bz2 - Open folder and restore the db in server
# mysql -uroot -p --default-character-set=utf8 < filename_xxx.sql - Grant the privileges to the db
# GRANT ALL PRIVILEGES on db.* to 'username'@'applicationserverhost' IDENTIFIED BY 'password'
#FLUSH PRIVILEGES; - Check connection within the db and the application server.
#telnet applicationserverhost 3306; - From application server, test connection to db server
#mysql -uUSERNAME -p -h IP_databaseserver
eg: mysql -urepo_admin -p -h 172.XX.XXX.XX
** If error, connection refuse ask Network Admin to allow telnet both server in firewall setting. - Update the apps configuration file for the grant access. Check the application from browser.
- Done.
Mysql: Dump & Restore Database
Mysql Dump Syntax/Command
We use mysqldump command to do database backup
# mysqldump -uroot -p --databases filename > backupname.sql
eg: mysqldump -uroot -p --databases staff > staff130509.sql
Then, to dump back/restore the backup database to server, use this command:
#mysql -uroot -p < staff130509.sql
But, for UTF8 case, use this command:
#mysql -uroot -p --default-character-set=utf8 < staff130509.sql
Then to check the current process list in mysql server:
#mysql -uroot -pPASSWORD
mysql> show processlist;
To show processlist with out all the sleeping processes...
mysql> \P grep -v Sleep
We use mysqldump command to do database backup
# mysqldump -uroot -p --databases filename > backupname.sql
eg: mysqldump -uroot -p --databases staff > staff130509.sql
Then, to dump back/restore the backup database to server, use this command:
#mysql -uroot -p < staff130509.sql
But, for UTF8 case, use this command:
#mysql -uroot -p --default-character-set=utf8 < staff130509.sql
Then to check the current process list in mysql server:
#mysql -uroot -pPASSWORD
mysql> show processlist;
To show processlist with out all the sleeping processes...
mysql> \P grep -v Sleep
Labels:
mysql,
mysqldump,
restore,
restore database
Subscribe to:
Posts (Atom)