We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6947
    • 8 Posts
    Hi Guys - I’m having some trouble with Magic Quotes, I think.

    This is all happening on a dummy install but the server which I am using hosts some other sites that have MODx. I was hoping a fresh install in a new account would help me chase down some errors.

    Here are some stats:
    Modx: 1.0.5
    PHP: 5.3.6
    MySQL: 5.1.56
    Browser: Chrome, FF4/FF3, IE8 etc.
    Server: VPS hosting, Cpanel v. 11.28.87, 2.6.18-194.8.1.el5.028stab070.5 kernel

    So having run in to some issues in the past on this server with the way sessions are handled and with magic quotes I set my PHP.INI file to look this this:

    ; Magic quotes
    ;
    
    ; Magic quotes for incoming GET/POST/Cookie data.
    magic_quotes_gpc = Off
    
    ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
    magic_quotes_runtime = Off
    
    ; Use Sybase-style magic quotes (escape ' with '' instead of \').
    magic_quotes_sybase = Off
    
    date.timezone = "Europe/London"
    
    session.gc_maxlifetime = 28800
    session.save_path = "/home/ck/tmp"


    [http://magnapc.co.uk/~ck/php.ini]

    As you will see from the PHPInfo read out (http://magnapc.co.uk/~ck/phpinfo.php) Magic quotes is indeed off (or so it would seem).

    I had the PHP.ini set like that prior to starting the install, so in this instance, it has always been off.

    MODx installed okay and seemed to be working OK. Using the default editor, I can see images and such in the file manager and upload new ones. I can even insert the image and see it in the editor.

    Once the page is saved however, the double slashes begin to crop up in my image paths. Take a look at http://magnapc.co.uk/~ck/index.php?id=47 for example and you will see what I mean.

    Really stumped by this one, any tips much appreciated.

    Cheers
    D


      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Which php.ini file is this? If it’s one in your web root folder, it won’t apply to the Manager, which is in the /manager folder and would need its own php.ini file. What does the Manager’s phpinfo() say (Reports -> System Info, and the view link for its phpinfo() display.
        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
        • 6947
        • 8 Posts
        Ah ha!

        Yes, that was my root directory php.ini file and yes, PHP info in the manager was showing Magic quotes as enabled. Now I feel silly undecided

        Everything seems to be working fine.

        Thanks for the tip!

        D
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Just a reminder to anyone reading these; .htaccess files are inherited, .php files are not. In systems configured to use custom php.ini files in this manner, each directory from where a .php file is executed needs to have its own php.ini file. When the PHP interpreter is run, it will check the directory where the .php file resides and apply its rules. MODx uses two .php files, both of them index.php files, on in the main installation folder and one in the manager folder. The one in the manager folder is the crucial one, unless you have a snippet that saves to the database, since snippets are executed by the main index.php file (in the case of Evo, using the PHP eval() function).
            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