HiBlog
  • صفحه اصلی
  • خانه وبلاگ
  • دسته بندی ها
    • جذاب ترین ها
      جذاب ترین مطالب
    • های تیوب
      انواع ویدئوهای آموزشی
    • های ‌کست
      انواع پادکست های جذاب
    • های کادمی
      آموزش ها و ترفندهای وب
  • درباره ما
  • ارتباط با ما
FA
EN
RU
Language:
FA
EN
RU
Article Stats
HiCademy
Category
A. Mounesi
Author
9 June 2025
Release Date
126
Views
FA
EN
RU
Post Languages
How to Run Python Scripts on Hosting Without Terminal Access

How to Run Python Scripts on Hosting Without Terminal Access

Table of Content

Article Stats
  1. Prerequisites and Important Notes
  2. Guide to Setup Python App Options in cPanel
  3. Step-by-Step Tutorial: Running a Python Script on Hosting Without a Terminal
  4. Running a Telegram Bot on Shared Hosting (cPanel)
  5. Frequently Asked Questions (FAQ) and Troubleshooting
  6. Conclusion

Python programming is one of the most popular areas of web development and bot creation. However, shared hosting users often do not have terminal access and assume that running Python scripts is only possible on dedicated or virtual servers. If your hosting supports CloudLinux and cPanel with the Setup Python App feature, you can run Python scripts or bots (like Telegram bots) without needing SSH. This tutorial is designed for both beginners and advanced users and includes a section explaining how to run a Telegram bot.

Prerequisites and Important Notes

  • Your hosting must be under CloudLinux and have cPanel control panel.
  • The Setup Python App option must be enabled in the panel.
  • You must have access to File Manager.
  • You do not need SSH or terminal access.
  • This method is suitable for running various Python scripts and even Telegram bots.

Guide to Setup Python App Options in cPanel

OptionDescription
Python versionSelect the appropriate Python version for the project (e.g., 3.10)
Application RootThe folder where the project files are located (e.g., public_html/telegrambot)
Application URLThe domain or subdomain on which the Python application runs
Application Startup FileThe name of the main project file (e.g., bot.py or app.py)
Application Entry PointThe name of the main function or variable for running the application. Usually ‘app’ for Flask and ‘application’ for Django. Not usually needed for simple scripts.
Passenger Log FileThe path to the application’s execution log file (optional)
Environment VariablesProject environment variables (optional, e.g., for API KEY, etc.)
CreateCreate and activate the Python application
RestartRestart the application after each change or library installation
Run Pip InstallAutomatically install the libraries written in requirements.txt (without terminal)

Step-by-Step Tutorial: Running a Python Script on Hosting Without a Terminal

1. Login to cPanel and the Setup Python App Section

Log in to your cPanel and click on the Setup Python App option in the Software section.

2. Creating a New Python Application

Click on the Create Application button.

Select the desired Python version (e.g., Python 3.10).

In the Application Root field, enter a desired folder such as public_html/telegrambot.

Select the Application URL (the desired domain or subdomain).

Write the Application Startup File, for example, bot.py.

Write the Application Entry Point as app for Flask projects and application for Django projects (leave it blank for a regular script).

Click on Create.

3. Uploading the Python Script File

Go to File Manager and enter the folder you selected in the previous step.
Upload the main script file (e.g., bot.py), the requirements.txt file, and other project files.

4. Creating the requirements.txt file and installing libraries

  1. If your script requires an external library (e.g., Flask or pyTelegramBotAPI), create a text file named requirements.txt.
  2. Enter the names of the required libraries, each on a separate line:

pyTelegramBotAPI
requests
  1. Return to Setup Python App.
  2. Click the Run Pip Install button to install the libraries.

5. Running the script and viewing the output

  • If your project is a web app (Flask, Django), open the domain or subdomain address in a browser and see the result.
  • If it is a regular script, the output may be in the form of a text file, sending a message, or another operation.
  • After each change or installation of a new library, Restart the application.

Running a Telegram Bot on Shared Hosting (cPanel)

You can also run your Telegram bot on shared hosting. Simply follow the steps above and have the bot.py and requirements.txt files ready.

Simple Telegram Bot Code Example (with pyTelegramBotAPI library):


import telebot

TOKEN = "Place your bot token here"
bot = telebot.TeleBot(TOKEN)

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    bot.reply_to(message, "Hello! Your bot is ready.")

