Category Archives: PHP

Redirect to previous page after login

  1. Save URL referer in login page

2. Check saved URI after login successfully and redirect

session_start() permission issue

https://serverfault.com/questions/558641/aws-ec2-php-session-start-with-permission-denied

This is because the “Local value” overwrite “Master value” and point to a folder that users don’t have permission to write session related files.

  1. Change session.save_path value or uncomment the line in php.ini
  2. Find and edit the config file
    /etc/httpd/conf.d/php.conf
  3. Restart apache

     

iPhone Orientation Issue

Images taken by iphone always show wrong orientation after upload to server. This is why. Fuck!

Reference:

iphone_orientation

exif example: (taken by iphone 5)

 

Upload Error Handler

Helper functions:

Other programming issue:

 

Sending Emails using Gmail

如果要利用phpmailer由Gmail發信,要設定google account:

未開啟兩階段認證:

要啟用”允許安全性較低的應用程式”

注意: 有可能在帳戶中找不到這個選項,應該是有使用G Suite而且權限被Dsiable, G Suite的設定參考這一篇


image-24

 

已啟用兩階段認證:

要取得應用程式密碼

Change upload size limit by htaccess

This solution works even in  shared server.