<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022141" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022141</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136599</link>
    <description> &lt;p&gt;np. if you&#039;d like some help with posix, i know that to some degree (i&#039;ve done sys ad work) so i can try to guide you, but if you&#039;re not root, then it&#039;s moot. you&#039;d need your sys ad to do the stuff&lt;/p&gt;
&lt;p&gt;just an fyi, here&#039;s the section of the ini that deals with the gid:&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: ; By default, Safe Mode does a UID compare check when&lt;br /&gt;
; opening files. If you want to relax this to a GID compare,&lt;br /&gt;
; then turn on safe_mode_gid.&lt;br /&gt;
safe_mode_gid = Off&lt;/p&gt;&lt;/blockquote&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 20:04:19 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1136599 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136597</link>
    <description> &lt;p&gt;Thanks. For now I&#039;ll stick with this approach, because I know close to nothing about the setup and settings. And this works, &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;. &lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$uCatArray &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= array(\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;one\&quot;,\&quot;two\&quot;,\&quot;three\&quot;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$si&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = sizeof (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$uCatArray&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = ftp_connect(&#039;ftp.yoursite.com&#039;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = &#039;username&#039;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = &#039;password&#039;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$login_result&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = ftp_login(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;// check to make sure you&#039;re connected:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if ((!(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$login_result&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)) or (!(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; echo \&quot;no login\&quot;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;// create root folder&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$rootFolder&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=\&quot;sumFolder\&quot;; &lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = &#039;/var/www/html/anotherFolder/&#039;;&lt;br /&gt;&amp;nbsp; ftp_chdir(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt; echo \&quot;Current directory is now : \&quot;, ftp_pwd(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;), \&quot;\n\&quot;;&lt;br /&gt;&lt;br /&gt;if(ftp_mkdir(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$rootFolder&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)) print (\&quot;File is created!\&quot;); &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod_cmd&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=\&quot;CHMOD 0777 \&quot;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$rootFolder&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;; &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=ftp_site(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod_cmd&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// change to new folder&lt;br /&gt;ftp_chdir(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$rootFolder&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&lt;br /&gt;for (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=0;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$si&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;++){&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$newDir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; . &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$rootFolder&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; . \&quot;/\&quot; . &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$uCatArray&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;;&lt;br /&gt;&amp;nbsp; //ftp_chdir(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$dir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&lt;br /&gt;if(ftp_mkdir(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$newDir&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;)) print (\&quot;File is created!\&quot;); &lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod_cmd&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=\&quot;CHMOD 0777 \&quot;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$uCatArray&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$i&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;; &lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=ftp_site(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$chmod_cmd&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ftp_quit(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;); &lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 19:47:01 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1136597 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136594</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: &lt;em&gt;Originally posted by TonyMontana &lt;/em&gt;&lt;br /&gt;
&lt;strong&gt;&#039;if it&#039;s set to chec gid, then set the gid of the server and php to be the same. at this point it will be able to in safe mode&#039;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;m3rajk, can you explain exactly how to access and change those settings?&lt;/p&gt;
&lt;p&gt;TM &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt; /etc/php.ini (if you&#039;re on a posix box) has the php settings. make sure safe mode does gid checking as well as uid.&lt;/p&gt;
&lt;p&gt;if not, and you&#039;re not root, then youhave to talk to root for both things. &lt;/p&gt;
&lt;p&gt;root has to set groups. i believe they need to have the same primary group to automatically work right. that&#039;s inthe user/group mantainence&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 19:32:40 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1136594 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136590</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: &lt;em&gt;Originally posted by TonyMontana &lt;/em&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
  Actually the initial folder is created, with file permission 0777. It&#039;s the subdirectories within it that are not being made due to a limitation in SAFE MODE where the server takes ownership of the new folder, and restricts access to the php script which has a different uid.&lt;br /&gt;
 &lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Are you running PHP in cgi or as a module if it&#039;s as a module the first folder should be created with the user under under wich apache is running as the owner and the subfolder too. &lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: &lt;em&gt;Originally posted by TonyMontana &lt;/em&gt;&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;
SAFE MODE Restriction in effect. The script whose uid is 743 is not allowed to access ../rootFolder&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;after carefully checking the error message i am wondering if  .. in ../rootFolder is correct i don&#039;t see where it comes from in the script&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 19:19:48 +0000</pubDate>
 <dc:creator>druagord</dc:creator>
 <guid isPermaLink="false">comment 1136590 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136582</link>
    <description> &lt;p&gt;&#039;if it&#039;s set to chec gid, then set the gid of the server and php to be the same. at this point it will be able to in safe mode&#039;&lt;/p&gt;
&lt;p&gt;m3rajk, can you explain exactly how to access and change those settings?&lt;/p&gt;
&lt;p&gt;TM&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 18:52:05 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1136582 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136580</link>
    <description> &lt;p&gt;if other is set to rwx, then regaurdless of who OWNS the folder, everyone has complete access. i believe safemode only checks uid, and gid (optional)&lt;/p&gt;
&lt;p&gt;so there IS something you can do, if it&#039;s set to chec gid, then set the gid of the server and php to be the same. at this point it will be able to in safe mode&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 18:37:38 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1136580 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136576</link>
    <description> &lt;p&gt;&#039;it sounds like the issues is that it doesn&#039;t have permission, which means that the call to the folder when being created is setting permissions wrong&#039;&lt;/p&gt;
&lt;p&gt;  Actually the initial folder is created, with file permission 0777. It&#039;s the subdirectories within it that are not being made due to a limitation in SAFE MODE where the server takes ownership of the new folder, and restricts access to the php script which has a different uid.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;TM&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 18:08:49 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1136576 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136568</link>
    <description> &lt;p&gt;i agree with druagord here. it sounds like the issues is that it doesn&#039;t have permission, which means that the call to the folder when being created is setting permissions wrong. double check that it&#039;s being set to 777, or that the webserver has rwx (needs all three because you need r-x to read the folder and w to write to it. the other groups permissions are moot in this case)&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 17:37:49 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1136568 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136547</link>
    <description> &lt;p&gt;could you suply what the resulting permission from the first folder are. from what i see they should be 777 but the warning seems to say otherwise&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 12:57:10 +0000</pubDate>
 <dc:creator>druagord</dc:creator>
 <guid isPermaLink="false">comment 1136547 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/php-mkdir-and-permissions#comment-1136527</link>
    <description> &lt;p&gt;The only workaround I&#039;ve seen, without switching SAFE MODE off is conncting via ftp_connect(), which appears to work thus far, although it is a more clunky way of working.&lt;/p&gt;
&lt;p&gt;TM&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Aug 2003 08:07:36 +0000</pubDate>
 <dc:creator>TonyMontana</dc:creator>
 <guid isPermaLink="false">comment 1136527 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
