简体   繁体   English

在cpanel中调用php文件

[英]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.我正在尝试调用返回“Hello world”的示例 php 文件“example.php”来测试我的应用程序中的某些功能。

When i call URL: "http://www.example.com:2083/home/public_html/example.php" the server redirect to cpanel access page.当我调用 URL: "http://www.example.com:2083/home/public_html/example.php"服务器重定向到 cpanel 访问页面。 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}" . 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"但总是检索此消息: {"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?这是调用 cpanel 上托管的 php 文件的正确方法吗? 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.您的网站“:2083”之后的端口会将您转发到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.您不需要将整个目录“/home/public_html”来调用它,因为您的域名本身会将您指向“public_html”的“index”目录。

Taking this URL are reference: http://www.example.com:2083/home/public_html/example.php 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调用它的正确方法是: http://www.example.com/example.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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