0

I'm trying to load 2 .php files hosted in the (public_html) of my cPanel hosting from a subdomain, so my files are hosted here

(domain.com/includes/db.php

(domain.com/includes/init.php)

And I'm trying to load them from here

(subdomain.domain.com/api.php)

I've been looking online and have tried everything I've found but noting works, I'm getting these errors

(require_once(/home/user/public_html/domain.com/includes/db.php): failed to open stream: No such file or directory in /home/user/subdomain.domain.com/api.php on line 3)

(require_once(): Failed opening required '/home/user/public_html/domain.com/includes/db.php' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/user/subdomain.domain.com/api.php on line 3)

Does Anyone have any suggestions on what to do?

Thanks

Community
  • 1
  • 1
XeXLNX
  • 1
  • 3
    Possible duplicate of [How to include a php file in subdomain from main domain](https://stackoverflow.com/questions/23210352/how-to-include-a-php-file-in-subdomain-from-main-domain) – Obsidian Age Feb 12 '19 at 20:57
  • I've tried that before creating this, I created this as I couldn't get any of that to work – XeXLNX Feb 12 '19 at 21:38
  • put echo $_SERVER['DOCUMENT_ROOT']; at the top of (init.php) on domain.com, then use that actually value in your require_once 'value_of_domain.com_document_root_plus_/includes/init.php'; and require_once 'value_of_domain.com.document_root_plus_/includes/db.php'; – Stephanie Temple Feb 12 '19 at 22:07
  • Thank you Stephanie Temple, it is now finally working – XeXLNX Feb 12 '19 at 22:13
  • @StephanieTemple: Please use answers to actually answer questions. – greybeard Feb 12 '19 at 22:54

0 Answers0