Tuesday, October 27, 2026

confirm if our custom CMS has no x86-only binaries or PHP extensions

Contemplating a move to a possibly cheaper ARM server, asked Claude how to check if our applications would run on ARM, or if there are any x86-only binaries. Claude's suggestions below.

Find compiled binaries in the codebase - 
To run from the web root -
# List every non-text executable/library and its architecture
find . -type f \( -perm -u+x -o -name "*.so" -o -name "*.a" -o -name "*.bin" \) \
  -exec file {} \; | grep -v -E "ASCII|text|script"

Anything reported as ELF 64-bit LSB ... x86-64 is 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/moodle
find . -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=service
Custom 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