Can't use options.json and override php.ini at the same time? (dmikusa buildpack)

298 views
Skip to first unread message

kar...@tamu.edu

unread,
Dec 4, 2014, 2:27:31 PM12/4/14
to vcap...@cloudfoundry.org
I'm trying to override the php.ini file in the .bp-config/php folder of my app to change the max filesize/post size from the default 2MB to 500MB. I was able to do this using the configuration options described in the manuals, but after doing so the PHP extensions specified by the options.json appear to not be working. I've attached the blank PHP app that I've been testing with to this. 

Is it intended for both of them to not be used at the same time? If so, how can I specify the necessary extensions in the php.ini, or how can i override the upload_max_filesize and post_max_size ini options in the options.json?

Thanks,
Austin
blankPHPApp.zip

Daniel Mikusa

unread,
Dec 4, 2014, 2:43:10 PM12/4/14
to vcap...@cloudfoundry.org
Austin,

If you specify a php.ini file that can give you complete control over what is used by your application.  It can even override the list of extensions.

If you don't want it to do that, like in your case where you just want to set a couple properties you have two options.

1.) Use a `.user.ini` file for your settings. [1]
2.) Copy the `php.ini` file from here (5.4 [2], 5.5 [3], 5.6 [4]).  Edit the settings you need and include that in `.bp-config/php`.  

The first option is a standard way through PHP to include or override settings.  It works similar to `.htaccess` files with Apache HTTPD.  You place the `.user.ini` file in the directory with your PHP app and PHP will apply those based on the rules defined at [1].

The second option works because you're starting with the base configuration file from the build pack.  This includes some special keys, like [5], which are altered by the build pack at runtime.  Leaving these keys in place will allow you to customize the settings without losing the automatic features of the build pack.  Conversely, if you wanted complete control you would just need to remove those keys.

Dan

--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/53f30183-6409-42a1-b9cb-abe6e7ddc43b%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Daniel Mikusa

unread,
Dec 4, 2014, 2:45:35 PM12/4/14
to vcap...@cloudfoundry.org
Austin,

I don't know if this is intentional, but your sample app has some files that end with ".sample" (Ex:  .bp-config/php/php.ini.sample).  That's probably going to cause issues.  If you didn't intentionally add that extension, you should remove it.

Dan

kar...@tamu.edu

unread,
Dec 4, 2014, 3:05:20 PM12/4/14
to vcap...@cloudfoundry.org, dmi...@pivotal.io
Hi Dan,

It was intentional. I was aware of the .user.ini (it's what I used to modify those values in the original cloudfoundry buildpack), and I just marked that and php.ini.sample to sample whenever I wanted to turn them off. I am noticing the following behavior when trying to use them though:

  • With the php.ini and options.json enabled (meanwhile I have .user.ini.sample), the "local value" and the "master value" of the variables I've overridden change to 500MB. However, the mysqli extension along with the other extensions I'd like to have in options.json don't show up.
  • With the .user.ini and options.json, the extensions are installed, but only the "local value" of each variable is changed. From what I can tell, that isn't enough to change the allowed upload size. When I try that with WordPress, I'm still told the default filesize is only 2MB.
I'm not experienced enough with PHP to know what the local and master values are and how they are interpreted by the application (other than making generic assumptions based on the local and master naming), but it seems like the master value needs to be edited as well. I tried (only very, very briefly) adding an extension=mysqli.so to the php.ini, but that didn't seem to install the extension like I wanted. 

But for general/academic purposes, is it intended to only allow either the php.ini or the options.json to work, and not both? Or should they have worked together as intended?

Thanks,
Austin
Reply all
Reply to author
Forward
0 new messages