Find compiled binaries in the codebase -
To run from the web root -# List every non-text executable/library and its architecturefind . -type f \( -perm -u+x -o -name "*.so" -o -name "*.a" -o -name "*.bin" \) \-exec file {} \; | grep -v -E "ASCII|text|script"Anything reported asELF 64-bit LSB ... x86-64is a problem.Also to check external programs -grep -rnE "exec\(|shell_exec|system\(|passthru|proc_open|popen|\`" --include=*.php .This shows every external program the CMS calls (e.g. wkhtmltopdf, ffmpeg, ghostscript, imagemagick, pdftotext). Most of these have ARM64 builds in Ubuntu/Debian repos, but a bundled x86 copy inside your repo won’t work.
I needed to do
sudo apt install file
to run the above.
Our CMS was fine. Inside the Moodle directory, running the same command started listing all sorts of .png files and so on.
Claude suggested,
Filter for ELF instead:cd /path/to/moodlefind . -type f -exec file {} + | grep "ELF" | grep "x86-64"
Then there were the suggestions which I did not need to follow, because I already knew the answer.
Check PHP extensions - Anything installed through PECL or compiled by hand, or vendor specific or proprietary
(we had none.)
Check for native helpers outside PHP -Cron jobs and systemd services: crontab -l, ls /etc/cron.*, systemctl list-units --type=serviceCustom scripts in /usr/local/bin and /opt: file /usr/local/bin/* /opt/*/*
(we had none.)
So, our migration could have been done to an ARM processor. But we didn't, since the Mumbai zone / region didn't have spare ARM capacity.
No comments:
Post a Comment