Forum Moderators: coopster

Message Too Old, No Replies

How to change writing rights for a config.php?

         

kentuckyslone

8:03 pm on May 29, 2005 (gmt 0)

10+ Year Member



I am in the process of installing a script (loginwa) and have been instructed to change the writing rights for the file "config.php" to "chmode 666"

I am using cPanel and I can see no way how to do this. Of course if I look at the config.php it is empty. Can anyone tell me how to change this setting?

David

kentuckyslone

8:49 pm on May 29, 2005 (gmt 0)

10+ Year Member



I changed thh permissions to "666" but when I go back to the install.php it shows chmodmsg_error="config.php is not writeable , set config.php to chmod 666 ";

According to the description of loginwa it is very simple easy and can be set up quick. If this is true then it makes me feel dumb for having this much trouble with it! Any suggestions as to what I might be doing wrong?

Blackie

9:09 pm on May 29, 2005 (gmt 0)

10+ Year Member



In your cpanel you go to File Manager, click on the config.php file and look to the right where "change permissions" is located.

kentuckyslone

9:23 pm on May 29, 2005 (gmt 0)

10+ Year Member



Thanks for the reply but I have already done that as noted in my previous post. I did finally figure out that was how to do that but even though I did I still see the error in the install file.

Also according to the instructions that came with loginwa it is very simple and easy to install and configure but I am having a very difficult time and as far as I can tell I followed the steps but when I try to log into the admin area it will not allow me.

When I created the MySQL db I named it but it shows differently than what I named it. That is I type in "name" but it shows as "account_name" however I tried entering it both ways in the install.php but it didnt make any difference

Here are the directions:

Un-pack all files from "loginwa_v1.zip" and download them onto your FTP-Server.
-> Change the writing rights for the file "config.php" to "chmode 666"
-> Open the file "install.php" and enter your access-data to your MySQL-Server.
DB Name: Database name.
DB User: User name for the access to your MySQL database.
DB Password: Password for the access to your MySQL database.
DB Host: MySQL Hostname.
-> Site setting
Site Name: Name of your page.
The Path to loginwa_v1: Enter the host-name to the
loginwa_v1 files, e.g. "http://www.mysite.com/loginwa_v1 (but without "/" at the end).
-> Admin setting:
Username: Enter an admin-user name for the access to the admin-area.
Password: Enter the admin password for the access to the admin-area.
Email: Enter the admin email-address.
-> After having successfully installed the programm, delete the files "install.php" and
"uninstall.php" from your server.
-> Log-in to the admin-area.

Blackie

10:20 pm on May 29, 2005 (gmt 0)

10+ Year Member



I miss the line where they instruct to chmod all the scripts to 755 in order to run them.

Another thing is their talking about "path". Usually when I see path I think of server path /home/user (C:\something on windows systems) and so on, but not about system URL, like www.domain.name
But this is pure guessing from my side.

Database name that you should use is of type accountname_databasename.

kentuckyslone

10:41 pm on May 29, 2005 (gmt 0)

10+ Year Member



Thanks I Really appreciate it. Here is a question..

Ok here is one entry that is in the install.php

if(empty($hostdb)){
$msg=" Error:DB Host is missing.";
$fontc=$red;
}

I am supposed to enter the host name here. But I am not sure exactly where to put it. I was putting it between the " " but I am now thinking that I was incorrect. Do you know where I am supposed to enter the info in this?

David

Blackie

6:16 am on May 30, 2005 (gmt 0)

10+ Year Member



I think when you run the install script it will create a variable $hostdb in the config.php file. So you do not have to enter anything into those lines with code, but this should work as it is, after the istall script is run.

kentuckyslone

6:12 pm on May 30, 2005 (gmt 0)

10+ Year Member



According to the instructions to install this script -

Open the file "install.php" and enter your access-data to your MySQL-Server.

The instructions (included above) tell you to enter the information for each but it does not state specifically where to enter the information.

Blackie

