FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Can't change upload_max_filesize
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Can't change upload_max_filesize [message #183200 is a reply to message #183193] Sat, 12 October 2013 05:00 Go to previous messageGo to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Fiver wrote:

> On 2013-10-12 02:45, Thomas 'PointedEars' Lahn wrote:
>> Fiver wrote:
>>> On 2013-10-11 19:23, Thomas 'PointedEars' Lahn wrote:
>>>> Denis McMahon wrote:
>>>> > cd /etc
>>>> >
>>>> > sudo grep -R upload_max_filesize *
>>>>
>>>> sudo grep --color -Irwe upload_max_filesize /etc/
>>>>
>>>> is infinitely more useful.
>>>
>>> Maybe for your personal definition of "useful" (or infinity).
>>
>> … which is currently based on more than 13 years of *professionally*
>> maintaining GNU/Linux systems, including Debian and Ubuntu based ones,
>> running PHP-powered Web sites. You would do well to listen to that.
>
> Thanks for the admonition. 13 years is nothing to scoff at, and good for
> you, but age does not a wise man make. I still have a few years of
> experience on you, and in this case, I think, it shows.

We'll see about that.

>>> -I
>>> skips all files detected as binary; probably makes no difference in
>>> this case, but might hide information you're looking for
>>
>> Nonsense. This is a full-*text* search; it does not make sense to search
>> in binaries at all.
>
> When you can't find a specific setting, and you've exhausted all of the
> obvious candidates, you will eventually include binaries in your search.
> At least you should, IMHO.

For what purpose? Do you even know what a *binary* is?

> Let's just compare the findings on my current box:
>
> # first, try it your way: with -I
> root@redacted-host:/ # grep -lIRwe upload_max_filesize etc 2>/dev/null
> /etc/apache2/sites-enabled/040-redacted1
> /etc/apache2/sites-enabled/011-redacted2
> /etc/apache2/sites-enabled/020-redacted3
> /etc/apache2/sites-enabled/012-redacted4
> /etc/apache2/sites-enabled/080-redacted5
> /etc/php5/apache2/php.ini
> /etc/php5/cli/php.ini
>
> # now without -I
> root@redacted-host:/ # grep -lRwe upload_max_filesize etc 2>/dev/null
> /etc/apache2/sites-enabled/040-redacted1
> /etc/apache2/sites-enabled/011-redacted2
> /etc/apache2/sites-enabled/020-redacted3
> /etc/apache2/sites-enabled/012-redacted4
> /etc/apache2/sites-enabled/080-redacted5
> /etc/php5/apache2/php.ini
> /etc/php5/cli/php.ini
> /etc/alternatives/php
>
> You'll notice an additional result when we're not skipping binaries.
> This file is very unlikey to be the root of the problem, but I'd still
> like to be aware of it, because it does contain the search string. If
> all else fails, we'll get back to it.

On a current Ubuntu Linux system, /etc/alternatives/php is a symlink to
/usr/bin/php5 (try “sudo update-alternatives --config php”):

$ ls -l /etc/alternatives/php
lrwxrwxrwx 1 root root 13 Aug 8 09:50 /etc/alternatives/php ->
/usr/bin/php5

What sense does it make to search that binary, or any other binary?
*None* *at* *all*.

>>> -r
>>> skips symlinked files that the GP would have included with -R;
>>> definitely a bad choice when searching for a mystery config setting
>>
>> [Only wannabes talk about computer technology in terms of mysticism and
>> incantations. There is no “mystery config setting” here. It is simply
>> binary logic instead: either there is something causing this behavior,
>> then this problem can be solved by changing the configuration; or there
>> is not, then this problem can only be solved by exchanging the software.]
>
> Oh dear, you got hung up on the word "mystery". May I suggest consulting
> a dictionary? Also, "wannabes? It's too soon for ad hominems, we're
> still having a pleasant chat.

Well, *I* am having a _technical discussion_ with you.

>> “-r” instead of “-R” prevents grep(1) from going into an endless loop
>> (which is allowed for symlinks).
>
> Pff, fuck the potential endless loops here. I've never seen that happen
> in practice, and while it may be technically possible, it's easy enough
> to abort with Ctrl-C.

So you do not care about the consequences of your actions. Very
professional, indeed :->

You would *honestly* recommend that to the OP? No, I don't think so.

> Look what happens if you don't dereference symlinks (this is still the
> same box as before):
>
> root@redacted-host:/ # grep -r upload_max_filesize /etc 2>/dev/null
> Result: (zilch, nada, nil)

