Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

php Scripts and sub-domains

  • 18-01-2013 04:43PM
    #1
    Registered Users, Registered Users 2 Posts: 669 ✭✭✭


    Hi,

    I've setup a subdomain on my web server (hosted solution).

    So now I log into (and ftp to) sub.mydomain.ie rather than mydomain.ie.

    And this presents me with the folder at mydomain.ie/sub as my new root folder.

    The problem occurs when I try to include_once or require_once some of the php include files (e.g. require_once 'Mail.php';).

    I get an error saying that the script cannot open the Mail.php file as it can't find it.

    Is there a way to force the path to see the folder structure "above" the subdomain, so that it can see the /php directory?

    (The /php folder is located alongside the /public_html folder in my domain root folder)

    Paddy


Comments

  • Registered Users, Registered Users 2 Posts: 52 ✭✭iFergal


    To go to the parent directory, put ../ before your path. Every two dots indicates the next parent directory. In your case I believe you'd use ../php/Mail.php.


  • Registered Users, Registered Users 2 Posts: 669 ✭✭✭Patrickof


    iFergal wrote: »
    To go to the parent directory, put ../ before your path. Every two dots indicates the next parent directory. In your case I believe you'd use ../php/Mail.php.

    Nope, the subdomain is a root in its own right, there is no .. folder for it to go back up to. It sees mydomain.com/sub as the root.

    Which is the problem.


  • Registered Users, Registered Users 2 Posts: 52 ✭✭iFergal


    Hmm, have you tried using an absolute path instead?


  • Registered Users, Registered Users 2 Posts: 437 ✭✭t1mm


    Can you setup a symbolic link (basically a shortcut) to .. ? For example:

    site.com
    • subdomain1
      • rootlink (symlink to "site.com" folder)
      • myfile.php
    • mail.php

    So myfile.php at subdomain1.site.com could use mail.php by doing the following:
    <?php include('rootlink/mail.php'); ?>
    

    I might have explained it badly, but hopefully it'll help :)


  • Registered Users, Registered Users 2 Posts: 241 ✭✭fcrossen


    If the 2 hosting account logins (usernames) are different, it is likely that one user cannot access the files belonging to the other user.

    It could be a permissions error.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 669 ✭✭✭Patrickof


    D'oh turned out to be a PEAR installations issue.

    Mail.php and Mailmime.php hadn't installed correctly.

    Works fine once uninstalled and reinstalled.


Advertisement