Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » EXECUTING INDEPENDEN PHP SCRIPT

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 609 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    EXECUTING INDEPENDEN PHP SCRIPT Link to this post

    Hello

    I have a php script updatescript.php in a folder code/mycode/ updatescript.php

    I solved the problem of accessing the script py putting a .htaccess file in the folder with :

    <Files updatescript.php>
    allow from all
    </Files>

    It is working and I have access to it but my problem now is that it seems that I can not execute the script .

    Is there some other instrcution/permission I have to give for it to work ?

    Thank you

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: EXECUTING INDEPENDEN PHP SCRIPT Link to this post

    Are you executing it via the web interface or cli? The default .htaccess will route any requests to php files through sapphire/main.php so that users can not simply download all your files. I would recommend writing a simple SilverStripe controller to wrap your script. Something like

    <?php

    class MySpecialController extends Controller {

    function index() {
    require_once '/path/to/file.php';

    run_something();
    }
    }

    Then you can hit the URL site.com/MySpecialController/

    609 Views
Page: 1
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.