Announcement

Collapse
No announcement yet.

Syntax Error in init.php file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Syntax Error in init.php file

    Forum has been running smoothly for a long time and suddenly I get this error message a day ago.

    Parse error: syntax error, unexpected 'new' (T_NEW) in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 49

    I looked at the file to make sure that it wasnt modified. In fact, I checked all files on the server to see if there was any foul play. All files ok.

    This is line 49...

    // initialize the data registry
    $vbulletin =& new vB_Registry();


    What are the thoughts as to root cause of the sudden error.

    (BTW, I have received no messages from my server host about updates or changes recently. In fact, I am paying for the older versions of PHP.)
    vBulletin 3.8.2

  • #2
    What is your exact vBulletin version?
    What is your exact php version?

    This error usually comes from running a php version too high for vBulletin 3.8.
    MARK.B | vBULLETIN SUPPORT

    TalkNewsUK - My vBulletin 5.6.4 Demo
    AdminAmmo - My Cloud Demo

    Comment


    • #3
      Thanks for the reply. It is version 3.8.(?) I am not sure which minor version. It has been running so well, I have forgotten.

      I just checked the PHP and it was supposed to be at v.5.4 but it looks like it got switched to 7.4 I have just switched it back to see if that makes a difference.

      Now I get the following errors:


      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 49

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 101

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 105

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 113

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 124

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 128

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 136

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 205

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php on line 383

      Deprecated: Assigning the return value of new by reference is deprecated in /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/class_core.php on line 2552


      Unable to add cookies, header already sent.
      File: /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/init.php
      Line: 49
      vBulletin 3.8.2

      Comment


      • #4
        These are warnings, which should be turned off for a production server. Ask your host to do this.

        However, it would help to know exactly what version of vBulletin you are running as this is vital for us to advise on the best course of action.

        Ideally you should run vB 3.8.11 and then php 7.1.
        MARK.B | vBULLETIN SUPPORT

        TalkNewsUK - My vBulletin 5.6.4 Demo
        AdminAmmo - My Cloud Demo

        Comment


        • #5
          I am running vB 3.8.2
          Even if the messages are turned off, the forum is still not working. I am trying to find the exact versions of PHP and MySQL that should be used with 3.8.2

          I would like to get it running first, then immediately upgrade to 3.8.11, and then upgrading to vB5.
          vBulletin 3.8.2

          Comment


          • #6
            Originally posted by cmmguy View Post
            I am running vB 3.8.2
            Even if the messages are turned off, the forum is still not working. I am trying to find the exact versions of PHP and MySQL that should be used with 3.8.2

            I would like to get it running first, then immediately upgrade to 3.8.11, and then upgrading to vB5.
            You’re approaching that in the wrong order. You’ll end up chasing your tail for no good reason.

            Get php onto 7.1 (or if you have many third party add-ons maybe 5.6 might be better as add-ons have generally not been updated for later php versions by their authors).

            Then upgrade vBulletin to 3.8.11.

            It should then work. If not, post back with details.
            MARK.B | vBULLETIN SUPPORT

            TalkNewsUK - My vBulletin 5.6.4 Demo
            AdminAmmo - My Cloud Demo

            Comment


            • #7
              Trying to upgrade from 3.8.2 to 3.8.11 as suggested. Using php5.6
              Copied the upgrade folder after making all the changes to the new config.php file.

              Got the following error when trying to run Upgrade.php

              Database error in vBulletin :

              mysqli_real_connect() expects parameter 6 to be long, string given
              /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/class_core.php on line 1210

              MySQL Error :
              Error Number :
              Request Date : Sunday, August 1st 2021 @ 07:22:08 PM
              Error Date : Sunday, August 1st 2021 @ 07:22:08 PM
              Script : http://www.cmmguys.com/forum/install/upgrade.php
              Referrer :
              IP Address : IPADDRESS
              Username :
              Classname : vB_Database_MySQLi
              MySQL Version :
              Server : 74.208.10.35
              User Agent :

              vBulletin 3.8.2

              Comment


              • #8
                I will switch to php7.1 to see if that works.
                vBulletin 3.8.2

                Comment


                • #9
                  Same Error when executing Upgrade

                  Database error in vBulletin :

                  mysqli_real_connect() expects parameter 6 to be integer, string given
                  /homepages/20/d501325050/htdocs/cmmguys/httpdocs/forum/includes/class_core.php on line 1210

                  MySQL Error :
                  Error Number :
                  Request Date : Sunday, August 1st 2021 @ 08:11:19 PM
                  Error Date : Sunday, August 1st 2021 @ 08:11:19 PM
                  Script : http://www.cmmguys.com/forum/install/upgrade.php
                  Referrer :
                  IP Address : IPADDRESS
                  Username :
                  Classname : vB_Database_MySQLi
                  MySQL Version :
                  Server : 74.208.10.35
                  User Agent :

                  vBulletin 3.8.2

                  Comment


                  • #10
                    Please fill out a support ticket at:

                    http://members.vbulletin.com/members...ontactform.php

                    Please include a complete description of the problem and be sure to include the login info to your Admin CP, phpMyAdmin and FTP in the 'Sensitive Data' field.
                    Vote for:

                    - *Admin Settable Paid Subscription Reminder Timeframe*
                    -
                    *PM - Add ability to reply to originator only*
                    - Add Admin ability to auto-subscribe users to specific channel(s)
                    - "Quick Route" Interface...

                    Comment


                    • #11
                      Make sure the $config['MasterServer']['port'] value in the /includes/config.php file is a number. In most cases this should be 3306. It shouldn't have single quotes around it like other values.
                      Translations provided by Google.

                      Wayne Luke
                      The Rabid Badger - a vBulletin Cloud demonstration site.
                      vBulletin 5 API

                      Comment


                      • #12
                        Originally posted by Wayne Luke View Post
                        Make sure the $config['MasterServer']['port'] value in the /includes/config.php file is a number. In most cases this should be 3306. It shouldn't have single quotes around it like other values.
                        Oddly enough, my version 3.8.2 worked like this:

                        $config['MasterServer']['servername'] = 'localhost';
                        $config['MasterServer']['port'] = '/tmp/mysql5.sock';

                        But that was causing the problem as you can see above. Your comment made me look closer at the settings and I changed it to:

                        $config['MasterServer']['servername'] = 'localhost';
                        $config['MasterServer']['port'] = 3306;
                        //$config['MasterServer']['port'] = '/tmp/mysql5.sock';

                        and now the upgrade is running through its paces.

                        Unfortunately I could not close the forum BEFORE the upgrade because that was unavailable. I was going to rename the folder the forum resides in but was afraid that doing so might upset the upgrade gods. Seems to be going ok so far.
                        vBulletin 3.8.2

                        Comment


                        • #13
                          Just to close this up... The upgrade worked after changing the port from the old setting to 3306. Everything seems to be working ok now, but I havent poked around a lot.
                          Thanks for the help.

                          Just bought a new server and will be upgrading to 5.5 shortly. Thanks again.
                          vBulletin 3.8.2

                          Comment


                          • #14
                            The most likely cause it that you were using mysql classes in 3.8.2. The mysql classes were deprecated in PHP 5.5.0 and removed completely in 7.0.0. Due to this vBulletin 3.8.11 and 4.2.5 default to the mysqli classes. This variable was removed completely in later versions of vBulletin 5.X.

                            The method you were using previously shouldn't have worked. But I think the mysql classes combined host and port into a single string. Some bug must have allows localhost:/tmp/mysql5.sock to work. This would have been something outside of vBulletin since it doesn't have any means of verifying if the data is correct except by trying to connect to the database.

                            The mysqli classes use the servername and port as separate parameters in the database connection call. Like it should have been to begin with.
                            Last edited by Wayne Luke; Mon 2 Aug '21, 3:15pm.
                            Translations provided by Google.

                            Wayne Luke
                            The Rabid Badger - a vBulletin Cloud demonstration site.
                            vBulletin 5 API

                            Comment

                            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                            Working...
                            X