# \[SOLVED\] How to Run Script From Github if Website Doesn't Work Anymore

**URL:** <https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627>\
**Category:** Tools & Scripts\
**Tags:** solved\
**Created:** [March 16, 2020, 2:32pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627 "2020-03-16T14:32:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kei](https://onehack.st/user_avatar/onehack.st/kei/32/32817_2.png) [@kei](https://onehack.st/u/kei)\
**Post date:** [March 16, 2020, 2:32pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/1 "2020-03-16T14:32:36Z")

</div>

So there is the script located on Github [https://github.com/luanjunyi/solvethestreet](https://github.com/luanjunyi/solvethestreet), but the website that runs this script is not available anymore. Is there any way to run this script locally on a computer or my website?

---

<div class="post-metadata">

**Author:** ![beast](https://onehack.st/user_avatar/onehack.st/beast/32/35433_2.png) [@beast](https://onehack.st/u/beast)\
**Post date:** [March 16, 2020, 4:19pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/2 "2020-03-16T16:19:53Z")

</div>

Download and open that .phtml file in browser.

 ![Screenshot (29)](https://onehack.st/uploads/default/original/3X/0/b/0ba28f8867e5bb5547505a074323a3917310bbbf.png)

---

<div class="post-metadata">

**Author:** ![kei](https://onehack.st/user_avatar/onehack.st/kei/32/32817_2.png) [@kei](https://onehack.st/u/kei)\
**Post date:** [March 16, 2020, 4:31pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/3 "2020-03-16T16:31:28Z")

</div>

I tried it before but it shows script instead.

 ![Untitled](https://onehack.st/uploads/default/original/3X/1/3/13f8dfa406cc810d18d093095c9921b4831922d2.png)

---

<div class="post-metadata">

**Author:** ![beast](https://onehack.st/user_avatar/onehack.st/beast/32/35433_2.png) [@beast](https://onehack.st/u/beast)\
**Post date:** [March 16, 2020, 4:35pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/4 "2020-03-16T16:35:05Z")

</div>

use xampp, wamp or laragon and try.  
and also refer it if it could help.

> <https://stackoverflow.com/questions/10793810/open-phtml-files-displays-code-in-browser>

---

<div class="post-metadata">

**Author:** ![kei](https://onehack.st/user_avatar/onehack.st/kei/32/32817_2.png) [@kei](https://onehack.st/u/kei)\
**Post date:** [March 16, 2020, 7:00pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/5 "2020-03-16T19:00:14Z")

</div>

I installed XAMPP and run Apache.  
Relocated project to C:\xampp\htdocs  
Then I created .htaccess file with `AddType application/x-httpd-php .phtml AddHandler x-httpd-php5 .phtml` inside C:\xampp\htdocs\solvethestreet-master  
Also changed XAMPP settings like mentioned here [https://stackoverflow.com/questions/55513381/phtml-file-unable-to-execute-php-code-on-xampp-server-localhost](https://stackoverflow.com/questions/55513381/phtml-file-unable-to-execute-php-code-on-xampp-server-localhost)  
Cleared browser cache.  
It opens directory correctly.

 ![image](https://onehack.st/uploads/default/original/3X/c/6/c6d98e4153580b5ac8c60afcf2646c986b995d16.png)  
But when I click on index.phtml file it still shows me code instead of running it.

---

<div class="post-metadata">

**Author:** ![Experimental](https://onehack.st/user_avatar/onehack.st/experimental/32/27753_2.png) [@Experimental](https://onehack.st/u/Experimental)\
**Post date:** [March 16, 2020, 9:24pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/6 "2020-03-16T21:24:56Z")

</div>

do not open the index.php file from your explorer.

after running the server goto **localhost** in your browser, now you should see XAMPP page, if it works then you are good to go

now you can goto **localhost/solvethestreet-master**

and also remove that htaccess file

---

<div class="post-metadata">

**Author:** ![Muhammad\_Yasir\_Rehma](https://onehack.st/user_avatar/onehack.st/muhammad_yasir_rehma/32/24207_2.png) [@Muhammad\_Yasir\_Rehma](https://onehack.st/u/Muhammad_Yasir_Rehma)\
**Post date:** [March 17, 2020, 10:23am UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/7 "2020-03-17T10:23:05Z")

</div>

when in XAMPP try to run index.php instead of .phtml  
btw It’s running fine on FireFox without XAMPP For me.

 ![image](https://onehack.st/uploads/default/original/3X/6/1/61da8b1498e8feb9c323abaabc5fe0791eba4189.png)

---

<div class="post-metadata">

**Author:** ![Hannah](https://onehack.st/user_avatar/onehack.st/hannah/32/174875_2.png) [@Hannah](https://onehack.st/u/Hannah)\
**Post date:** [March 20, 2020, 2:59pm UTC](https://onehack.st/t/solved-how-to-run-script-from-github-if-website-doesnt-work-anymore/73627/8 "2020-03-20T14:59:01Z")

</div>

You have the URL, you have the file reading and you have the execution. You’re just missing the step where you download the file.

Easiest to use `urllib` in Python3:

```auto
import urllib.request

code = 'https://raw.githubusercontent.com/bensharkey3/Guess-The-Number/master/Guess%20the%20number%20game.py'

response = urllib.request.urlopen(code)
data = response.read()

exec(data)

```

Note that relying on the URL is a pretty fragile way to ensure you have the latest code. Much better would be to use git to pull the latest, but this should at least get you started.

* * *

Github is a tool for version and source control, you will need to get a copy of the code to a local environment.

There is a beginner’s tutorial [here](http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1/)

Once that you have set up a github account and define your local and remote repositories, you will be able to retrieve the code with `git checkout` . Further explanation is in the tutorial