6:51 am on May 31, 2005 (gmt 0)

10+ Year Member



I would definetely look in the begining of the file.
It you post this install.php here we can look into it :-)

kentuckyslone

9:12 am on May 31, 2005 (gmt 0)

10+ Year Member



Ok, & thanks a lot for your time! I am quite a beginner when it comes to php. Copied below is the install.php:

<?php
$msg="Please fill the following fields completely:";
$tabform=true;
$tabend=false;
$red="#ff0000";
$black="#000000";
$fontc=$black;
$chmodmsg_error="config.php is not writeable , set config.php to chmod 666 ";
$log="<a href='admin/log_in.php'>login</a>";

$filename="config.php";
if($setup){

if(empty($namedb)){
$msg="Error:DB Name is missing.";
$fontc=$red;
}

if(empty($hostdb)){
$msg=" Error:DB Host is missing.";
$fontc=$red;
}

if(empty($userdb)){
$msg="Error: DB user is missing.";
$fontc=$red;
}

if(empty($passdb)){
$msg="Error: DB password is missing.";
$fontc=$red;
}

if(empty($namesite)){
$msg="Error: Site Name is missing.";
$fontc=$red;
}

if(empty($sitepath)){
$msg="Error: The Path is missing.";
$fontc=$red;
}

if(empty($nameuser)){
$msg="Error: Admin name is missing.";
$fontc=$red;
}
if(empty($passwd)){
$msg="Error: Admin password is missing.";
$fontc=$red;
}

if(empty($aemail)){
$msg="Error: Admin Email s missing.";
$fontc=$red;
}
else if(($userdb) AND ($namedb) AND ($passdb) AND($hostdb) AND($sitepath) AND($namesite) AND($passwd) AND($aemail) AND($nameuser)){
$t_user="\$dbuser = \"$userdb\";";
$t_name= "\$dbname = \"$namedb\";";
$t_pass="\$dbpass = \"$passdb\";";
$t_host="\$dbhost = \"$hostdb\";";
$s_host="\$host = \"$sitepath\";";
$a_site="\$mysite = \"$namesite\";";
$a_email="\$adminmail = \"$aemail\";";
$a_name=$nameuser;
$a_pass=$passwd;
$begin="<?php";
$end="?>";

if(!(is_writeable($filename))){

$msg=$chmodmsg_error;
$fontc=$red;
}else{
$datei=fopen($filename,"w");
}

}
if($datei){
$save=fputs($datei,"$begin\n$t_user\n$t_name\n$t_pass\n$t_host\n$s_host\n$a_site\n$a_email\n$end\n");
}

if($save){
fclose($datei);
$tabform=false;
$tabend=true;
$SuccMsg="the variables were saved to the File config.php, now click". " Create tables "."to install the tables";
}
}

if($create){
include("connect.php");
$create_table_admin=" CREATE TABLE loginwa_admin("
."adminid int(32) NOT NULL auto_increment,"
."adminname varchar(40) NOT NULL,"
."adminpass varchar(20) NOT NULL,"
."PRIMARY KEY (adminid))";

$admin_result=mysql_query($create_table_admin);

$create_table_usr="CREATE TABLE loginwa_user("
."userid int(32) NOT NULL auto_increment,"
."username varchar(20) NOT NULL,"
."fname varchar(40) NOT NULL,"
."lname varchar(40) NOT NULL,"
."passwd varchar(20) NOT NULL,"
."email varchar(150) NOT NULL,"
."fcode bigint(20) NOT NULL,"
."nl char(3) NOT NULL,"
."adddate date NOT NULL,"
."ustatus int(3) NOT NULL,"
."PRIMARY KEY (userid))";

$usr_result=mysql_query($create_table_usr);

if(($usr_result) && ($admin_result) ){
$sql_admin=mysql_query("INSERT INTO loginwa_admin(adminid,adminname,adminpass) VALUES('','$name_admin','$passwd_admin')");

$tabform=false;
$tabend=false;
$SuccMsg="CONGRATULATION loginwa_v1 was installted on Your Server successfuly\nNow you can"."$log"." into Admin-area.";
}else{
$tabform=false;
$tabend=false;
$SuccMsg="ERROR ";
}

}

