@joe jenifer Thank you for reaching out to Microsoft Q&A. apologize for any inconvenience caused on this.
As I understand from the issue description, you're attempting to run Sudo access via Azure Cloud Shell. Are you referring to any Azure docs for the steps?
Since you have tagged the Azure App Service
Just want to check are you trying to install the Ion Cube loader in web app that is running with php 8.1 on Linux plan through SSH or Are you installing on any other service.
If you are trying to install the Ion cube loader on PHP 8.1 webapp (running on App service) refer to this similar thread here with detailed steps on how to install custom extension during the startup of app service. I have tested this, and it is working fine from my end, and I would suggest you validate from your end as well.
Feel free to reach back to me if you have any further questions on this.