# write files by PHP?

**URL:** <https://support.ibiblio.org/t/write-files-by-php/270>\
**Category:** Help\
**Created:** [March 18, 2021, 1:09pm UTC](https://support.ibiblio.org/t/write-files-by-php/270 "2021-03-18T13:09:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![demidov](https://support.ibiblio.org/user_avatar/support.ibiblio.org/demidov/32/43_2.png) [@demidov](https://support.ibiblio.org/u/demidov)\
**Post date:** [March 18, 2021, 1:09pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/1 "2021-03-18T13:09:37Z")

</div>

Hi,  
I’m testing on Oculus Quest 2 a small WebXR spline patch editor at [VR NURBS + THREEjs](https://www.ibiblio.org/e-notes/webxr/nurbs3xr.htm) and like to read/write JSON data (a few kb). Unfortunately, my simple test at [Send JSON test](https://www.ibiblio.org/e-notes/webxr/xhr.html) doesn’t work. Can I open a directory for writing or shall I use OpenSQL?

---

<div class="post-metadata">

**Author:** ![sarahwh](https://support.ibiblio.org/user_avatar/support.ibiblio.org/sarahwh/32/112_2.png) [@sarahwh](https://support.ibiblio.org/u/sarahwh)\
**Post date:** [March 23, 2021, 3:09pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/2 "2021-03-23T15:09:13Z")

</div>

Hello - I’m not sure what you’re asking here - can you provide more detail, including any error messages you are seeing.

---

<div class="post-metadata">

**Author:** ![demidov](https://support.ibiblio.org/user_avatar/support.ibiblio.org/demidov/32/43_2.png) [@demidov](https://support.ibiblio.org/u/demidov)\
**Post date:** [March 23, 2021, 5:30pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/3 "2021-03-23T17:30:04Z")

</div>

Hello Sara. Set e.g. “1” “1” at [Send JSON test](https://www.ibiblio.org/e-notes/webxr/xhr.html) and press “TestJSON”. I get in JS console  
POST [https://www.ibiblio.org/e-notes/webxr/json/json.php](https://www.ibiblio.org/e-notes/webxr/json/json.php) 500 (Internal Server Error)  
As I understand json.php can’t write files to the server? (sorry for cyrillic/greek comments 🙂

---

<div class="post-metadata">

**Author:** ![sarahwh](https://support.ibiblio.org/user_avatar/support.ibiblio.org/sarahwh/32/112_2.png) [@sarahwh](https://support.ibiblio.org/u/sarahwh)\
**Post date:** [March 23, 2021, 6:18pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/4 "2021-03-23T18:18:26Z")

</div>

I made some changes to the permissions of that directory - let me know if that works.

---

<div class="post-metadata">

**Author:** ![demidov](https://support.ibiblio.org/user_avatar/support.ibiblio.org/demidov/32/43_2.png) [@demidov](https://support.ibiblio.org/u/demidov)\
**Post date:** [March 24, 2021, 2:07pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/5 "2021-03-24T14:07:59Z")

</div>

I still have “500 (Internal Server Error)”.  
I think I have to learn PHP (or WordPress) more accurately.

---

<div class="post-metadata">

**Author:** ![sarahwh](https://support.ibiblio.org/user_avatar/support.ibiblio.org/sarahwh/32/112_2.png) [@sarahwh](https://support.ibiblio.org/u/sarahwh)\
**Post date:** [March 24, 2021, 3:27pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/6 "2021-03-24T15:27:33Z")

</div>

It looks like you have a syntax error in line 16 of that file.

---

<div class="post-metadata">

**Author:** ![demidov](https://support.ibiblio.org/user_avatar/support.ibiblio.org/demidov/32/43_2.png) [@demidov](https://support.ibiblio.org/u/demidov)\
**Post date:** [March 24, 2021, 5:37pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/7 "2021-03-24T17:37:24Z")

</div>

“It looks like you have a syntax error in line 16 of that file.”  
yes, I’ve corrected that.  
Maybe to write files by PHP we need to add ($\_SERVER[‘USER’])  
php-fpm07  
to the group users (somewhere)?

---

<div class="post-metadata">

**Author:** ![sarahwh](https://support.ibiblio.org/user_avatar/support.ibiblio.org/sarahwh/32/112_2.png) [@sarahwh](https://support.ibiblio.org/u/sarahwh)\
**Post date:** [March 25, 2021, 7:26pm UTC](https://support.ibiblio.org/t/write-files-by-php/270/8 "2021-03-25T19:26:24Z")

</div>

That change has been made - let us know if it’s working now.

---

<div class="post-metadata">

**Author:** ![demidov](https://support.ibiblio.org/user_avatar/support.ibiblio.org/demidov/32/43_2.png) [@demidov](https://support.ibiblio.org/u/demidov)\
**Post date:** [March 26, 2021, 3:56am UTC](https://support.ibiblio.org/t/write-files-by-php/270/9 "2021-03-26T03:56:02Z")

</div>

Thank You. Now it works as expected.
