Skip to main content

Posts

Showing posts from March, 2018

Run multiple PHP version on Ubuntu, Apache2 and Nginx

Notes some problems on run more than one PHP version on Ubuntu. There are still some questions about how PHP, PHP CLI, Web Server Apache2, Nginx, PHP-FPM (FastCGI), composer ... Switch PHP version with Apache2 https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04 https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/ The basic idea for run 2 (or more ?) PHP version with Nginx and PHP-FPM is each FPM run on different port (9000, 9001) if use TCP/IP mode. In case use eg. php5-fpm.sock then you can point to different php-version.sock Keyword "Pool", Each pool for each PHP, FPM version seem have to different. If you use default pool (www) then I see that php-fpm only run for one version ie. php7.0-fpm while php5-fpm CGI not run. Use PHP7 with apache2 and PHP5 with Nginx. Apache2 can be switch PHP version by a2enmod, dismod to use PHP module. PHP with Apache is module. PHP in CLI is different story. This wil

Some image manipulation with Image Magick

/usr/bin/convert -size 160x160 xc:none \(   "in.png" -strip -thumbnail "140x140^" -gravity center -crop 140x140+0+0 +repage \(       +clone -fill black -colorize 100% -fill white -draw "translate 70,70 circle 0,0 70,0"   \)   -alpha off -compose copy_opacity -composite \) -alpha Set -compose src-over -composite -fill none -stroke "#0000FF" -strokewidth 10 -draw "translate 79.5,79.5 circle 0,0 74,0" "out.png" http://www.imagemagick.org/discourse-server/viewtopic.php?t=22110 https://stackoverflow.com/questions/2686715/why-png-files-produced-by-imagemagick-are-so-much-bigger-than-jpg-gif JPG is a lossy compression algorithm while PNG is a lossless one. This fact alone will (in general) make JPG images smaller than PNG ones. You can tweak the compression ratios for each format, so it could also be that you're not compressing your PNG files as much as your JPG ones. For a photographic image saving as JPG will us

Audacity digital audio editor and recording

Audacity digital audio editor and recording Trên Windows có thể record internal sound vd như youtube video để lấy nhạc. Chi tiết sẽ update. Thi thoảng hỏng driver thì ko được. Ubuntu cũng có nhưng mấy bản mới thì mặc định ko có sẵn. Audacity có nhiều tính năng edit audio như cắt, ghép, tăng âm lượng cho 1 đoạn này, hạ âm cho 1 đoạn khác ...

Fix video bị lỗi

Thi thoảng video quay bằng device như cam hành trình, điện thoại, máy ảnh ... bị lỗi. Biểu hiện là không mở được bẳng các player, điển hình là ông VLC cũng không coi được thì chịu. Trước khi fix chúng ta tìm nguyên nhân. Thông tin video có thể dùng tool mà coi. VD dùng lệnh FFMPEG thì mình được 1 trường hợp lỗi như sau : [ mov,mp4,m4a,3gp,3g2,mj2 @ 0x14af280 ] moov atom not found 2014_0205_192247_002.MOV: Invalid data found when processing input Nguyên nhân chi tiết đại khái là liên quan đến thiết bị quay trong quá trình quay gặp vấn đề như sụt nguồn, bị va đập ... Cấu trúc 1 video là dạng file đã được mã hóa và nén lại. Các chuẩn nén mình nói nôm là như là H.264 cho MOV, MP4 ... Khi mà đang quay video chưa rứt thì quá trình lưu video lại có kèm theo xử lý nén, mã hóa ... bị ngắt đột xuất. Vì thế mà dẫn tới lỗi. Trình đọc (player) không thể xử lý giải mã nội dung video. Nó không biết video dài bao nhiêu, kết thúc như nào. Bình thường tải video về bị lỗi gián đoạn thì VLC vẫn co