HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[RESOLVED!] Default route to php.ini file?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#95188 (In Topic #18951)
Avatar

Honoured member

Question:  My site options is reporting back the following configuration:

  • the PHP option post_max_size (currently 16 Mb)
  • the PHP option upload_max_filesize (currently 16 Mb)
The host server is managed by someone I know personally and I trust him.  I asked him to check the php.ini files on the host server to change the settings for me and he came back telling me that all occurances of the php.ini file already have those parameter values set considerably higher.

Soooo, my question is:  Is there a default location that the application queries (by design) to locate the php.ini file?  I don't want to send him on a goose chase trying to find this.

Thank you,

Mark
Back to the top
 
Posted
Rating:
#95192
Avatar

ocPortal has no way to specify where PHP's options come from, and these particular ones can't be set within PHP either.

Different servers work in different ways. CGI ones typically look for a php.ini in the same folder as the .php file in the URL. Non-CGI ones typically look for any .htaccess file in any directory all the way up to the root of the domain.

However, it is my understanding that servers can have multiple php.ini files, and php.ini files for domains, and that there is a way of them being searched or included conditionally. I don't know how that works myself exactly either.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#95193
Avatar

Honoured member

Hi Chris,

I'm a little confused because historically I have changed those specific parameters in the php.ini file and the hosted applications have inherited those permissions.

The confusing thing here is, when I query the server via control panel, it reports back a significantly higher value:

File Uploads upload_max_filesize Maximum allowed size for uploaded files. 200M

In theory, the upload_max_filesize parameter of 200mb should be reflected by OCPortal in the uploads section of configuration under the set up menu (it behaves properly on 2 other OCP sites, just not this one???)

Mark

PS:  It appears that the end of the table got cut off, it shows a value of 200M


Last edit: by superiorpyro
Back to the top
 
Posted
Rating:
#95194
Avatar

Try 200M not 200mb…

PHP: Using PHP - Manual


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#95195
Avatar

Honoured member

200M is the way it's configured in the file...
Back to the top
 
Posted
Rating:
#95196
Avatar

For one thing, there's no single php.ini file. It needs to be duplicated in every directory a .php script might be loaded by URL from. So adminzone, cms, data_custom etc. But not things like sources, as no URLs directly access that. If you have it in adminzone, then the configuration would report from that, as the configuration is running via adminzone/index.php.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#95198
Avatar

Honoured member

Totally agree that there are usually multiple php.ini files, and that's what is puzzling here:  Supposedly the server admin has found all instances and checked each one and is telling me that none of them have any values set that low??

Thanks anyway, Chris.  My thought was that perhaps ocP may have had a specific path it checked first, but to your point I suppose that wouldn't make sense.

I'll have to keep digging -- this 16mb constraint is causing all sorts of havoc with the end users :(
Back to the top
 
Posted
Rating:
#95202
Avatar

Community saint

You should just be able to add a php.ini file into the folder that affexts the uploads with the settings you want in it. Have you tried that?
Back to the top
 
Posted
Rating:
#95208
Avatar

Community saint

On my host I only have two php.ini's, and the one that has post_max_size and upload_max_filesize are in the public_html folder.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#95223
Avatar

Honoured member

Thanks Duck and Temp!

I believe that I'm going to have to go down that path and add the file in either the public_html directory or as Chris pointed out, in the adminzone directory.

I know it's not unusual to have multiple instances of that file...what's strange in this case is that when we check all the occurences across the server, none of them have the values set that low!?!?

Could be just one of mysteries of life :ninja:  Either way, will add another php.ini file and give it a go.  I'll report back here.

Mark
Back to the top
 
Posted
Rating:
#95225
Avatar

Maybe there's no active php.ini on the server at all. It's possible it's not finding any of them.

phpinfo usually says where the main php.ini is located.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Chris Graham)  
Rating:
#95228
Avatar

Community saint

I found this thread on ubuntu forums that may be of use. It appears someone discovered that a syntax error in the php.ini file would cause the settings to not be honoured correctly. I would try having your host replace the 2 php.ini files with default ones and  then change your settings accordingly and see if it works.

Thread php.ini settings not being taken

Ok, I've found out what the problem was (at least in my case). At some point I had introduced a syntax error in the php.ini file right at the beginning, and this was preventing any further directives from being read. Once the error was fixed, my upload_max_filesize directive was good to go.

I figured this out by realising that if I placed the directive I wanted to at the beginning of the file then it was honoured, so I gradually moved it down the file until it stopped working and that led me to spot the error.

I'm not going to admit what the syntax error was, cause that's just too embarrassing!

I hope this is of use to someone.
Back to the top
 
Posted
Rating:
#95231
Avatar

That could well be it. Try "php --info | less" on the command line and see if it spits any errors out.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#95280
Avatar

Honoured member

I did execute the phpinfo script and I see where the application is getting the parameter from, what I'm not familiar with is idea of Local Value vs. Master Value (I don't think I've run into this before?), see the table below.  There is definitely an active php.ini file, as phpinfo is reporting its location on the server:

Loaded Configuration File /usr/local/lib/php.ini

Configuration

PHP Core

Directive Local Value Master Value
post_max_size 16M 55M
upload_max_filesize 16M 200M
Back to the top
 
Posted
Rating:
#95281
Avatar

If it is suPHP on the server, IIRC sometimes there are PHP settings written directly into the Apache site files for its sites. I guess these are passed through via some way separate to the normal .htaccess/php.ini mechanism. So he should find the Apache site configuration file for your domain and look for post_max_size in it, that may be it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#95316
Avatar

Honoured member

Thank you Chris... I'm just waiting to hear back from the admin (this part of having a hosted account sucks!!).  Apparently he's not in a big hurry to get back to me :dry:

Will update here as soon as I hear back from him.
Back to the top
 
Posted
Item has a rating of 5 (Liked by FletchLiked by Guest)  
Rating:
#99767
Avatar

Honoured member

I promised I would update here, and believe it or not, it has been this long to get it sorted out :lol:

Anyway, here's the deal:  It turns out that PHP core has 2 distinct values (as I noted above somewhere), local value and master value.  You would think the master value would override the local but that's not the case, in fact it's inverse of that.

After searching and searching for issues within the PHP.ini file, I was reading through an article on stackoverflow.com and came across this tidbit:

"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccess or other Apache configuration with php_value directive.

I started checking the .htaccess files from the root directory up into the OCP application directory on my host's server...

BINGO!

The .htaccess file located within /public_html/"myappdirectory" has this code at the beginning:

# Disable inaccurate security scanning (ocPortal has it's own)
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

# ocPortal needs uploads; many hosts leave these low
php_value post_max_size "16M"
php_value upload_max_filesize "16M"

Hence the "Local value" that was over riding the parameter set within the PHP.ini file.  I had no clue that code even existed within the .htaccess file as I've never had this issue on any other OCP site (and I have several).

In case anybody ever runs into this down the road, I figured after this much pain and suffering, I owed it to them to post this follow-up.  Thx to all who helped sort through this!

Cheers!
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: