Jump to:

5451 Posts in 1673 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Use standalone PHP in a subdirectory

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 4191 Views
  • Double-A-Ron
    Avatar
    Community Member
    603 Posts

    Use standalone PHP in a subdirectory Link to this post

    Should be a pretty simple one:

    I've got a directory that I have dropped into my Silverstripe root directory called "custom". In this directory, I have a php page called index.php, amongst others.

    Obviously, when I try to open www.domain.com/custom/, The SS rewrite engine kicks in and tries to find a CMS page that doesn't exist.

    How can I modify this behavior on a per directory basis?

    And, no, I don't want to use a redirector page either. These pages are all process pages and I don't want them in the SiteTree.

    Cheers
    Aaron

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    I think you can access the page with the actual URL to the file.
    Something like this I mean www.domain.com/custom/index.php

  • Double-A-Ron
    Avatar
    Community Member
    603 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    Er, that would have been the first thing I tried to actually find this problem in the first place, don't you think?

    No, that doesn't work obviously. I'm told that the page doesn't exisit, which is the CMS throughing it's page-not-found handler.

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    What's your .htaccess file look like?

  • briso
    Avatar
    Community Member
    1 Post

    Re: Use standalone PHP in a subdirectory Link to this post

    I'm new to SS.

    I'm trying to get a Virtual Tour based around PHP script going. It runs as per normal on various other sites/hosting.

    It's sitting in a directory/folder outside SS but when it runs it just displays the generated HTML code.

    Even simple Hello World or phpinfo.php script does the same.

    I've found some info within this forum which indicates the SS processes everything delivered from the site even if it's external to SS, but I can't find a definitive procedure to have PHP run normally as it does on non SS sites.

    Does the answer lie in a mod to php.ini , .htaccess , SS or anywhere else?

    Can anyone point me in the right direction?

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    If you include a file called "__manifest_exclude" in a folder, SilverStripe will ignore it.

  • SilverRay
    Avatar
    Community Member
    167 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    Hmm. If I have a directory called "haha" in root, and a file in it called "__manifest_exclude", the url http://www.mydomain.com/haha/ still goes to Silverstripe's error page... also when I name the file "_manifest_exclude" with one underscore as is described here: http://doc.silverstripe.com/doku.php?id=changelog&s=manifest%20exclude

    Bug maybe? Using version SS 2.3.1

  • rbquirke
    Avatar
    Community Member
    70 Posts

    Re: Use standalone PHP in a subdirectory Link to this post

    No, this is not a bug.

    What Ingo was talking about prevents the php from being included into the SilverStripe codebase.
    If you want to actually access that directory directly, you will need to tell .htaccess not to use the Silverstripe for that directory.

    You need to add line to your .htaccess file like:
    RewriteCond %{REQUEST_URI} !/directoryname

    where directoryname is the name of the directory with your files

    4191 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.