We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    Forget the import tool for now; that is something completely different. If you manually upload a PDF file and create a static resource for it pointing at the proper file, does it work or not?
      • 21635
      • 81 Posts
      If you manually upload a PDF file and create a static resource for it pointing at the proper file, does it work or not?

      as i said before
      Quote from: nklsf at Jul 14, 2010, 01:56 AM

      well, there i am now, it works locally, but does not on 2 different server setups. my isp-support just told me the script was canceled because of the error
      malformed header from script. Bad header=inline


      since the two server are on seperate hosters could it be, that some common php-limit or sth is causing the harm?
        • 21635
        • 81 Posts
        Quote from: splittingred at Jul 06, 2010, 02:32 PM

        Ensure your PDF content type is mime_type "application/pdf", and "binary" is checked.

        guys, i gave this problem a little rest.
        installed 2.0 rev7212 today.

        tried binary pdfs -> didn’t work.

        unchecked "binary" in content-type settings -> tadaa, working. smiley

        still, it left me a bit confused, as all of you told me, that the pdf-content type should be binary. this is why i didn’t play around with the setting. can this be a bug, though? or just heavy mis-communication?
          • 22303 MODX Staff
          • 10,725 Posts
          I don’t know; it definitely doesn’t work if binary is unchecked for me. huh
            • 3864
            • 16 Posts
            I’m having a similar problem as described above. I’m trying to create a static resource for downloading a PDF. I’ve created a PDF content type (application/pdf, binary checked, .pdf extension) and chose it as the content type on the static resource. Content disposition is inline. Template is set to a custom template containing just [[*content]] (I’ve tried Empty template as well). When I request the saved static resource the response is always a 500 error.

            If I uncheck the binary option in the content type definition the pdf file will download and display successfully. It works but obviously the system is parsing the file before sending so any pdf file greater then a certain size will produce an out of memory error.

            I can load the pdf file successfully directly from the server.

            I’ve replicated this on a handful of hosted virtual servers and get the same result every time.

            If it helps here is what I’m running:

            PHP Version 5.2.13
            ZLib Support enabled
            json support enabled
            json version 1.2.1
            GD Support enabled
            PDO drivers sqlite, sqlite2, mysql
            PDO Driver for MySQL, client library version 4.1.22
            SimpleXML enabled
            safe_mode Off
            register_globals Off
            memory_limit 32M
            Apache/1.3.42

            This is the request and response headers in both cases (binary checked and un-checked).

            1. Binary content type checked (fail):

            REQUEST
            (Request-Line) GET /index.php?id=43 HTTP/1.1
            Host xxx
            User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11
            Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            Accept-Language en-us,en;q=0.5
            Accept-Encoding gzip,deflate
            Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
            Keep-Alive 300
            Connection keep-alive

            RESPONSE
            (Status-Line) HTTP/1.1 500 Internal Server Error
            Date Fri, 06 Aug 2010 01:33:35 GMT
            Server Apache 3
            Connection close
            Transfer-Encoding chunked
            Content-Type text/html; charset=iso-8859-1



            2. Binary content type unchecked (success):

            REQUEST
            (Request-Line) GET /index.php?id=43 HTTP/1.1
            Host xxx
            User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 Firefox/3.5.11
            Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            Accept-Language en-us,en;q=0.5
            Accept-Encoding gzip,deflate
            Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
            Keep-Alive 300
            Connection keep-alive
            Cookie PHPSESSID=44f8bd7b154f8c2408fcfd91fb4ffb5e; ys-modx-resource-tree=s%3A/root/web_0/web_4/web_44

            RESPONSE
            (Status-Line) HTTP/1.1 200 OK
            Date Fri, 06 Aug 2010 02:17:57 GMT
            Server Apache 3
            Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
            Expires Thu, 19 Nov 1981 08:52:00 GMT
            Pragma no-cache
            X-Powered-By PHP/5.2.13
            Keep-Alive timeout=15, max=100
            Connection Keep-Alive
            Transfer-Encoding chunked
            Content-Type application/pdf; charset=UTF-8
              • 3749
              • 24,544 Posts
              I got it to work by setting the Content Type to "PDF", the template field to "empty" and the Content Disposition to "inline". A link to the resource offered up the .PDF file.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 3864
                • 16 Posts
                Oh, humph... undecided I just did a test and managed to get it working on a local mac just the way you described but can’t on co-located linux servers. I’ve tried every configuration I can think of but it’s a no-go on the linux servers.

                From what I’ve read previously on this issue a template should be associated with static resources and should only contain [[*content]]. Using the Empty template seems to go against this advice.

                In terms of configuring php the system requirements for MODx state:

                ./configure --with-apxs2=/usr/local/bin/apxs --with-mysql --prefix=/usr/local --with-pdo-mysql --with-zlib


                Do you know if apxs is absolutely necessary?
                  • 3749
                  • 24,544 Posts
                  I don’t see how [[*content]] would be a good idea because you only want to serve up the file.

                  No idea on apsx.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 3864
                    • 16 Posts
                    I think the problem isn’t related to the Empty template but thanks for clarifying that. I get the same result regardless of which template I choose. A pdf will only load when requested if the Binary option is unchecked in the Content Type definition. Problem is, as I described earlier, the file is parsed and out of memory errors occur on larger pdf files.

                    Wish I had a virtual hammer now wink
                      • 22303 MODX Staff
                      • 10,725 Posts
                      I has to be binary. It should not work if it is not binary. huh