We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2297
    • 31 Posts
    (Please see my 4th post in this thread for what I did to finally get an import.)

    I’m working on porting an existing site to MODx and moving it to a new server with a new domain name. I installed a test server on my machine and set up the template. Now it’s a matter of cutting and pasting the existing pages into the new template and FTPing all the downloadable files to the new server. This is a genealogy society site with lots of pages and lots of files, so I’d like to try to FTP all the files from server to server, without a stop in between on my machine (am thinking CyberDuck will let me do that). And as it’s going to take a long time to cut and paste all the existing content, I’d like to just paste everything directly into the templates on the new server.*

    I had wanted to move the existing dev site to the new server, but I can’t get past exporting the DB so far. I’ve set up a new DB on the hosting server, and I’ve created a DB user and granted all privileges. But when I try to import the DB, I get the following:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w’ at line 1


    I have tried exporting via phpMyAdmin and also by using the Backup option in the MODx manager. Still no dice. As my MAMP installation is using MySQL client version: 5.0.41, and the hosting server is using MySQL client version: 4.1.22, I have tried exporting using the MySQL compatibility mode of MYSQL40 (also tried MYSQL323 and None). And I have no idea whether the client version of MySQL even matters, as the server version on both is 5x.

    I know I could just start with a fresh install on the hosting server and paste in all the templates and content, but I’d really like to be able to move a site, because I’m using this as a learning opportunity. (And at the moment, it’s feeling as if it’s full of opportunity!)

    From the error message, it sounds as if there may be a problem with the doctype I’m using, but I can’t figure out what it is. I copied the doctype directly from the W3C example and it still did the same thing. I also tried adding a language declaration, which isn’t in the W3C example. Both validate XHTML 1.0 Transitional, but both also throw the same error on DB export. Besides, I can’t figure out why the doctype in a template would make any difference in DB tables (which probably illustrates that I know less than nothing about DBs.)


    Here’s my dev setup:
    MAMP on OS X 10.5.7; MODx 9.6.3
    Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2
    PHP 5.2.6
    localhost
    * Server version: 5.0.41
    * Protocol version: 10
    * Server: Localhost via UNIX socket
    * MySQL charset: UTF-8 Unicode (utf8)
    phpMyAdmin - 2.11.7.1
    * MySQL client version: 5.0.41
    * Used PHP extensions: mysql

    And the available info on the hosting server:

    localhost:
    # Server version: 5.0.67-community
    # Protocol version: 10
    # Server: Localhost via UNIX socket
    MySQL charset: UTF-8 Unicode (utf8)

    phpMyAdmin - 2.11.9.4
    * MySQL client version: 4.1.22
    * Used PHP extensions: mysql

    Other PHP config info:
    register_globals: Off
    safe_mode: Off
    phpsuexec
    zend_optimizer.version: 3.3.3


    Any help would be greatly appreciated. I’ve spent most of the day on this, and am stumped.


    *(I know this is not standard practice, but I’m doing this as a volunteer, there’s no deadline, and the existing site will still be up in the meantime under the old URL. I’ve also been singing the praises of MODx to the person who built the old site, and telling her how easy she’ll find it to update when it’s in MODx instead of static HTML. But she needs to be able to see what I’ve been talking about, so I want to get something live for her ASAP.)
      • 22303 MODX Staff
      • 10,725 Posts
      The server’s MySQL config looks really bad TBH; the fact that your MySQL server is 5.0.x while the MySQL client API is 4.1.22 is tell-tale.
        • 2297
        • 31 Posts

        Thanks for your response. I’ll email tech support and see if they can suggest a way to increase the compatibility. It’s strange, because I have a MODx site running with that hosting provider and have not had any problems. But I started that install from scratch rather than as an import of an existing one. We’ll see what they say. Thanks again smiley
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Depending on which version your export was done on, there could well be incompatibilities between the two versions.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 2297
            • 31 Posts
            Hi, thanks for your message. I decided to try to import into a new database on my own machine before logging a tech support ticket, and I’m having the same problem, so I don’t think it’s compatibility issues between the SQL versions.

            I created a new database via phpMyAdmin. I purposely did not specify a collation, and it defaulted to latin1_swedish_ci (which is what the database I’m trying to export is as well, since I did not know to specify a collation when I first created it.)

            I tried an import using a new backup file from the MODx manager first, and here is the error I got:

            There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

            ERROR: Unknown Punctuation String @ 231
            STR: </

            I’m assuming that means line 231 from the line which begins with "SQL:" so here’s what starts on line 231:

            html, body, form, fieldset {
            margin: 0;<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
            <head>
            <title>MODx CMF Manager Login</title>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
            <meta name="robots" content="noindex, nofollow" />

            I can’t see any difference in that code and the several bits around it. Maybe my mind is just not working. It wouldn’t be the first time!

            Next, I tried exporting the existing database via phpMyAdmin and importing it into the new test database. This is the error:

            #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w’ at line 1

            As I mentioned previously, I do have another MODx installation on my hosting server. So I tried creating a new database on the server, exporting the existing one via phpMyAdmin, and importing it into the new database. I got this error:

            #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w’ at line 1

            I’m thinking that rules out compatibility between versions, as both of those databases were created on the same server via the same method.

            I had begun to wonder if maybe the first database I was trying to import was corrupted, but the fact that I’m getting the same error through phpMyAdmin on two separate servers, with two separate MODx databases, indicates to me that I’m doing something wrong in either the export, or the import, or both. I am deliberately leaving all the options in phpMyAdmin at their defaults, apart from "Select All" for the tables when exporting.

            When backing up from the MODx manager, I am ticking the box for "Table Name" to select all tables, and also ticking "Generate DROP TABLE statements." I have tried both with and without the "Generate DROP TABLE statements" ticked; same error.

            So I am completely at a loss to figure out what the problem is, unless it’s the options I’m choosing upon export/import. I thought about reinstalling MODx, but now I’m not sure I could restore my existing database.

            Is there information available as to exactly what options in phpMyAdmin should be chosen upon export/import? I have looked, but nothing I can find gives any specifics.

            From the "Moving Site" article in the Wiki:
            Dump (export) the local DB contents (use the Backup Manager, or any MySQL client such as phpMyAdmin). In phpMyAdmin, select SQL for the file type. Save to a file on your local machine and note the location. You will probably want to empty any log tables before backing them up, or else you’ll have rows and rows of log data useless to your new server.Then go to the remote server and import the SQL dump you saved. In PhPMyAdmin, select the database and "import" the SQL file.

            The "Upgrading" article on the Wiki:
            # Backup everything. Download all your files with your FTP client to your hard drive. Use phpMyAdmin or whatever database utility you have to "dump" your entire database to your hard drive.

            I have a copy of the MODx Web Development eBook, and I honestly can’t see any difference between what I am doing and what the book advises to do on importing and exporting (comparing the screenshots, etc.)

            Maybe I did something wrong when creating the two databases I’ve tested, but again, I can’t find any specific information on options to choose when creating a database for MODx to use. I just created a database in phpMyAdmin with the defaults, near as I can remember

            I am very much hoping that this is something very simple and basic (and easy to find) that I’ve done wrong with these two databases. It’s got to be something I’m doing wrong somewhere; otherwise I’d think the forums would be full of messages from other folks. smiley




              • 2297
              • 31 Posts
              Okay, it’s something to do with the way the files are being saved, both in the Manager and in phpMyAdmin, because if I just do a simple export in phpMyAdmin, without ticking the "Save as file" box, then import the data that generated in the new page, it works. I did a select all / copy on the generated data from that, put it into a text editor, and saved it as an .sql file. It imported with no problems at all.

              I am relieved but still puzzled. grin

              Now to see if I can follow the next steps of the "Moving Site" tutorial.

              Thanks for the responses smiley
                • 2297
                • 31 Posts

                Just as an update, I did manage to get the site up on the hosting server. After importing the database, I followed the directions here: http://modxcms.com/forums/index.php?topic=35267.msg213685#msg213685

                Thanks again to OpenGeek & sottwell for the responses to my initial cry for help smiley