# Creating subfolders with PHP fopen()

**URL:** <https://forum.kirupa.com/t/creating-subfolders-with-php-fopen/83209>\
**Category:** programming\
**Created:** [March 16, 2005, 9:46pm UTC](https://forum.kirupa.com/t/creating-subfolders-with-php-fopen/83209 "2005-03-16T21:46:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nightshade](https://avatars.discourse-cdn.com/v4/letter/n/41988e/32.png) [@nightshade](https://forum.kirupa.com/u/nightshade)\
**Post date:** [March 16, 2005, 9:46pm UTC](https://forum.kirupa.com/t/creating-subfolders-with-php-fopen/83209/1 "2005-03-16T21:46:49Z")

</div>

Hi,

i am using the fopen() command to create a new php doc:

[size=1][size=2]$handle = fopen("$docName.php", “w+”);[/size][/size]  
[size=1][size=2][/size][/size]  
[size=1][size=2]this is all well and good (working) but i also want to create a new subfolder aswell, but i dont know how to. i hav tried:[/size][/size]  
[size=1][size=2][/size][/size]  
[size=1][size=2]$handle = fopen("$folder/$docName.php", “w+”);[/size][/size]  
[size=1][size=2][/size][/size]  
[size=1][size=2]but i just get error messages.[/size][/size]  
[size=1][size=2][/size][/size]  
[size=1][size=2]Anyone know how to do this?[/size]  
[size=1][size=2][/size]  
[/size][/size]
