简体   繁体   中英

Call php file in cpanel

I'm trying to call an example php file "example.php" that return "Hello world" to test some functionality in my app.

When i call URL: "http://www.example.com:2083/home/public_html/example.php" the server redirect to cpanel access page. So, after some google resources, i've generated an API TOKEN through cpanel API token manager and i've tried to call this file using curl like this: "curl -H "Authorization: cpanel username:API_TOKEN" "https://www.example.it:2083/execute/home/public_html/example.php" but always retrive this message: {"metadata":{},"data":null,"errors":["Illegal function name:public_html/example.php"],"warnings":null,"messages":null,"status":0}" .

Is this the right way to call a php file hosted on cpanel? Thanks for any help:)

Looks like you are calling the file wrong way.

  1. The port after your website ":2083" will forward you towards the cpanel.
  2. You do not need to put the whole directory "/home/public_html" to call it, since your domain name itself points you towards "public_html"'s "index" directory.

Taking this URL are reference: http://www.example.com:2083/home/public_html/example.php

The correct way to call it would simply be: http://www.example.com/example.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM