Skip to content
Advertisement

Using MySQL INTO OUTFILE not writing to tmp

I’ve recently moved a project to a live VM instance, it worked perfectly during development and testing on my macOS box using XAMPP. Essentially the web app has 3 export options: XML, PDF and CSV. XML works fine and is created using a SELECT statement then looping through the results and pushing that into an XML file.

However for the CSV and PDF export (PDF uses TCPDF) I used:

CSV

JavaScript

PDF

JavaScript

However the file never gets written to /tmp. I assumed it was a permission issue however the directory is owned by root and has all the necessary permissions as expected.

The working XML code is as follows:

JavaScript

So I’m unsure as to why the XML works when it’s writing to the /tmp directory and the PDF & CSV does not, this is running on a Google Cloud Platform VM instance. As I stated before CSV & PDF exports work fine on my macOS machine.

Advertisement

Answer

Show the result from this:

JavaScript

if the Result not NULL you can only write in this directory.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement