1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Use a Perl or Python script
This guide details the use of Perl or Python scripts on Infomaniak hosting and the management of their modules.
Preamble
- Shared Web Hosting: the CGI module is no longer available; the execution of Perl and Python scripts is therefore not supported.
- It is necessary to migrate to a Cloud Server.
- Managed Cloud Servers: to benefit from the latest technologies, it is possible to upgrade your Cloud Server.
Web Configuration (Apache/CGI)
To run Python or Perl scripts via Apache on a Cloud Server, the interpretation of files with the extensions .py and .pl is not active by default.
Using your FTP software/client or the FTP Manager, add and adapt the following directive in the .htaccess file located in the folder containing your scripts:
AddHandler cgi-script .pl .cgi .py
Options +ExecCGIInstallation of additional modules
On a Cloud Server, you have the possibility to install third-party libraries that are not present by default.
Python
- The installation is done via
PIP, which is a package manager used to install and manage packages written in Python. - Infomaniak offers
PIPandPIP3via the Fast Installer tool. - Once PIP is installed, you will be able to install Python modules by specifying
--userduring the command. For example: pip3 install mysql-connector-python --user
Perl
- The addition of Perl modules is also done via SSH (console). It is necessary to install them in the user directory and to define the full path within the scripts.
Important technical information
- Path of the interpreter (Path):
/usr/bin/python - Extensions: Scripts must have the extension
.pl,.cgior.py. - Limitations: The
mod_pythonmodule is not supported.
Error Resolution (CGIWrap)
If you encounter the following error when loading an image:
CGIWrap Error: Execution of this script not permitted
Request Data:Extra Path Info: /dossier/.../image.PL.12.34.gifThe server interprets the file as a script because it contains ".PL" (or .PY) in its name.
Solution: Simply rename the file to remove this mention (example: image-12-34.gif).