Can someone tell me what's wrong with this config file?

18 replies
I am getting this error when I go to my site:
Parse error: syntax error, unexpected '=', expecting ',' or ';' in /home/tim/public_html/includes/config.inc on line 3

Here is the config.inc file:

global $_cn;
global $dbserver = "localhost";
global $db = "articles";
global $dbuser = "tim";
global $dbpass = "Mckenzie1";

Any help would be greatly appreciated.
#config #file #wrong
  • Profile picture of the author AndyBlackSEO
    You haven't assigned the top line (variable) to anything. ie - global $_cn = "something here";
    Signature
    [FREE SEO TOOL] Build 29 Effective, High Authority Backlinks that Will Increase Your Google Rankings in 2020... CLICK HERE ...
    ... Instant backlinks that can get you results within 24-72hrs.
    {{ DiscussionBoard.errors[1995953].message }}
    • Profile picture of the author Luke Graham
      You are not using them correctly;

      you should not declare it as;

      global $var = 'value';

      What are you trying to achieve? In most cases there is no need for global variables.
      Signature
      Best Ways To Make Money Online

      Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
      “Yeah,” reply the bytes. “Make us a double.”
      {{ DiscussionBoard.errors[1995977].message }}
      • Profile picture of the author tjs1954
        It's an article site with about 25,000 articles. I already got the first steps below done and I'm following the editing instructions as printed but I still get the error.

        Prepare Your Database

        Open MySQLUsing cPanel start by clicking the MySQL Databases Icon.. Once Inside:
        STEP 1 Create an empty MySQL database: c/panel username_articles

        STEP 2 Create a username c/panel username_robo /


        STEP 3 Create a password for the database accountpassword (do not use your c/panel accountpassword ok, use something different.

        STEP 4 Assign this user to database you created in step 1


        Populate Your Database

        STEP 1 Go to Phpmyadmin at the bottom of your database menu above and select your database from left side menu. Then click SQL to open a SQL Box

        STEP 2 Open the ARTICLE.sql which is located in the same setup-instructions folder you are reading this tutorial in, into a text editor (such as notepad or editPlus)
        Copy and paste all of its content into the SQL box OR you may also upload this database via the upload function.

        STEP 3 Now your database is fully created and ready to use with default categories and the admin login.



        Prepare your files

        Rebrand the main logo
        Open top.gif in the images folder and change logo to your own .com name with Paint or Photo shop.


        STEP 1 Open the includes/config.inc file into a text editor (such as notepad or editPlus)

        STEP 2 Edit the file to match the user information you created above in the "Populate Your Database" Step1
        your_database
        your_user
        youruserpass

        You will need to edit the information in "Quotes" on line's 10,11 & 12

        STEP 3 Open the file /articles/bigdump.php file into a text editor.
        As in the file above change the section that looks like:


        $db_server = "localhost";
        $db_name = "";
        $db_username = "";
        $db_password = "";


        With the database information just as you did above.

        (You wont need to do this step 3, as step 3 takes the information it needs from the config.php file. This way works on most servers. If you get an error, then do what step 3 says ok, but in most cases you wont need to.



        Step 4. In the bigdump file in the articles folder, look for the following lines of text: They are about a third of the way down the page.



        $upload_dir="/home/articlel/public_html/articles";

        //$upload_dir=http://64.21.46.58/~articlel/public_html/articles



        1.... Change the word article1 on both lines to your cpanel username
        {{ DiscussionBoard.errors[1996105].message }}
        • Profile picture of the author Luke Graham
          Originally Posted by tjs1954 View Post

          It's an article site with about 25,000 articles. I already got the first steps below done and I'm following the editing instructions as printed but I still get the error.
          Which article software is it? Its hard to say how to fix it, but the error is occuring because of the values being specified on the global variables.....

          You might be able to get away with removing the "global" part in config.inc, but it really does depend how they are intending to use them later on. Its worth a try, at least. Be sure to keep of backup before changing anything however.

          If you paid for the script, get in contact with the developer.
          Signature
          Best Ways To Make Money Online

          Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
          “Yeah,” reply the bytes. “Make us a double.”
          {{ DiscussionBoard.errors[1996136].message }}
          • Profile picture of the author tjs1954
            Originally Posted by Luke Graham View Post

            Which article software is it? Its hard to say how to fix it, but the error is occuring because of the values being specified on the global variables.....

            You might be able to get away with removing the "global" part in config.inc, but it really does depend how they are intending to use them later on. Its worth a try, at least. Be sure to keep of backup before changing anything however.

            If you paid for the script, get in contact with the developer.
            I e-mailed the developer but no reply yet, I'll try taking the one line out like you said.
            {{ DiscussionBoard.errors[1996166].message }}
            • Profile picture of the author Luke Graham
              Originally Posted by tjs1954 View Post

              I e-mailed the developer but no reply yet, I'll try taking the one line out like you said.
              You will most likely need to remove any reference too global in that file where a value is also specified.

              You can always add them back in afterwards should you need too.
              Signature
              Best Ways To Make Money Online

              Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
              “Yeah,” reply the bytes. “Make us a double.”
              {{ DiscussionBoard.errors[1996182].message }}
              • Profile picture of the author tjs1954
                I deleted this line, global $_cn;
                but no luck so I put it back.
                {{ DiscussionBoard.errors[1996190].message }}
                • Profile picture of the author Luke Graham
                  Originally Posted by tjs1954 View Post

                  I deleted this line, global ;
                  but no luck so I put it back.
                  That line is fine.

                  The problem is where you have

                  global $variable = 'some value';

                  These lines will give you errors. If anything, they shuold be written as

                  $variable = 'some value';
                  Signature
                  Best Ways To Make Money Online

                  Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
                  “Yeah,” reply the bytes. “Make us a double.”
                  {{ DiscussionBoard.errors[1996202].message }}
        • Profile picture of the author jminkler
          Originally Posted by tjs1954 View Post


          $db_server = "localhost";
          $db_name = "";
          $db_username = "";
          $db_password = "";
          Remove the global declarations?
          {{ DiscussionBoard.errors[1997018].message }}
          • Profile picture of the author tjs1954
            Originally Posted by jminkler View Post

            Remove the global declarations?
            I think I'm in over my head here, what are the global declarations? Just take the word "global" out?
            {{ DiscussionBoard.errors[1997156].message }}
            • Profile picture of the author Jeremy Morgan
              Do a "find in files" type search, (you can do this in Notepad++, Visual Studio and many other tools) and search for that variable and see how it's being used throughout the software. See if there is a default assignment that might work.

              Also, I hope that database info you just posted is fake. If that's really what's in your config file you need to change it NOW.
              Signature
              Jeremy Morgan, Software Developer / SEO
              Check out my Programming Blog for news, tips, and tutorials
              {{ DiscussionBoard.errors[1997359].message }}
  • Profile picture of the author davidsbain
    Can you please cut and paste the whole config.inc ? or is this all you have inside the file ? The instructions tells you to edit the data on lines 10, 11 and 12 but your error is on line 3. I am just wondering if there is a line 10,11 and 12 ?

    when you enter values for your server, user name etc you are declaring values. If you add the word 'global' then you are declaring these values as a global value to be used everywhere on all parts of your code. so by removing the word 'global' then the declaration of values become local to the code you are running.
    {{ DiscussionBoard.errors[1997380].message }}
  • Profile picture of the author tjs1954
    Jeremy,

    That info is temporary while I just try to get it working, I will be changing it.


    David, that's all that's in the file, I deleted the DB and am creating another one in cPanel now. I will see if I can get it working. I may just get p*#%ed enough to pay someone to fix it.
    {{ DiscussionBoard.errors[1997488].message }}
    • Profile picture of the author tjs1954
      Here is the config.inc and the articles/bigdump.php, I don't know if it makes sense or not. The database is empty right now.

      <?
      $_cn;
      $dbserver="localhost";
      $db="tim_articles";
      $dbuser="tjs1954";
      $dbpass=="Mckenzie1";


      include( "dbinfo.inc" );

      $connect = mysql_connect($dbserver, $dbuser, $dbpass) or die("Couldn't connect to MySQL");
      mysql_select_db($database_connect, $connect);


      ?>

      ___________________________________________
      articles/bigdump.php

      // Database configuration

      include( "../includes/dbinfo.inc" );

      $db_server = $dbserver="localhost";
      $db_name = $database_connect="tim_articles";
      $db_username = $dbuser="tim_tjs1954";
      $db_password = $dbpass="Mckenzie1";


      // Other Settings

      $filename = ""; // Specify the dump filename to suppress the file selection dialog
      $linespersession = 3000; // Lines to be executed per one import session
      $delaypersession = 0; // You can specify a sleep time in milliseconds after each session
      // Works only if JavaScript is activated. Use to reduce server overrun

      // Handle file upload

      // $upload_dir=dirname($_SERVER["SCRIPT_FILENAME"]);
      $upload_dir="/home/tim/public_html/articles";
      //$upload_dir="http://68.56.206.121/tim/public_html/articles"
      {{ DiscussionBoard.errors[1997633].message }}
      • Profile picture of the author tjs1954
        I'm making progress, I am able to get the admin page up and log in, I can see the program from there but when I go to my URL I still get:

        Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'psyc413_robo'@'localhost' (using password: YES) in /home/tim/public_html/includes/config.inc on line 11
        Couldn't connect to MySQL
        {{ DiscussionBoard.errors[1997843].message }}
        • Profile picture of the author Luke Graham
          Originally Posted by tjs1954 View Post

          Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'psyc413_robo'@'localhost' (using password: YES) in /home/tim/public_html/includes/config.inc on line 11
          Couldn't connect to MySQL
          Are you using the correct username and password? The error is indicating that you arent. You can see the username it is using in the error message, does it match have you have in your config file?

          Double check your password too.
          Signature
          Best Ways To Make Money Online

          Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
          “Yeah,” reply the bytes. “Make us a double.”
          {{ DiscussionBoard.errors[1998933].message }}
          • Profile picture of the author tjs1954
            Originally Posted by Luke Graham View Post

            Are you using the correct username and password? The error is indicating that you arent. You can see the username it is using in the error message, does it match have you have in your config file?

            Double check your password too.
            The user and password I use is the one I set up when I created the database in cPanel, I have the correct one in the config.inc file, I don't know where it is getting that information.
            {{ DiscussionBoard.errors[1999595].message }}
            • Profile picture of the author tjs1954
              Finally got it fixed, thanks for everyones help!:rolleyes:
              {{ DiscussionBoard.errors[2003261].message }}

Trending Topics