Synology NAS – PHP

Enabling extensions in PHP CLI

https://blackswan.ch/archives/594

Become root
Find out which configuration file is used:
php --ini

I get:
Configuration File (php.ini) Path: /usr/local/etc/php70
Loaded Configuration File: /usr/local/etc/php70/php.ini

Edit the php.ini file, check/change extensions dir to where it is located. If PHP was installed through DSM it should be something like ‘/volume1/\@appstore/PHP7.0’
extension_dir = "/volume1/@appstore/PHP7.0/usr/local/lib/php70/modules/"

Enable the extensions you wish to use:
extension = mysqli.so
extension = phar.so
extension = openssl.so
extension = zip.so
extension = curl.so

Installing Composer

https://medium.com/unhandled-code/installing-composer-on-synology-6-1-4-eebd1a1c4891

Become root
Enable the extensions as above (phar, openssl and zip are needed for Composer).

Get and install Composer:
cd /usr/local/bin
curl -s http://getcomposer.org/installer | php70

Create shortcut script ‘composer’ in /usr/local/bin:
#!/bin/bash
php70 /usr/local/bin/composer.phar $*

Set permissions:
chmod --reference=composer.phar composer

Test:
composer --version

Education

Video tutorials:
https://tutsgalaxy.com/

Packt Publications
https://www.packtpub.com/packt/offers/free-learning
https://www.packtpub.com/mapt/book/networking_and_servers/9781787120099/6/ch06lvl1sec39/sending-an-sms

SitePoint
https://www.sitepoint.com/

Stackcocial (shop for Stackskills)
https://stacksocial.com/
https://stacksocial.com/free
Free All-About-Android Coding Bundle

  • Using Java for Android & Advanced Applications
  • Publish an Android Game App
  • Android Material Design: Learning Through Example
  • Advanced Android Programming Skills

Stackskills (account required, access to purchased content)
https://stackskills.com/courses/html-5-from-the-ground-up/lectures/1002775
https://stackskills.com/courses/chinese-made-easy/lectures/644144
https://stackskills.com/courses/enrolled

StoneRiver eLearning (account required, access to purchased content)
https://stoneriverelearning.com/

Sitepoint (account required)
https://www.sitepoint.com/premium/courses/creating-a-login-portal-with-bootstrap-4-2994/lesson/1/step/2

Bootstrap
https://getbootstrap.com/docs/4.0/getting-started/introduction/

QNAP

Retaining mounted USB-disk locations on QNAP reboot
https://forum.qnap.com/viewtopic.php?f=25&p=636810#p636810

raid 5 failed after disk swap
https://forum.qnap.com/viewtopic.php?f=25&t=135753

Drive failure while rebuilding
https://forum.qnap.com/viewtopic.php?f=25&t=122300

Changing shell prompt and title of PuTTY
.profile
export PS1=”\[\e]2;\u@\H:\w\a\[\e[32;1m\][\W #] \[\e[0m\]”

My posts:
https://forum.qnap.com/search.php?author_id=190665&sr=posts

PHP

How to Convert MySQL to MySQLi PHP Code to Upgrade to PHP7 Doing the PHP MySQL MySQLi Migration

https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html

This is my (very rough) method, search and replace in all .php and .inc files using Perl. To re-use my code, you HAVE to make modifications and take a backup of every .php and .inc file in case somwthing goes wrong.

I converted one project at a time, these commands were used for my Amiga user’s database, so some commands will reflect specific changes/searches I did in the code to find lines to change, I also did some mistakes and corrected those. Read the commands before you try these on your code:

find . -type f -name '*.php' -exec grep -l mysql_numrows {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_numrows|mysqli_num_rows|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_num_rows|mysqli_num_rows|g' {} \;

find . -type f -name '*.php' -exec perl -pi -e 's|mysql_selectdb|mysqli_select_db|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_select_db|mysqli_select_db|g' {} \;
find . -type f -name '*.php' -exec grep mysqli_select_db {} \;
#
# Change to match your database name and the MySQL connection link (db name and calling parameters found above)
# Using mysql_select_db, the MySQL link identifier was optional, and sent as the second parameter
#  with mysqli_select_db it is required as a first parameter
#
find . -type f -name '*.php' -exec grep 'db("minimig_reg",\$link' {} \;
find . -type f -name '*.php' -exec grep 'db("minimig_reg")' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|db\("minimig_reg",\$link|db\(\$link,"minimig_reg"|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|db\("minimig_reg"\)|db\(\$link,"minimig_reg"\)|g' {} \;

#
# mysqli_connect returns the link identifier and also requires the database name as the fourth parameter, add it manually after this replacement
#
find . -type f -name '*.php' -exec grep mysql_connect {} \; 
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_connect|mysqli_connect|g' {} \;  

find . -type f -name '*.php' -exec grep mysql_error {} \;    
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_error()|mysqli_error(\$link)|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysqli_error\(\$link\)\(\)|mysqli_error\(\$link\)|g' {} \;

find . -type f -name '*.php' -exec grep mysql_insert {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_insert_id\(\)|mysqli_insert_id\(\$link\)|g' {} \;

find . -type f -name '*.php' -exec grep mysql_query {} \;  
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_query\(|mysqli_query\(\$link,|g' {} \;

find . -type f -name '*.php' -exec perl -pi -e 's|mysql_fetch_assoc|mysqli_fetch_assoc|g' {} \;

find . -type f -name '*.php' -exec grep mysql_fetch_array {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_fetch_array\(\$result\)|mysqli_fetch_array\(\$result,MYSQLI_BOTH\)|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_fetch_array\(\$result_migs\)|mysqli_fetch_array\(\$result_migs,MYSQLI_BOTH\)|g' {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_fetch_array\(\$result_info\)|mysqli_fetch_array\(\$result_info,MYSQLI_BOTH\)|g' {} \;

find . -type f -name '*.php' -exec grep mysql_real_escape_string {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_real_escape_string\(|mysqli_real_escape_string\(\$link,|g' {} \;

find . -type f -name '*.php' -exec grep mysql_affected_rows {} \;
find . -type f -name '*.php' -exec perl -pi -e 's|mysql_affected_rows\(\)|mysqli_affected_rows\(\$link\)|g' {} \;

The include files (mostly the same command lines):

find . -type f -name '*.inc' -exec grep -l mysql_numrows {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_numrows|mysqli_num_rows|g' {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_num_rows|mysqli_num_rows|g' {} \;

find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_selectdb|mysqli_select_db|g' {} \;
find . -type f -name '*.inc' -exec grep '"minimig_reg",\$link' {} \;   
find . -type f -name '*.inc' -exec perl -pi -e 's|"minimig_reg",\$link|\$link,"minimig_reg"|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_connect {} \; 
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_connect|mysqli_connect|g' {} \;  

find . -type f -name '*.inc' -exec grep mysql_error {} \;    
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_error\(\)|mysqli_error\(\$link\)|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_insert {} \;  
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_insert_id\(\)|mysqli_insert_id\(\$link\)|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_query {} \;  
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_query\(|mysqli_query\(\$link,|g' {} \;

find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_fetch_assoc|mysqli_fetch_assoc|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_fetch_array {} \;  
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_fetch_array\(\$result\)|mysqli_fetch_array\(\$result,MYSQLI_BOTH\)|g' {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_fetch_array\(\$result_migs\)|mysqli_fetch_array\(\$result_migs,MYSQLI_BOTH\)|g' {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_fetch_array\(\$result_info\)|mysqli_fetch_array\(\$result_info,MYSQLI_BOTH\)|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_real_escape_string {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_real_escape_string\(|mysqli_real_escape_string\(\$link,|g' {} \;

find . -type f -name '*.inc' -exec grep mysql_affected_rows {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_affected_rows\(\)|mysqli_affected_rows\(\$link\)|g' {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|mysql_result|mysqli_result|g' {} \;

find . -type f -name '*.inc' -exec grep split {} \;
find . -type f -name '*.inc' -exec perl -pi -e 's|split\(|explode\(|g' {} \;
find . -type f -name '*.php' -exec grep split {} \;

Missing function mysqli_result (to replace mysql_result)

function mysqli_result($res,$row=0,$col=0){
    $numrows = mysqli_num_rows($res);
    if ($numrows && $row <= ($numrows-1) && $row >=0){
        mysqli_data_seek($res,$row);
        $resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
        if (isset($resrow[$col])){
            return $resrow[$col];
        }
    }
    return false;
}

Amiga repairs and hardware hacks

Badcaps.net
https://www.badcaps.net/forum/showthread.php?t=485

Recapping the Amiga
John Hertell
http://wordpress.hertell.nu/?p=464

Who does your recapping? (AmigaWorld.net)
http://amigaworld.net/modules/newbb/viewtopic.php?topic_id=41642&forum=25

Amiga capacitor list
https://www.ikod.se/repairs/capacitor-lists/

Amiga RAM Expansion A501 RTC Battery Replacement (Read desription first!)

Amiga CD32 – Trash to Treasure (RetroManCave)


GadgetUK
Commodore Amiga CD32 Pickup – Repair Part 1 (Not Reading Discs, Disc Not Spinning)

Solder Tutorial (Keith Noneya)
Amiga 500 With Battery Corroded RAM Card, how to replace corroded copper








Amiga 500 Plus – Trasig diskettstation?
https://www.sweclockers.com/forum/trad/1136537-amiga-500-plus-trasig-diskettstation

Amiga floppy repair (YouTube search)
https://www.youtube.com/results?search_query=amiga+floppy+repair

Buffalo LS220 – BAMP – Buffalo Apache MySQL PHP

Apache (med PHP-stöd) och MySQL på Buffalo (LS220)

Fullt möjligt, men inte så snabbt.
Jag har på en av mina Buffalos även testat köra WordPress på LS220n, funkar fram till 5.1.1 med förinstallerad version av PHP. Från version 5.2 krävs PHP version 5.6 (jag kommer undersöka om det går att uppdatera php-cgi på Buffalon)

En förutsättning för att få det att fungeera är att den är patchad för att tillåta root-inloggning via SSH:
Buffalo LS220 – root access och andra modifieringar

Nästa steg är att få igång en egen virtualhost på den förinstallerade (och tok-felkonfigurerade) Apache 2.2.14 som finns där:
Buffalo LS220 – apache web server
Apache får sitt PHP-stöd genom php-cgi, PHP versionen som är tillgänglig är 5.3.23

Sedan MySQL:
Buffalo LS220 – MySQL server

Övrig Buffalo information

Buffalo forum

Firmware uppdatering

Nyaste firmwaren finns här. Har uppdaterats senast i slutet på januari 2018.
Senaste firmware för LS220
Installationen är enkel. Ladda ner senaste versionen, packa upp och starta LSUpdater.exe
Programmet hittar själv de Buffalosar på ditt nät som behöver uppdateras.
Var beredd på att innehåll i /root kommer gå förlorat, likaså allt som är modifierat i filer som följer med systemet (många av modifieringarna nedan).

TFTP-återställning av LS220D

Ifall något går helt snett, eller om båda diskarna byts. Med tanke på hur kasst BuffaloOS är, så kanske det inte ens går byta en disk utan att återställa den.
Completely revocering from a bricked Buffalo Linkstation LS200

Källor

Den flersidiga tråden med de av andras och mina inlägg är källan till alla mina Buffalo-artiklar
Hacka Buffalo Linkstation LS220D (LS200, LS400)