Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change php upload limit + explain it in the readme #120

Open
1 of 3 tasks
lapineige opened this issue Sep 29, 2020 · 34 comments · Fixed by #192
Open
1 of 3 tasks

Change php upload limit + explain it in the readme #120

lapineige opened this issue Sep 29, 2020 · 34 comments · Fixed by #192
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@lapineige
Copy link
Member

lapineige commented Sep 29, 2020

See : #118 (comment)

PHP default upload limit is too low¹ for Pixelfed default value. Also users could change Pixelfed value without any visible effect, because of PHP limit.

¹ it seems to be 2MB by default, which is limited for images and well too low for videos…

What needs to be done:

  • Add new php upload limit (with a file located in Pixelfed folder ?)
  • Add new nginx upload limit
  • Explain the readme how to change that value (note: that one is an easier task, any contribution, even if not complete, would be appreciated ;-) :-) )
@lapineige lapineige added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Sep 29, 2020
@lapineige
Copy link
Member Author

lapineige commented Nov 22, 2020

@yalh76 do you think a simple php.ini file in /var/www/pixelfed would do the job ?

If that the case, I'll do the PR :)

@lapineige lapineige self-assigned this Nov 22, 2020
@yalh76
Copy link
Member

yalh76 commented Dec 15, 2020

I think it would be easier to reintegrate https://github.com/YunoHost/example_ynh/blob/master/conf/php-fpm.conf that i removed during php 7.1 to 7.3 upgrade

@lapineige
Copy link
Member Author

Do we need that whole file ?

@yalh76
Copy link
Member

yalh76 commented Dec 15, 2020

yes, to have a customized php-fpm.

@lapineige
Copy link
Member Author

So we can't include only a few lines of it, we need the whole file ? (and to maintain it aligned with the standard one, including the case when we change php version)
Then wouldn't it be simpler to have a php.ini file with the only 2 or 3 relevant lines ?
Note: I don't know the implications in both cases, I'm not really into php.

@yalh76
Copy link
Member

yalh76 commented Dec 15, 2020

So we can't include only a few lines of it, we need the whole file ? (and to maintain it aligned with the standard one, including the case when we change php version)
Then wouldn't it be simpler to have a php.ini file with the only 2 or 3 relevant lines ?
Note: I don't know the implications in both cases, I'm not really into php.

I don't know how to use a php.ini...

And usually there are few changes php-fpm.conf between php version

@lapineige
Copy link
Member Author

From my understanding, adding a php.ini file one /var/www/pixelfed containing just the one or few lines needed does the job. It did in my case at least.

@yalh76
Copy link
Member

yalh76 commented Dec 16, 2020

well in that case, feel free to do a PR for that ;)

@lapineige
Copy link
Member Author

I think maybe someone from the @YunoHost-Apps/apps-group might know these things better than me: what would be your advise in that case ? php-fpm conf or "just" the php.ini file ?

@yalh76
Copy link
Member

yalh76 commented Apr 29, 2021

client_max_body_size is now 50Mo but can be increase

client_max_body_size 50M;

@mikail97
Copy link

mikail97 commented Jul 3, 2021

The same thing is happening to me, where I find the file in which I can modify the size?
Thanks in advance! @yalh76

@lapineige
Copy link
Member Author

lapineige commented Jul 3, 2021

/etc/nginx/conf.d/pixelfed_domain.tld.conf/pixelfed.conf, or something like this.

That's the Nginx part, you might need to adjust php file too, probably located in /etc/php7.4/fpm/pool.d/pixelfed.ini or similar (sorry, I don't have the ability to check if that's very accurate right now…).
There you can add those lines :

php_admin_value[upload_max_filesize] = 16M
php_admin_value[memory_limit] = 8M
php_admin_value[post_max_size] = 8M

(adjust the value to ones that fits your needs ;)

Then reload php service php-7.4-fpm reload, and you're done :)

@mikail97
Copy link

mikail97 commented Jul 4, 2021

/etc/nginx/conf.d/pixelfed_domain.tld.conf/pixelfed.conf, or something like this.

That's the Nginx part, you might need to adjust php file too, probably located in /etc/php7.4/fpm/pool.d/pixelfed.ini or similar (sorry, I don't have the ability to check if that's very accurate right now…).
There you can add those lines :

post_max_size = 8M
upload_max_filesize = 8M
max_file_uploads = 20

(adjust the value to ones that fits your needs ;)

Then reload php service php-7.4-fpm reload, and you're done :)

I found two "pixelfed.conf" files in my system, but no one is "pixelfed.ini"
/etc/nginx/conf.d/mydomain.xxx.d/pixelfed.conf
/etc/php/7.3/fpm/pool.d/pixelfed.conf