Liar.

> Okay, now when we follow the the symlinks...
>
> root@redacted-host:/ # grep -R upload_max_filesize /etc 2>/dev/null
> /etc/apache2/sites-enabled/040-redacted1:
> php_value upload_max_filesize 100M
> /etc/apache2/sites-enabled/011-redacted2:
> #php_value upload_max_filesize 100M
> /etc/apache2/sites-enabled/020-redacted3:
> #php_value upload_max_filesize 100M
> /etc/apache2/sites-enabled/012-redacted4:
> php_value upload_max_filesize 10M
> /etc/apache2/sites-enabled/080-redacted5:
> php_value upload_max_filesize 100M
> /etc/php5/apache2/php.ini:
> ; [note] -- yes, leave this at 10M! see upload_max_filesize
> ;upload_max_filesize = 2M
> upload_max_filesize = 10M
> /etc/php5/cli/php.ini:
> ; [note] -- yes, leave this at 10M! see upload_max_filesize
> ;upload_max_filesize = 2M
> upload_max_filesize = 10M
> Binary file /etc/alternatives/php matchesa
>
> Much more relevant, don't you think? And look! None of these files are
> actually under /etc, they're linked in from their separate project
> directories. Without -R, you won't be able to see them.
>
> Case rested for -R vs -r (unless you're terrified of unstoppable loops).

Where have you learned to lie so badly? In a *standard Ubuntu setup*,

1. you would not be root (“#”) as Ubuntu does not set a password for root by
default. You would be using sudo(8) instead.

2. a recursive search would search in /etc/apache2/sites-available as well,
and would find *duplicate* results with “-R” because of symlinks

/etc/apache2/sites-enabled/040-redacted1 → /etc/apache2/sites-available/040-
redacted1

aso.

Example:

$ cat /etc/apache2/sites-available/zf2-tutorial
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
SetEnv ZF2_PATH "/opt/php/ZendFramework/library"
<Directory /var/www/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

$ grep -Inrwe ZF2_PATH /etc 2>/dev/null
/etc/apache2/sites-available/zf2-tutorial:5: SetEnv ZF2_PATH
"/opt/php/ZendFramework/library"

$ grep -InRwe ZF2_PATH /etc 2>/dev/null
/etc/apache2/sites-available/zf2-tutorial:5: SetEnv ZF2_PATH
"/opt/php/ZendFramework/library"
/etc/apache2/sites-enabled/zf2-tutorial:5: SetEnv ZF2_PATH
"/opt/php/ZendFramework/library"

Because:

$ ls -l /etc/apache2/sites-enabled/zf2-tutorial
lrwxrwxrwx 1 root root 31 Jul 23 06:13 /etc/apache2/sites-enabled/zf2-
tutorial -> ../sites-available/zf2-tutorial

And you need that “2>/dev/null” primarily because of *all* *the* *useless*
*searches* in and below /etc/:

$ grep -InRwe ZF2_PATH /etc
grep: /etc/rc2.d/S22hal: No such file or directory
grep: /etc/rc2.d/S23saned: No such file or directory
grep: /etc/rc2.d/S21clamav-daemon: No such file or directory
grep: /etc/rc2.d/S25stop-bootlogd: No such file or directory
grep: /etc/rc2.d/S20foldingathome: No such file or directory
grep: /etc/rc2.d/S01portmap: No such file or directory
grep: /etc/auto.cifs.[…]: Permission denied
/etc/apache2/sites-available/zf2-tutorial:5: SetEnv ZF2_PATH
"/opt/php/ZendFramework/library"
/etc/apache2/sites-enabled/zf2-tutorial:5: SetEnv ZF2_PATH
"/opt/php/ZendFramework/library"
grep: /etc/default/cacerts: Permission denied
grep: /etc/gshadow-: Permission denied
grep: /etc/rc3.d/S22hal: No such file or directory
grep: /etc/rc3.d/S23saned: No such file or directory
grep: /etc/rc3.d/S21clamav-daemon: No such file or directory
grep: /etc/rc3.d/S25stop-bootlogd: No such file or directory
grep: /etc/rc3.d/S20foldingathome: No such file or directory
grep: /etc/rc3.d/S01portmap: No such file or directory
grep: /etc/.pwd.lock: Permission denied
grep: /etc/boinc-client/gui_rpc_auth.cfg: Permission denied
grep: /etc/polkit-1/localauthority: Permission denied
grep: /etc/rc6.d/K02clamav-daemon: No such file or directory
grep: /etc/rc6.d/K01saned: No such file or directory
grep: /etc/rc6.d/K01foldingathome: No such file or directory
grep: /etc/rc6.d/K01portmap: No such file or directory
grep: /etc/rc6.d/K01fuse: No such file or directory
grep: /etc/ppp/chap-secrets: Permission denied
grep: /etc/ppp/pap-secrets: Permission denied
grep: /etc/auto.smb.[…]: Permission denied
grep: /etc/rc5.d/S22hal: No such file or directory
grep: /etc/rc5.d/S23saned: No such file or directory
grep: /etc/rc5.d/S21clamav-daemon: No such file or directory
grep: /etc/rc5.d/S25stop-bootlogd: No such file or directory
grep: /etc/rc5.d/S18foldingathome: No such file or directory
grep: /etc/rc3.d/S01portmap: No such file or directory
grep: /etc/.pwd.lock: Permission denied
grep: /etc/boinc-client/gui_rpc_auth.cfg: Permission denied
grep: /etc/polkit-1/localauthority: Permission denied
grep: /etc/rc6.d/K02clamav-daemon: No such file or directory
grep: /etc/rc6.d/K01saned: No such file or directory
grep: /etc/rc6.d/K01foldingathome: No such file or directory
grep: /etc/rc6.d/K01portmap: No such file or directory
grep: /etc/rc6.d/K01fuse: No such file or directory
grep: /etc/ppp/chap-secrets: Permission denied
grep: /etc/ppp/pap-secrets: Permission denied
grep: /etc/auto.smb.amarone: Permission denied
grep: /etc/rc5.d/S22hal: No such file or directory
grep: /etc/rc5.d/S23saned: No such file or directory
grep: /etc/rc5.d/S21clamav-daemon: No such file or directory
grep: /etc/rc5.d/S25stop-bootlogd: No such file or directory
grep: /etc/rc5.d/S18foldingathome: No such file or directory
grep: /etc/rc5.d/S01portmap: No such file or directory
grep: /etc/dbconfig-common/phpmyadmin.conf: Permission denied
grep: /etc/dbconfig-common/config: Permission denied
grep: /etc/news/leafnode/config.0: Permission denied
grep: /etc/news/leafnode/config: Permission denied
grep: /etc/authbind/byuid/115: Permission denied
grep: /etc/exim4/passwd.client: Permission denied
grep: /etc/apt/trusted.gpg~: Permission denied
grep: /etc/apt/trusted.gpg: Permission denied
grep: /etc/X11/Xwrapper.config: Permission denied
grep: /etc/mtab.fuselock: Permission denied
grep: /etc/shadow: Permission denied
grep: /etc/ati/inst_path_override.backup-62: Permission denied
grep: /etc/ati/inst_path_default.backup-63: Permission denied
grep: /etc/ati/inst_path_default.backup-62: Permission denied
grep: /etc/ati/inst_path_override.backup-63: Permission denied
grep: /etc/group-: Permission denied
grep: /etc/sudoers.d/README: Permission denied
grep: /etc/rc1.d/K02clamav-daemon: No such file or directory
grep: /etc/rc1.d/K01saned: No such file or directory
grep: /etc/rc1.d/K01foldingathome: No such file or directory
grep: /etc/rc1.d/K01portmap: No such file or directory
grep: /etc/rc1.d/K01hal: No such file or directory
grep: /etc/sudoers: Permission denied
grep: /etc/rcS.d/S21microcode.ctl: No such file or directory
grep: /etc/rcS.d/S04bootlogd: No such file or directory
grep: /etc/rcS.d/S22stop-bootlogd-single: No such file or directory
grep: /etc/rcS.d/S21fuse: No such file or directory
grep: /etc/rcS.d/S13pcmciautils: No such file or directory
grep: /etc/rcS.d/S07hibernate: No such file or directory
grep: /etc/rcS.d/S09mtab.sh: No such file or directory
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleL_en_US_months_:
Permission denied
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleL_en_US_days_:
Permission denied
grep: /etc/dosemu/drives/d/tmp/wpa_ctrl_10002-1: No such device or address
grep: /etc/dosemu/drives/d/tmp/qtsingleapp-homepe-d03a-3e8: No such device
or address
grep: /etc/dosemu/drives/d/tmp/zend_cache---internal-metadatas---
Zend_LocaleC_en_US_pm_: Permission denied
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleC_en_US_field_week:
Permission denied
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleC_en_US_am_:
Permission denied
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleC_en_US_relative_0:
Permission denied
grep: /etc/dosemu/drives/d/tmp/.ICE-unix/5439: No such device or address
grep: /etc/dosemu/drives/d/tmp/ksocket-pelinux/klauncherMT5363.slave-socket:
No such device or address
grep: /etc/dosemu/drives/d/tmp/ksocket-[…]/kdialogtQ8548.slave-socket: No
such device or address
grep: /etc/dosemu/drives/d/tmp/ksocket-[…]/kdeinit4__0: No such device or
address
grep: /etc/dosemu/drives/d/tmp/.X11-unix/X0: No such device or address
grep: /etc/dosemu/drives/d/tmp/zend_cache---internal-metadatas---
Zend_LocaleL_en_US_days_: Permission denied
grep: /etc/dosemu/drives/d/tmp/zend_cache---Zend_LocaleC_en_US_pm_:
Permission denied
grep: /etc/dosemu/drives/d/tmp/akonadi-[…].wX8VmV/akonadiserver.socket: No
such device or address
grep: /etc/dosemu/drives/d/tmp/akonadi-[…].wX8VmV/mysql.socket: No such
device or address
grep: /etc/dosemu/drives/c/tmp/pulse-QUlSey7aLUGn/native: No such device or
address
grep: /etc/dosemu/drives/c/tmp/pulse-QUlSey7aLUGn/dbus-socket: No such
device or address
grep: /etc/dosemu/drives/c/tmp/ssh-tPv9ysn5Pz7x/agent.4909: No such device
or address
grep: /etc/dosemu/drives/c/tmp/zend_cache---internal-metadatas---
Zend_LocaleC_en_US_am_: Permission denied
grep: /etc/dosemu/drives/c/tmp/.wine-1000/server-803-1ac271/socket: No such
device or address
grep: /etc/dosemu/drives/c/tmp/pulse-2L9K88eMlGn7: Permission denied
grep: /etc/dosemu/drives/c/tmp/zend_cache---internal-metadatas---
Zend_LocaleC_en_US_relative_0: Permission denied
grep: /etc/dosemu/drives/c/tmp/zend_cache---internal-metadatas---
Zend_LocaleC_en_US_field_week: Permission denied
grep:
/etc/dosemu/drives/c/tmp/.org.chromium.Chromium.50SQiV/SingletonCookie: No
such file or directory
grep:
/etc/dosemu/drives/c/tmp/.org.chromium.Chromium.50SQiV/SingletonSocket: No
such device or address
grep: /etc/dosemu/drives/c/tmp/pulse-PKdhtXMmr18n: Permission denied
grep: /etc/dosemu/drives/c/tmp/.winbindd/pipe: No such device or address
grep: /etc/dosemu/drives/c/tmp/zend_cache---internal-metadatas---
Zend_LocaleL_en_US_months_: Permission denied
grep: /etc/dosemu/drives/c/tmp/.esd-1000/socket: No such device or address
grep: /etc/cups/classes.conf.O: Permission denied
grep: /etc/cups/printers.conf.O: Permission denied
grep: /etc/cups/ssl: Permission denied
grep: /etc/cups/classes.conf: Permission denied
grep: /etc/cups/printers.conf: Permission denied
grep: /etc/auto.smb.amarone.dys.ch: Permission denied
grep: /etc/rc4.d/S22hal: No such file or directory
grep: /etc/rc4.d/S23saned: No such file or directory
grep: /etc/rc4.d/S21clamav-daemon: No such file or directory
grep: /etc/rc4.d/S25stop-bootlogd: No such file or directory
grep: /etc/rc4.d/S18foldingathome: No such file or directory
grep: /etc/rc4.d/S01portmap: No such file or directory
grep: /etc/shadow-: Permission denied
grep: /etc/auto.smb.gentoo.dys.ch: Permission denied
grep: /etc/auto.smb.gentoo: Permission denied
grep: /etc/at.deny: Permission denied
grep: /etc/sudoers.dpkg-old: Permission denied
grep: /etc/websvn/svn_deb_conf.inc: Permission denied
grep: /etc/phpmyadmin/htpasswd.setup: Permission denied
grep: /etc/phpmyadmin/config-db.php: Permission denied
grep: /etc/gshadow: Permission denied
grep: /etc/mtab~24839: Permission denied
grep: warning: /etc/alternatives/libGL.so-master/libGL.so-master: recursive
directory loop
grep: /etc/alternatives/pluginappletviewer: No such file or directory
grep: /etc/ssl/certs/TC_TrustCenter_Universal_CA_III.pem: No such file or
directory
grep: /etc/ssl/certs/Equifax_Secure_eBusiness_CA_2.pem: No such file or
directory
grep: /etc/ssl/private: Permission denied
grep: /etc/security/opasswd: Permission denied
grep: /etc/mysql/debian.cnf: Permission denied
grep: /etc/ssh/ssh_host_dsa_key: Permission denied
grep: /etc/ssh/ssh_host_rsa_key: Permission denied
grep: /etc/rc0.d/K02clamav-daemon: No such file or directory
grep: /etc/rc0.d/K01saned: No such file or directory
grep: /etc/rc0.d/K01foldingathome: No such file or directory
grep: /etc/rc0.d/K01portmap: No such file or directory
grep: /etc/rc0.d/K01fuse: No such file or directory
grep: /etc/passwd-: Permission denied

>>> -w
>>> pointless, unless you expect upload_max_filesize to be part of a
>>> longer word
>>
>> “-w” searches for *words*, not just for substrings. No, that is _not_
>> pointless here. It might be even better to search for
>> '\<upload_max_filesize[url=:space:]:space:[/url]*=',
>> '\<php_\(admin_\)\?value[url=:space:]:space:[/url]upload_max_file\>' (or its egrep
>> equivalent instead.
>
> Wtf, we're just searching for a plain text string here, don't
> artificially overcomplicate it. A substring search is fine. There's no
> need for word boundaries here, and thus -w is unnecessary.

IYVHO. Since we are matching an expression *in* *any* *case* (unless we use
“-F”), we might as well do it *properly* to *avoid* *false* *positives*.

Especially when we are – *unnecessarily* – searching a whole subtree, and –
by *disadvantage* of “-R” instead of “-r” – maybe even *the* *whole*
*system* *or* *LAN* (across filesystems even as allowed for symlinks).

>>> -e
>>> pointless, unless you're using a regex, which you're not
>>
>> Nonsense. GNU grep(1) as in Ubuntu uses POSIX Basic Regular Expressions
>> *by default* (“-F” searches for fixed strings). “-e” is merely used so
>> that expressions starting with “-” are not considered options. I am
>> using it out of good habit; it is not strictly necessary *here* because
>> the pattern does not start with “-”.
>
> Glad we agree on that: -e wasn't necessary.

This time. Next time you want to refine the search and then it may become
necessary.

What you apparently do not get is that in *any* case (“-F” aside) a regular
expression will be matched (an unescaped “.” even *without* “-e” – and
without “-F” – means *any character* except newline; _not_ a literal dot.
Quoted, but unescaped “[foo]” means the *character class* consisting of “f”
and “o”, aso.)

>>> For example, with a default Ubuntu setup, there are vhost config files
>>> linked from /etc/apache2/sites-enabled, where PHP config settings can be
>>> made with the "php_value" directive.
>>
>> I am aware of that (the OP is not, because they would not RTFM); the link
>> targets are in /etc/apache2/sites-available/ (the a2ensite and a2dissite
>> commands then make it easy to enable and disable Virtual Hosts by just
>> adding and removing those symlinks). That makes this recursive search
>> even
>> more a waste of time. The *exact* config file for the *used* Virtual
>> Host, its includes, and the server/PHP configuration files in and under
>> its DOCUMENT_ROOT should be consulted instead.
>
> The vhost configs would have been found had you had used the -R option
> for grep, instead of -r.

No, either you are lying or you are not running a standard Ubuntu Apache
setup (set up with a2ensite(8)).

> As for the various INI_PER_DIR settings in .htaccess files, and the PHP
> files themselves, yeah, you'd have to add more tree roots than just /etc.

No, you do not have to do such utter nonsense. In fact, on a *real* server
you might get in *real* *trouble* that way, causing that much system/disk
load, and taking that unnecessarily long to fix the problem.

The *correct* and *responsible* approach is – after grepping
httpd.conf/apache2.conf and the php.ini for Apache – to use grep(1) or
ack(1) to find the Virtual Host configuration file (usually by domain name),
inspect it with a text editor (I would suggest Vim because it can navigate
with gf or C-w,f), check its includes, and check in and below its document
root (since you *know* the path, you *know* where to look).


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to transfer value to iframe?
Next Topic: counting the plays
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 04:52:05 GMT 2024

Total time taken to generate the page: 0.04138 seconds