Welcome Guest, Not a member yet? Register   Sign In
Server in Safemode
#1

[eluser]Shahgeb[/eluser]
<?php
function createdirectory($date_dir, $city_dir){

locally
$root = ‘E_Paper’;
if(!is_dir($root.’/’.$date_dir))
mkdir(”$root.’/’.$date_dir”, 0777); <==== works fine
if(!is_dir($root.’/’.$date_dir.’/’.$city_dir))
mkdir($root.’/’.$date_dir.’/’.$city_dir, 0777); <==== works fine
?&gt;

live at server
&lt;?php
mkdir(”/var/www/html/dotproject/$root.’/’.$date_dir”, 0777”, 0777); <===== fails
mkdir(”/var/www/html/dotproject/$root.’/’.$date_dir.’/’.$city_dir”, 0777); <===== fails
?&gt;
}
Is there any issue at server end which is running in safemode?
any help would be appreciated
#2

[eluser]TheFuzzy0ne[/eluser]
I wouldn't have thought safemode would affect making directories.

The problem is your last two lines of code.
Code:
mkdir("/var/www/html/dotproject/$root.'/'.$date_dir", 0777", 0777);
mkdir("/var/www/html/dotproject/$root.'/'.$date_dir.'/'.$city_dir", 0777);

They should work if they were written like this:
Code:
mkdir("/var/www/html/dotproject/$root/$date_dir", 0777, 0777);
mkdir("/var/www/html/dotproject/$root/$date_dir/$city_dir", 0777);
The code above is untested

You are using concatenation, but in such a way that nothing is actually concatenated, because the concatenation code is within quotes.

Hope this helps.




Theme © iAndrew 2016 - Forum software by © MyBB