Question: I currently have an upload form, which sends the file to Dropbox, through its API. The .php that receives the file to after performing a cURL is as follows:

```
$localFile = $_FILES["file_key"]['tmp_name'];
$fp = fopen($localFile, 'r');

$ch = curl_init();

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_URL, 'https://content.dropboxapi.com/2/files/upload');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "authorization: Bearer MY-TOKEN",
    "content-type: application/octet-stream",
    "dropbox-api-arg: {\"path\": \"/tmp/a.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}"
));
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 86400); // 1 Day Timeout
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
curl_setopt($ch, CURLOPT_BUFFERSIZE, 128);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localFile));
curl_exec ($ch);

```

This works perfectly, but I was troubled about the `fopen` in the second line. Is a bad practice use this? Even though "read-only" mode, can I receive a malicious file and have my system broken?

Answer: 
I had this problem running `pip install psycopg2` while I was running `OSX 10.14.4`. I fixed it by:

1. Running `pg_config` and noticed the variable:

```
CPPFLAGS = -I/usr/local/Cellar/icu4c/63.1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2

```

However `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk` did not exist on my machine.

So I changed it to `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`
2. I ran these two commands:

```
export CPPFLAGS="-I/usr/local/Cellar/icu4c/63.1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.sdk -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2"

pip install psycopg2

```
I had this problem running **pip install psycopg2** while I was running OSX 10.14.6. I fixed it by running this simple command:

1. sudo ln -s /Applications/Postgres.app/Contents/Versions/latest/bin/pg\_config /usr/local/bin/pg\_config
2. it asked for my password
3. ln: /usr/local/bin/pg\_config: File exists( than this appeared)
4. export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"

(then I ran the command above)

5. python pip install pyscopg2 .

(than i ran the code above. keep in mind I'm running python 3.7 in my virtual environment and I don't have to use python3 pip3 install pyscopg2.)

6.Successfully installed psycopg2-2.8.4