PHP can read, write, create, and delete files on the server. This is the core of what every yttcom.net endpoint does.
When you save a gym session, that data has to go somewhere permanent. When Builder deploys an HTML page, the file has to actually land on the server's hard drive. PHP is what makes that happen — it is the only thing that can write to the server's file system from a web request.
file_get_contents() reads an entire file and gives you its content as a string.
file_put_contents() writes a string to a file. If the file doesn't exist yet, PHP creates it. If it does exist, PHP overwrites it.
Before you try to read or delete something, always check that it is actually there.
unlink() deletes a file permanently. No trash can — it is gone.
mkdir() creates a new directory. The true parameter lets it create multiple nested folders in one go.
Every file on a server has an absolute path — its full address from the root of the hard drive. PHP needs the full path, not just the filename.
When Builder sends a curl command to deploy a page, file_write_web.php does exactly this sequence:
1. Receives the file path and content from the POST request
2. Builds the full server path using SERVER_ROOT + the path you sent
3. Checks if the destination folder exists — if not, calls mkdir() to create it
4. Calls file_put_contents() to write the content
5. Returns JSON saying how many bytes were written
That is it. Five steps. All file operations.
/home/yttcooyc/public_html/. This is the open_basedir restriction — a security rule the hosting company sets. Everything stays inside public_html.