2

I've put wordpress up on Heroku and have a 2.5MB custom theme I need to upload.

I've installed the wpro plugin to send my uploads directly to s3, however, I still get the error. I think i still need to edit the php.ini file, specifically these lines:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

I need to change that to 3M.

How can I edit the php.ini file??

Eric H.
  • 6,894
  • 8
  • 43
  • 62

3 Answers3

4

The easiest solution to change Heroku's php.ini settings is to create a .user.ini.

This is explained in the Heroku Dev Center Language Support > PHP > Customizing Web Server and Runtime Settings for PHP > PHP runtime settings:

PHP-FPM will read settings from any .user.ini file in the same directory as the .php file that is being served via a web server; if none is found, it will also read settings from a .user.ini file in any parent directory up to your application’s configured document root.

For example to increase the maximum allowed size for uploaded files to 10 MB in a Symfony or Laravel project the .user.ini file should be created in the /public and should contain the following lines:

post_max_size = 10M
upload_max_filesize = 10M
louisfischer
  • 1,968
  • 2
  • 20
  • 38
3

I got this to work by making wordpress-heroku read a custom php.ini.

I copied the heroku buildpack's php.ini into my root directory https://github.com/heroku/heroku-buildpack-php/blob/master/conf/php/php.ini

I renamed it to custom_php.ini and changed the following lines

upload_max_filesize = 3M
post_max_size = 3M

I then added a Procfile with the line

web: vendor/bin/heroku-php-apache2 -i custom_php.ini .
Papples
  • 518
  • 6
  • 16
  • I've tried this, but Heorku doesn't seem to pick up the change. Is there something I'm missing? – Avishai Jan 26 '16 at 16:09
-5

Heroku only unofficially supports php. I contact support and they're not going to change this for me. Ultimately I think it's more trouble than it's worth because Heroku isn't intended to be a file writing system - anything you change will be undone unless the change is made on your local system and committed in git. Even if you set up WPRO and ship all your static to Amazon s3, you'll run into trouble.

It was much easier for me to set Wordpress up on Amazon E2.

Eric H.
  • 6,894
  • 8
  • 43
  • 62
  • This should not be marked as the correct answer. I was having the same issues but using Amazon S3 and CloudFront plugin, creating a S3 bucket and CloudFront account, I now have a CDN for all of my uploads to be stored (which will also improve performance). The plugin will rewrite your urls for the media. You can also create a CNAME for your CDN and have something like cdn.example.com. – tylerlindell Jan 22 '16 at 14:01