Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

php Scripts and sub-domains

  • 18-01-2013 4: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