If I add the lines of code that you told me in one of these two files or in both, when restarting the service, it does not restart.

@yalh76 yalh76 reopened this Jul 4, 2021
@lapineige
Copy link
Member Author

lapineige commented Jul 4, 2021

/etc/php/7.3/fpm/pool.d/pixelfed.conf

That's the one :) (I knew it wasn't .ini… 😅)

If I add the lines of code that you told me in one of these two files or in both, when restarting the service, it does not restart.

What's the error ?

@mikail97
Copy link

mikail97 commented Jul 4, 2021

If I add the lines of code that you told me in one of these two files or in both, when restarting the service, it does not restart.

What's the error ?

If I add the three code lines you told me, and I reload php, I get a 502 (Bad Gateway)
If I stop the service and I start it again (try to) I get this :

● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2021-07-04 15:06:02 EDT; 12s ago
     Docs: man:php-fpm7.3(8)
  Process: 10517 ExecStart=/usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf (code=exited, status=78)
  Process: 10518 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/7.3/fpm/pool.d/www.conf 73 (code=exited, status=0/SUCCESS)
 Main PID: 10517 (code=exited, status=78)

Jul 04 15:06:02 mydomain.xxx systemd[1]: Starting The PHP 7.3 FastCGI Process Manager...
Jul 04 15:06:02 mydomain.xxx php-fpm7.3[10517]: [04-Jul-2021 15:06:02] ERROR: [/etc/php/7.3/fpm/pool.d/pixelfed.conf:21] unknown entry 'post_max_size'
Jul 04 15:06:02 mydomain.xxx php-fpm7.3[10517]: [04-Jul-2021 15:06:02] ERROR: Unable to include /etc/php/7.3/fpm/pool.d/pixelfed.conf from /etc/php/7.3/fpm/php-fpm.conf at line 21
Jul 04 15:06:02 mydomain.xxx php-fpm7.3[10517]: [04-Jul-2021 15:06:02] ERROR: failed to load configuration file '/etc/php/7.3/fpm/php-fpm.conf'
Jul 04 15:06:02 mydomain.xxx php-fpm7.3[10517]: [04-Jul-2021 15:06:02] ERROR: FPM initialization failed
Jul 04 15:06:02 mydomain.xxx systemd[1]: php7.3-fpm.service: Main process exited, code=exited, status=78/CONFIG
Jul 04 15:06:02 mydomain.xxx systemd[1]: php7.3-fpm.service: Failed with result 'exit-code'.
Jul 04 15:06:02 mydomain.xxx systemd[1]: Failed to start The PHP 7.3 FastCGI Process Manager.

when I check service php-7.3-fpm status

@lapineige
Copy link
Member Author

lapineige commented Jul 4, 2021

My bad, the syntax was wrong (I edited my previous post). Here is the correct one:

php_admin_value[upload_max_filesize] = 16M
php_admin_value[memory_limit] = 8M
php_admin_value[post_max_size] = 8M

@mikail97
Copy link

mikail97 commented Jul 4, 2021

My bad, the syntax was wrong (I edited my previous post). Here is the correct one:

php_admin_value[upload_max_filesize] = 16M
php_admin_value[memory_limit] = 8M
php_admin_value[post_max_size] = 8M

I just did it and it doesn't give me an error but it hasn't solved the main problem either, I still cannot upload photos of more than 2MB, I have to put those three lines in both files?

@lapineige
Copy link
Member Author

I have to put those three lines in both files?

No, that for php, the other file is for Nginx (the web server).

What's the client_max_body_size value in Nginx config file ?

@mikail97
Copy link

mikail97 commented Jul 4, 2021

What's the client_max_body_size value in Nginx config file ?

50M

Edit: I just tried to upload an image, and it won't let me upload anything larger than 500KB, previously it let me up to 2MB

@lapineige
Copy link
Member Author

lapineige commented Jul 7, 2021

Edit: I just tried to upload an image, and it won't let me upload anything larger than 500KB, previously it let me up to 2MB

WTF is happening…

If you comment out those lines in php pixelfed.conf file (and reload php service) does it come back to the previous state ?

edit: I wonder, but I have no idea if that's true, if the memory limit is not too low… you could try to test it with huge values for each field, like 500M

@mikail97
Copy link

mikail97 commented Jul 7, 2021

If you comment out those lines in php pixelfed.conf file (and reload php service) does it come back to the previous state ?

I erased the lines and, yes, it does

edit: I wonder, but I have no idea if that's true, if the memory limit is not too low… you could try to test it with huge values for each field, like 500M

