How to diagnose example pages database connection?

How to diagnose example pages database connection?

BradleyBBradleyB Posts: 16Questions: 5Answers: 0

I've followed instructions to install and evaluate the examples for Editor. It does't work. I don't see any data. I don't see any data errors. I can't fine any logs. I can't find any trouble shooting guides for the database connection. I don't see any errors on the console about the connection or it's status. It talks about removing the error_reporting lines, but why? Nothing is being reported. Why not have an example RIGHT AT THE TOP for testing your database connection? Editor is base on DataTables, and they are heavily base on databases. WHY NOT MAKE CONNECTING AND DIAGNOSING those problems something to figure out? Why not have a forum search instead of site wide search?

Answers

  • BradleyBBradleyB Posts: 16Questions: 5Answers: 0
    • First, examples won't show you and error if it can't find its own resources. Look in the terminal or server logs for files it can't load. Turns out the examples use non-relative urls and expect the document root to be the parent of 'examples' dir. This is not mentioned in the docs.
    • 2nd, They say to put it anywhere in the root or a sub dir of your server. They NEED to say, "MUST be located so that 'examples' directory is directly off root.

    After it is able to find its own resources, I DID get an alert box mentioning the lack of db connection.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Hi,

    Thanks for the feedback. There are some things that we do track and report such as an SQL error (user name / password incorrect, or a table / column name not available) and they are given as explicit alert() messages. But there are so many things that could go wrong with the database connection that is outside of our control it isn't possible for us to show error messages for them all (even if we could detected them!). For example, what is the ssl socket for your database isn't at the path that PHP was told where it would be. That's nothing to do with Editor, but its still going to cause an issue - and not be reportable to the client-side (indeed, some you really don't want to be reportable to the client-side. I leaked a damn database password doing that once...).

    Why not have an example RIGHT AT THE TOP for testing your database connection?

    They are enabled by default in the config file. However (this is the killer!) it is still possible for PHP configurations to not output errors. It really depends on the PHP configuration and how locked down it is.

    Turns out the examples use non-relative urls and expect the document root to be the parent of 'examples' dir.

    They are all relative - e.g. from a demo package I've just downloaded:

        <script type="text/javascript" language="javascript" src="../../js/dataTables.editor.min.js"></script>
        <script type="text/javascript" language="javascript" src="../resources/syntax/shCore.js"></script>
        <script type="text/javascript" language="javascript" src="../resources/demo.js"></script>
        <script type="text/javascript" language="javascript" src="../resources/editor-demo.js"></script>
    

    Indeed I do all of my testing in a (fairly) deeply nested folder.

    Could you tell me what file you loaded which uses absolute paths please? That's a bug.

    They say to put it anywhere in the root or a sub dir of your server. They NEED to say, "MUST be located so that 'examples' directory is directly off root.

    Nope - if there is something stopping it being placed anywhere, then its a bug, but I've not been able to recreate that issue I'm afraid, so I'd need some feedback on where you found that issue so I can fix it.

    Allan

  • BradleyBBradleyB Posts: 16Questions: 5Answers: 0

    If you start a server in the main directory of your project/download, examples do not load, "The requested resource /simple/simple.html was not found on this server." Looks like they are relative to the example dir. So as long as the example dir is the root, it will work. EXAMPLE MUST BE ROOT

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @BradleyB ,

    You can have the distribution in a sub-directory, but yep, you can't have the server root within the directory structure! Installation details for PHP are here.

    Cheers,

    Colin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    If you start a server in the main directory of your project/download, examples do not load

    I don't quite understand this point. If you were using NodeJS, then yes you might start the server there, but using PHP you would install the files into your web directory (unless you are symlinking it or adding a new virtual server specifically for that path?).

    Allan

  • BradleyBBradleyB Posts: 16Questions: 5Answers: 0

    I

  • BradleyBBradleyB Posts: 16Questions: 5Answers: 0

    I am using php artisan serve. If you start that in the example directory, it won't work. You have to start it so example is IN/OFF root directory.

This discussion has been closed.