bot.polling()
  1. Upload the code above as bot.py to your hosting account.
  2. In the requirements.txt file, enter only the name pyTelegramBotAPI.
  3. Create the application through Setup Python App according to the tutorial above and click Run Pip Install.
  4. Finally, Restart the application.

Note: Running the bot in polling mode may be stopped on shared hosting that limits long-running scripts. For continuous execution or large projects, a VPS or dedicated bot hosting is more suitable.
If you intend to set up the bot with a webhook (for lower resource consumption and no interruption), you can give the domain address to BotFather and replace the polling code with the webhook code.

Frequently Asked Questions (FAQ) and Troubleshooting

  • Why does installing libraries give an error?
    Enter the library name accurately in requirements.txt. Check the Python version. The hosting space should not be full.
  • Why does the Telegram bot disconnect or not stay online?
    In shared hosting, long processes are usually terminated. It is better to run the bot as a webhook or use a VPS.
  • I get a ModuleNotFoundError error?
    Have you definitely clicked “Run Pip Install”? The requirements.txt file must be in the project path.
  • Where is the script output?
    For a normal script, the output will be in the form of a text file or message in the same project path or Telegram.

Conclusion

In this tutorial, you learned that even without terminal or SSH access, you can easily set up Python scripts, web projects, and even Telegram bots on your shared hosting. The features of the Setup Python App section in the cPanel control panel provide an opportunity for all users to run their Python projects with just a few clicks, without the need for specialized Linux knowledge.

Don’t forget, if your project requires a specific library, simply create a requirements.txt file and easily install all the libraries with the Run Pip Install button. Also, after any changes to the code or libraries, Restart the application for your changes to take effect.

Important Note:
HiData’s Professional Web Hosting and High-Traffic Hosting services allow you to run Python, and you can choose and use these services as a Python Hosting. If you intend to set up a website, web project, or even a Telegram bot with Python, simply order one of these services and immediately benefit from all the Python execution features.

Finally, running Python on shared hosting is no longer a dream; just follow the steps in this tutorial to run any script you want. If you have any questions or problems, you can get help through the comments section of this article or by submitting a ticket to support.

Good luck, and experience the joy of programming on powerful hosting with HiData!

Share Post
hidata.org/en/blog/run-python-shared-hosting/
Copy Link
In Social Media

Add Comment

You’re replying to
captcha

Related Articles

How to Install MikroTik on an Ubuntu Server

How to Install MikroTik on an Ubuntu Server

MikroTik is an advanced router operating system that provides a variety of features for network management. The CHR (Cloud...
2 weeks ago
View Article
Comprehensive Guide to Using a Virtual Server / How to Use a VPS?

Comprehensive Guide to Using a Virtual Server / How to Use a VPS?

Today, with the growth of digital services, website design, application development, and the execution of web-based projects, the use...
3 weeks ago
View Article
How to change SSH port in Linux

How to change SSH port in Linux

By default, port 22 is defined for SSH in Linux. Changing the default port can help increase server security...
2 months ago
View Article
Web Hosting
  • Professional cPanel Hosting
  • High-Traffic cPanel Hosting
  • File Hosting
Dedicated Server
  • Europe Dedicated Server
About HiData
Hi Data
Good Hosting Experience
Since April 2014, HiData has been hosting thousands of online businesses with strong and premium infrastructure in the best datacenters in Iran and worldwide. We use new-generation servers with powerful processors, high-capacity networks, and strict data security policies to meet your hosting needs at the highest standards. Our support team is available 24/7 through ticket and phone. Speed, stability, and peace of mind are not just promises. They are the identity of HiData.
Virtual Server
  • Germany NVMe VPS
  • Russia NVMe VPS
  • Turkey SSD VPS
  • Germany SATA VPS
  • Storage VPS
  • Cloud VPS
Other Services
  • Domain Services
  • Licensing System
  • Reseller
Phone 1: +98-9009019
HiTube HiCademy HiCast HiBlog
Address
HQ Address: Unit 8, 2nd Floor, Tala Commercial Complex, Imam Khomeini St., Abhar
Contact Phones
+98-9009019
24/7 Support
Support Email: info@hidata.org
© 2025 HiData
All rights reserved for hidata.org
HiData Store
The best prices for the world's leading brands