[GH-ISSUE #116] cannot make it work on ubuntu server #93

Closed
opened 2026-02-25 23:40:39 +03:00 by kerem · 5 comments
Owner

Originally created by @ghost on GitHub (May 11, 2020).
Original GitHub issue: https://github.com/HaschekSolutions/pictshare/issues/116

When I try to upload a file I'm getting cannot post error. Am I missing something?

curl -F "file=@/Users/apple/Desktop/dev/bethabit/marketing/logo.png" https://bethabit.com/api/upload.php


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /api/upload.php</pre>
</body>
</html>

this is the nginx block I use.


server {
        listen 80;
        server_name bethabit.com www.bethabit.com;

        client_max_body_size 50M; # Set the max file upload size. This needs to be equal or larger than the size you specified in your php.ini

        root /var/www/pictshare-master; # or where ever you put it
        index index.php;

    location / {
        try_files $uri $uri/ /index.php?url=$request_uri;
    }

    location ~ \.php {
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; #may be slightly different depending on your php version
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
    }

    location ~ /(data|tmp|bin|content-controllers|inc|interfaces|storage-controllers|templates|tools) {
       deny all;
       return 404;
    } 
}

this is the pictshare config


<?php 
/**
 * All settings that are uncommented are mandatory
 * Others optional
 */

//Use a specific domain for links presented to the user
//Format: https://your.domain.name/
// MUST HAVE TAILING /
define('URL','https://bethabit.com/');

//define('JPEG_COMPRESSION', 90);
//define('FFMPEG_BINARY','');
//define('ALT_FOLDER','/ftp/pictshare');
//define('ALLOWED_SUBNET','192.168.0.0/24');

//S3 settings
//
//define('S3_BUCKET','bucketname');
//define('S3_ACCESS_KEY','');
//define('S3_SECRET_KEY','');
//define('S3_ENDPOINT','http://localhost:9000'); //optional, only if you're using S3 compatible storage like Minio


Originally created by @ghost on GitHub (May 11, 2020). Original GitHub issue: https://github.com/HaschekSolutions/pictshare/issues/116 When I try to upload a file I'm getting cannot post error. Am I missing something? `curl -F "file=@/Users/apple/Desktop/dev/bethabit/marketing/logo.png" https://bethabit.com/api/upload.php` ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Cannot POST /api/upload.php</pre> </body> </html> ``` this is the nginx block I use. ``` server { listen 80; server_name bethabit.com www.bethabit.com; client_max_body_size 50M; # Set the max file upload size. This needs to be equal or larger than the size you specified in your php.ini root /var/www/pictshare-master; # or where ever you put it index index.php; location / { try_files $uri $uri/ /index.php?url=$request_uri; } location ~ \.php { fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; #may be slightly different depending on your php version fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; } location ~ /(data|tmp|bin|content-controllers|inc|interfaces|storage-controllers|templates|tools) { deny all; return 404; } } ``` this is the pictshare config ``` <?php /** * All settings that are uncommented are mandatory * Others optional */ //Use a specific domain for links presented to the user //Format: https://your.domain.name/ // MUST HAVE TAILING / define('URL','https://bethabit.com/'); //define('JPEG_COMPRESSION', 90); //define('FFMPEG_BINARY',''); //define('ALT_FOLDER','/ftp/pictshare'); //define('ALLOWED_SUBNET','192.168.0.0/24'); //S3 settings // //define('S3_BUCKET','bucketname'); //define('S3_ACCESS_KEY',''); //define('S3_SECRET_KEY',''); //define('S3_ENDPOINT','http://localhost:9000'); //optional, only if you're using S3 compatible storage like Minio ```
kerem closed this issue 2026-02-25 23:40:39 +03:00
Author
Owner

@geek-at commented on GitHub (May 11, 2020):

does it work if you point it to pictshare.net?

curl -F "file=@/Users/apple/Desktop/dev/bethabit/marketing/logo.png" https://pictshare.net/api/upload.php

?

<!-- gh-comment-id:626769183 --> @geek-at commented on GitHub (May 11, 2020): does it work if you point it to pictshare.net? `curl -F "file=@/Users/apple/Desktop/dev/bethabit/marketing/logo.png" https://pictshare.net/api/upload.php` ?
Author
Owner

@ghost commented on GitHub (May 11, 2020):

that does work but obviously I need to store the files in my server..
I tried changing the URL in pictshare config file to "https://pictshare.net/" but got the same result "Cannot GET /api/upload.php"

<!-- gh-comment-id:626844538 --> @ghost commented on GitHub (May 11, 2020): that does work but obviously I need to store the files in my server.. I tried changing the URL in pictshare config file to "https://pictshare.net/" but got the same result "Cannot GET /api/upload.php"
Author
Owner

@geek-at commented on GitHub (May 11, 2020):

Sure, just making sure it's a problem on your side.

what's the output of

ls -al /var/run/php/php7.3-fpm.sock

<!-- gh-comment-id:626914178 --> @geek-at commented on GitHub (May 11, 2020): Sure, just making sure it's a problem on your side. what's the output of `ls -al /var/run/php/php7.3-fpm.sock`
Author
Owner

@ghost commented on GitHub (May 12, 2020):

It was
cannot access '/var/run/php/php7.3-fpm.sock': No such file or directory
I installed php7 again according to another document https://pixelspress.com/how-to-install-php-7-3-fpm-on-ubuntu-19-10/
Now I get
srw-rw---- 1 www-data www-data 0 May 12 05:33 /var/run/php/php7.3-fpm.sock
and I do php -v I get this
PHP 7.3.17-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr 19 2020 07:44:26) ( NTS )
I restarted nginx and I was getting the same cannot post error. I thought nginx cannot access var/www/ by sudo so I placed the repo to the root and tried running it again without any success.

<!-- gh-comment-id:627124500 --> @ghost commented on GitHub (May 12, 2020): It was ` cannot access '/var/run/php/php7.3-fpm.sock': No such file or directory` I installed php7 again according to another document https://pixelspress.com/how-to-install-php-7-3-fpm-on-ubuntu-19-10/ Now I get `srw-rw---- 1 www-data www-data 0 May 12 05:33 /var/run/php/php7.3-fpm.sock` and I do php -v I get this PHP 7.3.17-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Apr 19 2020 07:44:26) ( NTS )` ` I restarted nginx and I was getting the same cannot post error. I thought nginx cannot access var/www/ by sudo so I placed the repo to the root and tried running it again without any success.
Author
Owner

@geek-at commented on GitHub (May 13, 2020):

really sounds like a PHP problem. anything in the nginx or php error log?

<!-- gh-comment-id:628018135 --> @geek-at commented on GitHub (May 13, 2020): really sounds like a PHP problem. anything in the nginx or php error log?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pictshare#93
No description provided.