I don't think you can include PHP in the files you upload to Itch.io, but your game could call an API that you host yourself. If you give some more details about how your game works and where the PHP comes into play I could elaborate further.
Viewing post in Does itch.io support PHP ?
William, grateful for any idea!
Leo.
iIndex.php?data=UserLeonFinishedScene1
iIndex.php :
<?php
echo 'I will write UserData to user.log <br />';
$filename = 'user.log';
$text = "\r\n Date:". date('Y-m-d\=H:i:s') . "Data :" . $_GET["data"];
//Writing:
$file = fopen ($filename, "a");
fwrite ($file,$text);
fclose ($file);
echo "UserData was writed successfull to file [$filename] !<br/><br/>";
?>
Basically what you should do is host your PHP file on your own web server, then have your game make a GET request to
https://[your domain name]/iIndex.php?data=UserLeonFinishedScene1
So when someone plays your game on here, their browser downloads all the actual game stuff from Itch, but those game files then tell it to send some data to your server. If you already have the game working on your own website then you should be able to basically just upload the same client files to Itch, although you might have to set up CORS headers on your sever or something.
But why then do I need ITCH.IO?
I mean, you don't. Itch is (from my understanding) mainly designed as a marketplace for games. They host free stuff too because they're cool like that, but they're not really a replacement for a web host. If you're looking for someone to rent you a PHP server this isn't the place for that.