Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add PHP support #57

Closed
wants to merge 1 commit into from

Conversation

nikolaystrikhar
Copy link
Contributor

@nikolaystrikhar nikolaystrikhar commented Sep 28, 2021

I made a basic version using php-wasm.

Screenshot 2021-09-28 at 03 20 06

It definitely needs to be improved (feel free to refactor and improve please), but at least the first function works :-)

I'm not sure it was a good idea to add public files to this repo, but I don't understand how Vercel works yet. Please send some help and feel free to make it work :-)

@vercel
Copy link

vercel bot commented Sep 28, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sliphq/run-wasm/6qH4giFpB7Y7RriHaM6nNJrBZspE
✅ Preview: https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app

@nikolaystrikhar
Copy link
Contributor Author

I already see it failed on Vercel, but I will be the slowest one to fix it, so I hope someone can help.

@kennethcassel
Copy link
Contributor

The deploy worked but I'm not seeing the Run Code button for the PHP page

https://run-wasm-8ixcyq7ui-sliphq.vercel.app/php

image

@mcintyre94
Copy link
Contributor

mcintyre94 commented Sep 28, 2021

I'm getting some console errors:

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404`

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 Uncaught (in promise) RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.
    at abort (323ad1c3-cea4731….js:1)
    at 323ad1c3-cea4731….js:1

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 Uncaught (in promise) RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.
    at abort (323ad1c3-cea4731….js:1)
    at 323ad1c3-cea4731….js:1

My best guess is that postinstall isn't getting run. If that's usually run by default in Vercel (I'm not familiar with it), then it probably won't work here because we use a custom build command in Vercel: #3 (comment)

@nikolaystrikhar
Copy link
Contributor Author

I'm getting some console errors:

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404`

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 Uncaught (in promise) RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.
    at abort (323ad1c3-cea4731….js:1)
    at 323ad1c3-cea4731….js:1

323ad1c3-cea4731….js:1 GET https://run-wasm-git-fork-nikolaystrikhar-add-php-support-sliphq.vercel.app/_next/static/chunks/pages/php-web.wasm 404

323ad1c3-cea4731….js:1 Uncaught (in promise) RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.
    at abort (323ad1c3-cea4731….js:1)
    at 323ad1c3-cea4731….js:1

My best guess is that postinstall isn't getting run. If that's usually run by default in Vercel (I'm not familiar with it), then it probably won't work here because we use a custom build command in Vercel: #3 (comment)

Yeah, that’s what I meant when I said I added public files to git. I was not sure if Vercel runs the command, so decided to just add them for now manually.

@nikolaystrikhar
Copy link
Contributor Author

The deploy worked but I'm not seeing the Run Code button for the PHP page

https://run-wasm-8ixcyq7ui-sliphq.vercel.app/php

image

Yep, sorry, I was not clear with the failed Vercel. It deployed well, but for some reason can not load the file as I see from console logs.

I will try to investigate it and learn Vercel if I have time, but will be happy too if someone solves it😃

@kennethcassel
Copy link
Contributor

Is there an approach that wouldn't require adding the files to the public folder?

Pyodide is loaded via cdn. Is that an option here @nikolaystrikhar?

@nikolaystrikhar
Copy link
Contributor Author

@kennethcassel no, I wish they had it. I also took a look at some other languages and it looks like most of them are not that convenient as pyodide😯

@kennethcassel
Copy link
Contributor

In that case I think we should follow an approach like mentioned here from Zack.

#32 (comment)

@nikolaystrikhar
Copy link
Contributor Author

Yes, I absolutely love this approach and we definitely need to go this way, otherwise everything will be monstrous in two weeks.

But my idea was to just show that it’s possible with PHP, so maybe we’ll rethink our structure and find the way of implementing it. Better to have something to work with that nothing!

@kennethcassel
Copy link
Contributor

Yes, I absolutely love this approach and we definitely need to go this way, otherwise everything will be monstrous in two weeks.

But my idea was to just show that it’s possible with PHP, so maybe we’ll rethink our structure and find the way of implementing it. Better to have something to work with that nothing!

Great work on showing a proof of concept :) I think to merge yet another language, we need to figure out a pattern for supporting the large wasm modules in a way that's good for the user.

So for now, I'm going to close this PR and open an issue for integrating PHP and using the approach that Zach mentioned in #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants