I'm making a website about 3D printing, and I want to be able to slice a 3D model with a php backend, as an instant quote system, to determine the amount of filament used, time taken, etc. I found this curaengine wrapper (https://github.com/Spiritdude/Cura-CLI-Wrapper), and I'm trying to use this, because it seems like it does exactly what I'm looking for. The only problem is that it's Linux only, and I'm running an IIS server with PHP on Windows. I have a WSL distro installed and configured with the cura slicer program, and the command I want to execute is (for testing purposes): wsl cura-slicer
.
I can run this command just fine in a regular cmd window, both as user and admin, and it displays the help page for the slicer. My PHP code is the following:
<?php
$command = 'wsl cura-slicer';
$output = shell_exec($command);
echo $output;
But when I run this, it gives this output:
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
It says that there are no distributions installed (which there are).
I tried listing distributions (using wsl --list
), and it gives the exact same output. I also tried installing Ubuntu again (with wsl --install -d Ubuntu
), and the same output again.
I also tried the solution in this post: https://stackoverflow.com/questions/72420488/iis-php-exec-to-run-linux-commands-with-wsl-not-working
I thought the problem might be with using the Application Pool Identity user (IIS AppPool\DefaultAppPool
), but I changed it to my local user account, and instead, it showed no output for any wsl command.