?>
<html>
<head>
<title>loginwa_v.1 installation </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Stil1 {color: #FF0000}
-->
</style>
</head>

<body>
<table width="500" cellspacing="0" cellpadding="0" align="center">
<tr>
<th width="600" height="90" align="center" valign="top" scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="col"><table width="500" border="1" cellpadding="0" cellspacing="0" bordercolor="#0072BC">
<tr>
<th scope="col">
<?php if($tabform){?>
<form action="<?php echo"$PHP_SELF";?>" method="post"> <table width="500">
<tr bgcolor="#0072BC">
<th colspan="2" scope="col"><font color="<?php echo"$fontc"?>"><?php echo"$msg";?></font></th>
</tr>
<tr bgcolor="#0072BC">
<th colspan="2" scope="col">Data Base setting </th>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>DB Name<span class="Stil1">*</span> : </strong></td>
<td width="350" align="left" valign="top"><input name="namedb" type="text" size="32" value="<?php echo"$namedb";?>" ></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>DB Host<span class="Stil1">*</span>:</strong></td>
<td width="350" align="left" valign="top"><input name="hostdb" type="text" value="localhost" size="32"></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>DB User<span class="Stil1">*</span> :</strong></td>
<td width="350" align="left" valign="top"><input name="userdb" type="text" size="32" value="<?php echo"$userdb";?>"></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>DB Password<span class="Stil1">*</span> :</strong></td>
<td width="350" align="left" valign="top"><input name="passdb" type="text" size="32" value="<?php echo"$passdb";?>" ></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr align="center" bgcolor="#0072BC">
<td colspan="2"><strong> Site setting </strong></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>Site Name<span class="Stil1">*</span> :</strong></td>
<td width="350" align="left" valign="top"><input name="namesite" type="text" value="mysite.com" size="32"></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>Path to loginwa_v1<span class="Stil1">*</span> :</strong></td>
<td width="350" align="left" valign="top"><input name="sitepath" type="text" value="http://www.mysite.com/loginwa_v1" size="32"> </td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr align="center" bgcolor="#0072BC">
<td colspan="2"><strong>Admin setting </strong></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>userame<span class="Stil1">*</span> :</strong></td>
<td width="350" align="left" valign="top"><input name="nameuser" type="text" size="32" value="<?php echo"$nameuser"?>"></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>password</strong><strong><span class="Stil1">*</span></strong>:</td>
<td width="350" align="left" valign="top"><input name="passwd" type="text" size="32" value="<?php echo"$passwd"?>"></td>
</tr>
<tr>
<td width="150" align="right" valign="top"><strong>Email<span class="Stil1">*</span>:</strong></td>
<td width="350" align="left" valign="top"><input name="aemail" type="text" value="admin@mysite.com" size="32"></td>
</tr>
<tr align="center">
<td colspan="2"><input name="setup" type="submit" value="install">
</td>
</tr>
</table>
</form>
<?php }?></th>
</tr>
</table></th>
</tr>
<tr>
<th scope="col">
<table width="500" border="1" cellpadding="0" cellspacing="0" bordercolor="#0072BC">
<tr>
<th scope="col">
<form action="<?php echo"$PHP_SELF";?>" method="post">
<input name="passwd_admin" type="hidden" value="<?php echo"$a_pass ";?>">
<input name="name_admin" type="hidden" value="<?php echo"$a_name";?>">
<table width="500">
<tr>
<th align="center" scope="col"><?php echo"$SuccMsg";?></th>
</tr>
<?php if($tabend){?>
<tr>
<td align="center"><input name="create" type="submit" value="Create Tables"></td>
</tr>
<?php }?>
</table>
</form></th>
</tr>
</table>
</th>
</tr>
</table>
</body>
</html>

kentuckyslone

9:14 am on May 31, 2005 (gmt 0)

10+ Year Member



This is the included instructions with the loginwa script:

-> Un-pack all files from "loginwa_v1.zip" and download them onto your FTP-Server.
-> Change the writing rights for the file "config.php" to "chmode 666"
-> Open the file "install.php" and enter your access-data to your MySQL-Server.
DB Name: Database name.
DB User: User name for the access to your MySQL database.
DB Password: Password for the access to your MySQL database.
DB Host: MySQL Hostname.
-> Site setting
Site Name: Name of your page.
The Path to loginwa_v1: Enter the host-name to the
loginwa_v1 files, e.g. "http://www.mysite.com/loginwa_v1 (but without "/" at the end).
-> Admin setting:
Username: Enter an admin-user name for the access to the admin-area.
Password: Enter the admin password for the access to the admin-area.
Email: Enter the admin email-address.
-> After having successfully installed the programm, delete the files "install.php" and
"uninstall.php" from your server.

Blackie

10:03 am on May 31, 2005 (gmt 0)

10+ Year Member



This looks pretty good. The installation file should create config.php for you as soon as the permissions is set.

If you are seeing this mesage "config.php is not writeable , set config.php to chmod 666" produced by these lines

if(!(is_writeable($filename))){

$msg=$chmodmsg_error;
$fontc=$red;
}else{
$datei=fopen($filename,"w");
}

then the script cannot access the file config.php.

Please check if the file really has permissions
rwxrwxrwx (777) or rw-rw-rw- (666).

Check also if the install.php and config.php are in the same folder. If not, the folders on the way to config.php should also have execute permissions.

kentuckyslone

10:27 am on May 31, 2005 (gmt 0)

10+ Year Member



install.php and config.php are in the same folder

In cPanel when I click on "change permissions" for the config.php it shows rw-rw-rw- 666

When I first uploaded these file it was set at 644 and I changed it.

Blackie

10:40 am on May 31, 2005 (gmt 0)

10+ Year Member



Try to apply 777 to the config.php to see if this helps (meybe you have some strict server configuration)...
I'll soon be out of tips :-)

kentuckyslone

10:57 am on May 31, 2005 (gmt 0)

10+ Year Member



I changed the permission to 777 in cPanel

It still says $chmodmsg_error="config.php is not writeable , set config.php to chmod 666 "; near the top of the file but I dont think that is actually an error message.

When the instructions say:

-> Change the writing rights for the file "config.php" to "chmode 666"
-> Open the file "install.php" and enter your access-data to your MySQL-Server.
DB Name: Database name.
DB User: User name for the access to your MySQL database.
DB Password: Password for the access to your MySQL database.
DB Host: MySQL Hostname.
-> Site setting
Site Name: Name of your page.
The Path to loginwa_v1: Enter the host-name to the
loginwa_v1 files, e.g. "http://www.mysite.com/loginwa_v1 (but without "/" at the end).

Where do I enter the access data in the the install.config? I think that might really be my problem. I just dont know where in the install file that I am supposed to enter the data and the instructions seem unclear on that.

Thanks again I appreciate your efforts on this!

Blackie

12:24 pm on May 31, 2005 (gmt 0)

10+ Year Member



Oh... this strikes me now ;-)
Have you tryed accessing
[mysite.com...] through your browser? ;-)

kentuckyslone

1:00 pm on May 31, 2005 (gmt 0)

10+ Year Member



THANKS A LOT! Like an idiot I have been thinking that I needed to open the install in "edit file" and make the changes there! I do have the url open as you suggested but havent entered the data yet. I am sure this is the answer that I needed and i cant tell you how dumb I now feel - that is how dumb I did feel but now I have learned something thanks to you

David

Blackie

12:45 pm on Jun 1, 2005 (gmt 0)

10+ Year Member



We learn as we go David. And everyone has been there :-)

Have a nice day,
Blackie