Jump to content

cant create file were i want


mike12255

Recommended Posts

so i want to have to places on my site an admin folder and the main site so im creating the admin folder with mkdir however it keeps creating the folder in the install folder i have tried ../ and ././ methods. Also i dont know were this is going but i have it creating a config.php file that is suposed to go in the main site and admin folder however its not appearing at all. The install folder is a folder of the main site. so its not a folder inside a folder or anything.

 

here is my code:

<?php
$config = "<?php 

// database connection config
\$dbHost =  '$db';
\$dbUser = '$dbuser';
\$dbPass = '$dbpass';
\$dbName = '$dbname';
\$bid = '$bid';


\$dbConn = mysql_connect (\$dbHost, \$dbUser, \$dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db(\$dbName) or die('Cannot select database. ' . mysql_error());




?>";
   //create and open and create the config file
$fn = "././config.php";
$fn2 = "././admin/config.php";

$fh = fopen($fn ,'w') or die("can't open file");
//write in into the config file
$fh = fwrite($fh,$config);
//close it to open the admin config file
//fclose($fh);
//open the admin config file
$fh2 = fopen($fn2 ,'w') or die("can't open file");
//write into the admin config file
fwrite($fh2, $config);
//close the admin config file
//fclose($fn);

?>

 

 

can anyone help me with this issue?

Link to comment
https://forums.phpfreaks.com/topic/174934-cant-create-file-were-i-want/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.