We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5208
    • 2 Posts
    Someone please help me!!!!!

    I’m completely new to all this and having some trouble.

    I have recently installed Apache, mySQL and PHP onto my mac, so I can develop sites locally. I have also installed modx and all seems to be fine.... however, when I create a new template none of my linked css and image files display. At first I thought this was just a simple error with not using the correct path, but when I viewed the code I noticed that backslashes have been added to the code in front of any quote mark.

    Example of code:
    <link href=\\\\\\\"/assets/templates/hoxton/master.css\\\\\\\" rel=\\\\\\\"stylesheet\\\\\\\" type=\\\\\\\"text/css\\\\\\\" />

    Each time I view the code it adds another "\" in.

    Is this to do with having MAGIC QUOTES enabled in my PHP settings? I have checked my PHP settings and this is currently enabled, but don’t know how to disable it.

    Or, is there a setting in Modx I can cange to rectify this?

    I would extremely grateful for any help someone could shine on this problem.

    Many thanks
      • 22303 MODX Staff
      • 10,725 Posts
      First, what version of MODx is this? And yes this could have to do with magic_quotes being enabled. Do you have PHP 5.3.0 by chance? If so, you definitely need to disable this as it is a deprecated feature. See your php.ini for these settings.
        • 5208
        • 2 Posts
        Hi Jason, many thanks for your reply.

        I’m using MODx 1.0.0 and PHP 5.3.0. How do I locate the php.ini file? I tried searching for it, but nothing with that name can be found.

        Regards
        Chris
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          In the MODx manager, go to Reports -> System Info, and click the "view" for phpinfo. Near the top of the resulting display, you’ll find the path to your php.ini. There may be several of these on any server, so it’s important to get the one that your PHP is actually using.
            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
            • 34108
            • 66 Posts
            I have already posted this response over on http://modxcms.com/forums/index.php/topic,40996.0.html but thought I should post it here too as it’s pretty much the same issue. Hope it helps someone.

            Just though I should post on here as I’ve just had the exact same problem but needed a different solution.

            I tried all the fixes above (and more) for disabling magic quotes but it made no difference. In the end the problem was the PHP version.

            I had successfully tested the MODx site in question on two different webhosts, one running PHP Version 5.2.10, and the other one running PHP Version 5.2.13. MODx worked fine on both these webhosts with the backslash issue not happening. But as soon as I moved the site to the client’s webhost, which was running PHP Version 5.3.2, the backslashes began appearing in all templates and chunks whenever I edited them.

            So the problem in my case was the PHP Version the webhosting company was running - PHP 5.3.2.

            The solution was to have the webhosting company move the client’s website over to a different server that ran PHP Version 5.2.10 (although 5.2.13 probably would have worked fine as well).

            They did this free of charge but it did take 24 hours to go through, and then the client had to update the nameservers to point to the new domain so that took another few hours. Another option would have been to move the client’s site over to one of the web hosts I knew were running the PHP version we needed but thankfully we didn’t have to do this.

            Hope this prevents someone else from tearing out their hair smiley

            Harmony


              • 22303 MODX Staff
              • 10,725 Posts
              The issue is that magic quotes is deprecated in 5.3.x and should not be enabled in their php.ini when deploying that release; you didn’t need a "different solution" despite the hoops your host decided it needed to jump through.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Oddly enough, in the latest MAMP using 5.3.2 it’s ON by default; you have to add a line to the main php.ini file to turn it OFF. I wonder if that’s a bug in that particular version of PHP?
                  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