...

View Full Version : please advice



ayas80
03-02-2012, 05:20 AM
I am currently trying to install my script on WAMP server but i have faced the following error:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in C:\wamp\www\inv2\install\index.php on line 311

and here is the code for the config file:


<?php

\$cfg['FRaqars_db_Host'] = "$n_servr"; // your database hostname
\$cfg['FRaqars_db_User'] = "$u_db"; // your database username
\$cfg['FRaqars_db_Pass'] = "$ps_db"; // your database password
\$cfg['FRaqars_db_Name'] = "$n_db"; // your database name

\$sitePATH="$s_path";
\$siteURL="$s_url";

\$CoockeSite = "$s_url";
\$ADMINFOLDER="$setup_admin_folder";
\$ADMINHOMEPG="index.php";

?>


Many thanx in advance.

webdev1958
03-02-2012, 05:49 AM
1) which is line 311?

2) if $n_servr is a string variable then



$cfg['FRaqars_db_Host'] = "$n_servr";
should probably be



$cfg['FRaqars_db_Host'] = $n_servr;

and the same with the other lines.

ayas80
03-02-2012, 06:24 AM
1) which is line 311?

2) if $n_servr is a string variable then



$cfg['FRaqars_db_Host'] = "$n_servr";
should probably be



$cfg['FRaqars_db_Host'] = $n_servr;

and the same with the other lines.


Yeh 311 is \$cfg['FRaqars_db_Host'] = "$n_servr";

I changed it according to your correction but still wont working??

webdev1958
03-02-2012, 06:49 AM
Is the $cfg array defined before you assign elements to it?

If $n_server is a variable, what is the output when you echo $n_server before assigning it to anything?

ayas80
03-02-2012, 07:17 AM
Is the $cfg array defined before you assign elements to it?

If $n_server is a variable, what is the output when you echo $n_server before assigning it to anything?

Many thanx for your prompt reply..I attached the full install file cause the text exceed the limit kindly take a look :thumbsup:

webdev1958
03-02-2012, 07:51 AM
If the text exceeded the posting limit then there is too much code for me to spend "free" time looking at.

If you wrote the code, then it should take you only a minute or so to post the answers to the questions I asked.

genzwebsolut10
03-02-2012, 10:57 AM
why it takes so much time?
social Media (http://www.genzwebsolutions.com.au/)

tangoforce
03-02-2012, 12:51 PM
I am currently trying to install my script on WAMP server but i have faced the following error:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in C:\wamp\www\inv2\install\index.php on line 311

and here is the code for the config file:


<?php

\$cfg['FRaqars_db_Host'] = "$n_servr"; // your database hostname
\$cfg['FRaqars_db_User'] = "$u_db"; // your database username
\$cfg['FRaqars_db_Pass'] = "$ps_db"; // your database password
\$cfg['FRaqars_db_Name'] = "$n_db"; // your database name

\$sitePATH="$s_path";
\$siteURL="$s_url";

\$CoockeSite = "$s_url";
\$ADMINFOLDER="$setup_admin_folder";
\$ADMINHOMEPG="index.php";

?>


Many thanx in advance.

There is nothing wrong with that code. What is wrong with it is what you've done with it (and what you failed to mention):



$varbl_content = <<< HTM
<?php'.
/**
* معلومات قاعدة البيانات وروابط الموقع
*/
\$cfg['FRaqars_db_Host'] = "$n_servr"; // your database hostname
\$cfg['FRaqars_db_User'] = "$u_db"; // your database username
\$cfg['FRaqars_db_Pass'] = "$ps_db"; // your database password
\$cfg['FRaqars_db_Name'] = "$n_db"; // your database name

\$sitePATH="$s_path";
\$siteURL="$s_url";

\$CoockeSite = "$s_url";
\$ADMINFOLDER="$setup_admin_folder";
\$ADMINHOMEPG="index.php";

?>
HTM;


I have no idea what you're trying to do there but if you're putting that code into a variable and hoping to run it through eval() then it won't run - right after <?php you have ' and . That is not valid php syntax. Then you have \ on each new line.

Why didn't you post this code properly the first time round?

Additionally, if memory serves, you can't have opening and closing <?php ?> tags inside a heredoc (thats the <<< HTM technique) as php is still parsing everything inside it - that means it will screw it over. What you need to use is a nowdoc (supported from v5.3.0) which is:
<<< 'HTM'

That will make php treat it literally instead of parsing it.

ayas80
03-03-2012, 01:33 AM
There is nothing wrong with that code. What is wrong with it is what you've done with it (and what you failed to mention):



I have no idea what you're trying to do there but if you're putting that code into a variable and hoping to run it through eval() then it won't run - right after <?php you have ' and . That is not valid php syntax. Then you have \ on each new line.

Why didn't you post this code properly the first time round?

Additionally, if memory serves, you can't have opening and closing <?php ?> tags inside a heredoc (thats the <<< HTM technique) as php is still parsing everything inside it - that means it will screw it over. What you need to use is a nowdoc (supported from v5.3.0) which is:
<<< 'HTM'

That will make php treat it literally instead of parsing it.

actually i don't have any idea :)
i get the script from somebody it was working properly on my lenux web-server and on appache local-server as well without any problem, but i need to install the script on WAMP server and it's wont working there and always give me Parse error: syntax error, unexpected T_VARIABLE on line 313 i don't know why ???

please advice :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum