Cannot access or copy files with PHP on Ubuntu 18

Solution 1:

There is a private tmp directory for Apache located in /tmp/*apache2.service*/tmp. This exists because of the private tmp setting in /lib/systemd/system/apache2.service. I found a little article here.

Whenever I call copy(/tmp/....) in the PHP script it will look in the Apache specific private tmp directory. Apache can't see contents of /tmp with this option enabled.

Therefore I can only disable this option or make MySQL dump the CSV files elsewhere.