Category Archives: Linux

Change permission for PHP to write storage folder

Under /storage/app/public/ (laravel)


New domain for Apache

Change permission:

Restart apache:


Linux 常用command



切換為Super user:



Scheduled Jobs in Linux using crontab (nano)

  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

Line break for log:

Nano commands:

Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U


  • 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


Enable .htaccess on Apache2

  1. Enable rewrite module
    Solution: Uncomment the 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)