Category Archives: Linux

Linux 常用command

修改User權限:

修改資料夾權限:

切換為Super user:

檢視檔案和資料夾詳細資料:

 

Scheduled Jobs in Linux using crontab

  1. Create crontab file: crontab -e
    This command will enter VI
  2. Edit crontab file
    e..g */1 * * * * php /var/html/task.php
    Execute task.php every minute.
  3. Ctrl + C to enter VI command mode and enter :wq to exit VI

Note:

  • Make sure use full path to use php. e.g. /usr/bin/php index.php
  • PHP could execute URI of CodeIgniter
    /usr/bin/php /var/www/test/index.php /home/some_action

Reference:

Enable .htaccess on Apache2

  1. Enable rewrite module
    http://stackoverflow.com/questions/869092/how-to-enable-mod-rewrite-for-apache-2-2
    https://www.digitalocean.com/community/questions/how-to-active-sudo-a2enmod-rewrite-for-centos
    Solution: Uncomment the mod_rewrite.so line in /etc/httpd/conf/httpd.conf, restart apache, and you should be good to go.
  2. Update directive in .conf (e.g. /etc/apache2/sites-available/000-default.conf)
    https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles