Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: please advice

  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    please advice

    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 Code:
    <?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.

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    1) which is line 311?

    2) if $n_servr is a string variable then

    PHP Code:
    $cfg['FRaqars_db_Host'] = "$n_servr"
    should probably be
    PHP Code:
     
    $cfg
    ['FRaqars_db_Host'] = $n_servr
    and the same with the other lines.

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by webdev1958 View Post
    1) which is line 311?

    2) if $n_servr is a string variable then

    PHP Code:
    $cfg['FRaqars_db_Host'] = "$n_servr"
    should probably be
    PHP Code:
     
    $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??

  • #4
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    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?

  • #5
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by webdev1958 View Post
    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
    Attached Files Attached Files

  • #6
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    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.

  • #7
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why it takes so much time?
    social Media

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,426
    Thanks
    62
    Thanked 535 Times in 522 Posts
    Quote Originally Posted by ayas80 View Post
    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 Code:
    <?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.
    Last edited by tangoforce; 03-02-2012 at 12:54 PM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #9
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tangoforce View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •