# Build-in PHP server previews command

**URL:** <https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777>\
**Category:** Previews\
**Created:** [June 28, 2024, 9:24pm UTC](https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777 "2024-06-28T21:24:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![proweb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/proweb/32/435_2.png) [@proweb](https://community.firebasestudio.dev/u/proweb)\
**Post date:** [June 28, 2024, 9:24pm UTC](https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777/1 "2024-06-28T21:24:06Z")

</div>

I’ve started with Blank Workspace template for play with PHP on platform.  
So my question about configuration of dev.nix file  
I have index.php in root folder and I start Build-in PHP server with `onStart =` directive for workspace… But I don’t understans what i suppose to write for `previews = { enable = true; };` to see web preview for started server? Can you show me example?  
workspace example - [https://idx.google.com/clean-starter-704273](https://idx.google.com/clean-starter-704273)

---

<div class="post-metadata">

**Author:** ![arifnd](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/arifnd/32/384_2.png) [@arifnd](https://community.firebasestudio.dev/u/arifnd)\
**Post date:** [June 29, 2024, 1:16am UTC](https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777/2 "2024-06-29T01:16:07Z")

</div>

Now IDX support PHP Template on Backend category.

Or try this config on your `dev.nix` file base on IDX PHP template.

```auto
    previews = {
      enable = true;
      previews = {
        web = {
          # Example: run "npm run dev" with PORT set to IDX's defined port for previews,
          # and show it in IDX's web preview panel
          command = ["php" "-S" "localhost:$PORT"];
          manager = "web";
          # env = {
          # # Environment variables to set for your server
          # PORT = "$PORT";
          # };
        };
      };
    };

```

---

<div class="post-metadata">

**Author:** ![proweb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/proweb/32/435_2.png) [@proweb](https://community.firebasestudio.dev/u/proweb)\
**Post date:** [June 29, 2024, 9:44pm UTC](https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777/3 "2024-06-29T21:44:55Z")

</div>

Yeah Thanks it’s helped.  
Removed running script on start with your command and it’s work!  
Thanks a lot.  
Nice to see as Google use Nix power for such nice product.  
Will try migrate some code here from Replit.

---

<div class="post-metadata">

**Author:** ![kirupa](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/kirupa/32/4_2.png) [@kirupa](https://community.firebasestudio.dev/u/kirupa)\
**Post date:** [July 1, 2024, 6:40pm UTC](https://community.firebasestudio.dev/t/build-in-php-server-previews-command/777/4 "2024-07-01T18:40:23Z")

</div>

Let us know if you run into any issues! Our goal with Nix is to make it easy to port your development environment from your local setup or from other online steps into IDX with no hassle 🚚
