Need help to change php settings for wordpress app?

I want to use the wordpress app, but in order to do that I need to be able to change the max size regarding files to upload in wordpress. Typically that is done by changing the php settings post_max_size and upload_max_filesize. I have not found any way to do that so I really need help with this. If its not possible to change this I need to install a vm with os, webbserver and wordpress which seems quite an overkill when everything already is on the truenas scale.

(i need to import a backup of my current wordpress installation of 30GB from my old installation in order to install it on truenas)

I have also tried the different wordpress tools that makes it possible to change the upload size but it does not work.

Did you end up finding a solution?
Got the same issue

bump, need a solution.

I never found a solution, installed a vm with ubuntu and installed wordpress and apache instead. Its an overkill solution for this though. Would very much like to run it through the app though so I would also like to see a solution to this

Hmm, that is overkill. I can’t say this is any better than deploying WordPress to existing shared directories for content. i can now access it through SMB, to upload my larger files, but still…

But how do you overcome the restriction in wordpress to upload larger files?

Hello @Kristoffer,

I don’t think this is the ideal solution that you are looking for but for me it worked to upload overwrite the limit and upload a bigger file. I found this solution googling “docker wordpress max file limit”:

Look for this on Youtube " Docker: Increase maximum Wordpress upload file size "
(all credits for the channel TechGuideReview)

It is really easy. In a nutshell, you just need to:

  1. Go to Truenas Apps, click on Wordpress, click on the Terminal icon and write /bin/bash (/bin/sh is by default but i like bash better)
  2. In the terminal, you will be in this path: /var/www/html
  3. Type: ls -a (to show the hidden files, there will be one called “.htaccess”).
  4. Type: cat .htaccess (to see the content of the file)
  5. Type: sed -i ‘/^# END WordPress.*/i php_value upload_max_filesize 256M\nphp_value post_max_size 256M’ .htaccess
  6. Type: cat. htaccess (to check if the line was added correctly.

If you ever want to remove the parameter

  • Type: sed -i ‘/php_value/d’ .htaccess

I hope it was useful :slight_smile:

Hi and thanks for the idea, think it would work for me. However, Im trying but cant make sed affect the file, nothing happens with the file when trying. The date/time of the file is updated but the content isnt there. I couldnt get your line to work so i tried
sed -i ‘/# END Wordpress.*/i php_value upload_max_filesize 256M\nphp_value post_max_size 256M’ .htaccess

It seems as if the change is overwritten again with the original as it states in the remarks

The directives (lines) between “BEGIN WordPress” and “END WordPress” are

dynamically generated, and should only be modified via WordPress filters.

Any changes to the directives between these markers will be overwritten.

Any tips?

I forgot to mention that i tried that on the TrueNAS-24.10-RC.2 (electric eel), that is using docker to run the apps. It could have some influence.

In regards to providing more tips, I don’t think I can provide anything better. I don’t have a deeper understanding about the issue. I can only suggest to look on forums related to docker and php if you don’t find the answer here. I don’t think it is something intrinsic to truenas but understanding the underlying technologies.

Having said that, i wish you luck :wink:

I have the same issue but I have the solution!" Personally, I prefer an SSH connection, but you can also use the WordPress terminal (/bin/bash) to access your WordPress files directly. If you want to go with your SSH connection, navigate to /mnt/.ixapps/app_mounts.wordpress/data.

  1. Run the command: ls -a
    The file .htaccess should appear.
  2. Then use the command: sudo nano .htaccess
    Write the following code after the existing content in your .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

write now this :

php_value upload_max_filesize 32M
php_value post_max_size 64M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300
  1. Then press Ctrl+S and Ctrl+X to exit the editor.

  2. Reboot WordPress to apply the changes, and your default upload limit is now 32M.

Actually this worked for me!!!

Hi, and thanks. Im running Dragonfish-24.04.2 and I cant get that solution to work. Dont have nano in the bash and when trying to add the text with sed i get error from rewritecond. Which version are you running?

Hi
Im not able to get that to work, which version are you running? Im running Dragonfish-24.04.2

Hi,

I’m currently using ElectricEel-24.10.0.2. Try to set up an SSH connection between your NAS and your computer. Here are the steps based on your operating system:

Linux Computer:

  1. Open your terminal.
  2. Try to connect to your NAS with the following command line, replacing <your_port> with your custom port if you’re not using the default (22) port:
    ssh -p <your_port> admin@nas_ip
    
  3. Enter your password when prompted.

Windows Computer:

  1. I recommend using PuTTY to set up your SSH connection.
  2. Configure your session with the following settings:
    • Host Name (or IP address): nas_ip
    • Port: <your_port> (replace if you’re not using the default 22 port)
    • Connection: SSH
  3. You should have access to nano on PuTTY, although I couldn’t confirm this as I’m using Linux.

Hi and thanks again. I already have ssh and putty so thats not the problem. It seems as if there are other things that differ between electric eel and dragonfish. It might be that the problem can be solved when i eventually upgrade to electriceel but that is something i need to wait for (nano and other editors are not available, but sed are)

This should be rather simple to resolve.
Have you tried adding the values above via environment values in the apps config GUI in TrueNAS?

Edit the app and try entering the values under additional environment values.

name=PHP_UPLOAD_MAX_FILESIZE
value=150M

Hi, yes i have also tried that without success unfortunately

Here’s how I fixed the PHP upload limit issue in WordPress on TrueNAS Docker:

  1. I created a folder at /mnt//wordpress-htaccess.

  2. Inside this folder, I created a file named .htaccess with the following content:

BEGIN WordPress

IfModule mod_rewrite.c

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

/IfModule

END WordPress

Custom PHP Settings:

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value memory_limit 256M

php_value max_execution_time 300

php_value max_input_time 300

  1. I edited the WordPress container in TrueNAS and added a volume to mount the .htaccess file.

The host path was /mnt//wordpress-htaccess/.htaccess and the container path was /var/www/html/.htaccess.

  1. I created another file named custom.ini with the following content:

upload_max_filesize = 64M

post_max_size = 64M

memory_limit = 256M

max_execution_time = 300

  1. I mounted the custom.ini file in the container at the container path /usr/local/etc/php/conf.d/custom.ini.

  2. Finally, I restarted the container to apply the changes.

1 Like

Guess you are using electric eel then? Seems to work when running docker which isnt available in the dragonfish version

Please verify the path you chose. If what your wrote is accurate, ignoring the double slashes, you likely made a folder on the boot pool which won’t survive an update.