I put 500M in each field, both in the php and in the nginx and it works
Thank you so much <3

Whenever I change the configuration from the web interface and give "save", I get this "Something went wrong
We cannot process your request at this time, please try again later. Go back to Pixelfed. "
Why?

@lapineige
Copy link
Member Author

Whenever I change the configuration from the web interface and give "save", I get this "Something went wrong
We cannot process your request at this time, please try again later. Go back to Pixelfed. "
Why?

I don't know…
If you do the same change in the .env file (don't forget to run the usual php artisan commands, to take the change into account), does it work ?

@sthaydn
Copy link

sthaydn commented Oct 28, 2021

Hi,

that was the issue for me as well. I wasn't able to upload pics with more then 2M, while pixelfeld says it should be 25M.
php_admin_value[upload_max_filesize] = 25M
adding to the pixelfed.conf inside /etc/php/7.3/pool.d/ did the trick.

Would it be a good idea to have that line as standard for the installation process? As yunohost should be for people with not as much knowledge (like myself) it would be great to achieve changing the setting inside pixelfed should be enough. So maybe having set this value to 100M for example would be a good choice, even when people will post large pics the pixelfed value could be changed.

@lapineige
Copy link
Member Author

So we can't include only a few lines of it, we need the whole file ?

@yalh76 do you think that with the new tools Yunohost includes to setup a kind of "php performance profile" (memory limit, CPU usage…) we could change that upload size value without using a custom php.conf file ?

@twnl
Copy link

twnl commented Oct 9, 2022

I'm currently updating YH to Debian 11 and Pixelfed to 0.11.4 and take the waiting time to write this.

I also have this same problem, even after reading the entire issue and even though @sthaydn already gives a quite good explanation, I'm not 100% sure what I need to do to solve the problem.

php_admin_value[upload_max_filesize] = 25M adding to the pixelfed.conf inside /etc/php/7.3/pool.d/ did the trick.

  • ssh into my YunoHost command line
  • type: sudo nano /etc/php/LATEST-PHP-VERSION/pool.d/pixelfed.conf
  • Search for the line: php_admin_value[upload_max_filesize] and add the desired value behind it e.g. php_admin_value[upload_max_filesize] = 32M

Is that it, is that correct @lapineige ?

@lapineige
Copy link
Member Author

I don't remember 😅
Can you tell us once you tried ? 😄

type: sudo nano /etc/php/LATEST-PHP-VERSION/pool.d/pixelfed.conf

Php7.4 right now, for your information. If you have PHP 8.0 installed by another app, it's not the one you should configure for Pixelfed.
(it might be php7.4-fpm, I'm unsure how this folder is named)

@webmink
Copy link

webmink commented Nov 6, 2022

Helpful voices on the Fediverse pointed me here as I had the same issue with a clean install of PixelFed on Yunohost 11. Not being especially familiar with the software involved I was not able to work out what to do from this thread, but I did edit /etc/php/7.4/fpm/php.ini and change upload_max_filesize to 20M and it now works. I suspect I will not be the only marginally capable Yunohost user with this problem...

@lapineige
Copy link
Member Author

lapineige commented Nov 10, 2022

We now changed the default upload limit to be 50MB for your information. Thanks @yalh76 !

You could try the testing branch and see if it fixes it 🙂

@yalh76 yalh76 mentioned this issue Nov 10, 2022
2 tasks
@isAAAc
Copy link

isAAAc commented Nov 13, 2022

@lapineige : (edit: i tried to reopen this issue, but don't see how .... :/ )

in https://github.com/YunoHost-Apps/pixelfed_ynh#change-max-upload-limit
The readme.md should better explain where and wich file to edit:

To change max upload limit (default : 50MB), edit the Pixelfed php-fpm.conf file and find the line Common values to change to increase file upload limit And adjust those values:

this is wrong and should be:

 To change max upload limit (default : 50MB), edit the Pixelfed pixelfed.conf file in the `/etc/php/<PHP_VERSION>/fpm/pool.d/pixelfed.conf` and add and adjust those values:

@yalh76 yalh76 reopened this Nov 17, 2022
@isAAAc
Copy link

isAAAc commented Nov 19, 2022

the upgrade removes the change i made :/ perhaps we could have an include for local changes ?

@lapineige
Copy link
Member Author

I don't get what should have been untouched ?

@tituspijean
Copy link
Member

All of this should be handled with a YunoHost config panel, so that the setting is save across upgrades.

@lapineige
Copy link
Member Author

Yes we have to configure a config panel for that 😅

@unersame342
Copy link

after that you need to restart redis-server postgresql nginx and php8.0 in yunohost and all should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants