AI Studio can’t create PHP files — “An internal error occurred”

Hi Google team :waving_hand:

I’m facing an issue while using Google AI Studio (Apps).
Whenever I try to create or modify a PHP file, the app throws this error:

error: [file-name].php  
error: An internal error occurred

It seems like AI Studio doesn’t allow generating or saving .php files at all.

I tried:

  • Renaming the file

  • Moving it to a different folder

  • Regenerating the app

  • All gave the same result

However, when I use JavaScript (.js) or TypeScript (.ts) files instead, everything works fine.

Here’s a simple workaround I’m currently using:

// example.js
export default async function handler(req, res) {
  try {
    // backend logic here
    res.json({ success: true });
  } catch (err) {
    console.error(err);
    res.status(500).json({ error: "Internal Server Error" });
  }
}

Could you please confirm if PHP files are currently unsupported in AI Studio,
or if this is a temporary bug that will be fixed soon?

Thanks in advance :folded_hands:

3 Likes

seems like google ai studio cant create the ,php file not sure why the work around I use is asking it to create the file as a .txt file then when you download change it to .php or ask google ai studio to show you the code in thchat then copy and past to a file you create

This prompt worked for me! Just let

it write It out in the chat and copy it later into a php file:

IMPORTANT: Do NOT create a file. Do NOT generate a downloadable file.
Instead, output the FULL PHP code directly in the chat window as plain text.

I want you to write the complete WordPress plugin file named “your-name.php”.
But DO NOT attempt to create or save a file in the environment.
Just paste the entire PHP code directly into the chat so I can manually copy/paste it.

Repeat: Output ONLY the PHP code as plain text. No file creation. No file system actions.

Good luck!

2 Likes