+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: PHP/Apache Configuration

  1. #1
    rlee0001 is offline x10Hosting Member rlee0001 is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    1

    Question PHP/Apache Configuration

    Good morning!

    Is there an easy way, perhaps with a php.ini, or a .htaccess file, to set the PHP/Apache configuration to more "production quality" settings?

    Specifically, I would like to:

    + Disable Magic Quotes
    + Disable All Error Reporting
    + Enable All Errors Logging (e.g. E_ALL | E_NOTICE | E_STRICT)

    Plus maybe some other things, like disabling PHP short tags, but for now, the above three items are the items I really care about.

    With respect to the magic quotes setting, I don't need anyone to tell me about SQL injection attacks. I'd like to sanitize my data properly, not rely on a server misconfiguration/anti-feature to do it for me. I most certainly don't want to use strip_slashes with every access to incoming form data, as that would just produce fragile, and frankly incorrect, code. Not to mention that I'm using a PostgreSQL database, which uses Sybase-style escapes, not the C-style escapes used by MySQL (e.g. PostgreSQL uses '' (two single quotes) where-as MySQL would use \' and \\).

    If anyone really cared at all about security, they'd disable error reporting in a hummingbird's heartbeat.

    I didn't see these settings in cPanel, and I tried using a .htaccess file, but just got a 500, so I assume that the php_flag and php_value directives are disabled, which is perfectly acceptable in-and-of itself. I'm on chopin, if that's relevant.

    Thanks!
    Rob L
    Last edited by rlee0001; 10-15-2009 at 02:41 AM. Reason: Grammer, clarification

  2. #2
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: PHP/Apache Configuration

    Magic quotes cannot be disabled at runtime. This is by design of PHP. You can use the php_value or php_flag directives, but you get a 500 error because it's not changeable in this way. Short tags are disabled. Error reporting can be set to your liking using the .htaccess directives you mentioned.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  3. #3
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP/Apache Configuration

    Since we don't have access to php.ini, and the php_value and php_flag directives are disabled, you're limited to ini_get() and ini_set(). You'll have to manually include a configuration script, since there's no way of setting auto_prepend_file. Sadly, that won't help with some settings, such as magic_quotes_gpc. For that one, you'll either need to test get_magic_quotes_gpc() to conditionally run stripslashes() when you access user input, or have your configuration script do it, which is easier but potentially wasteful.

    Code:
    if (get_magic_quotes_gpc()) {
      $_REQUEST; # so $GLOBALS['_REQUEST'] exists
      foreach (array('_GET', '_POST', '_COOKIE', '_REQUEST') as $k) {
        $GLOBALS[$k] = array_map('stripslashes', $GLOBALS[$k]);
      }
    }
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    ah-blabla's Avatar
    ah-blabla is offline x10 Lieutenant ah-blabla is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    375

    Re: PHP/Apache Configuration

    Would it not be sensible to disable magic quotes server side though, since it is officially deprecated?

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP/Apache Configuration

    Quote Originally Posted by ah-blabla View Post
    Would it not be sensible to disable magic quotes server side though, since it is officially deprecated?
    I'd wouldn't shed any tears if it were disabled, but the admins keep it because it provides a modicum of protection for the users who don't know about SQL injection or know but don't realize how serious it can be. If the forums are any indication, many people with free sites on x10 are at a beginner's level when it comes to security issues.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  6. #6
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP/Apache Configuration

    I'm not sure about the php_value beeing disabled. I recall someone (don't remember who) telling someone else to use it to add a file to check memory usage on pages.
    Edit:
    Quote Originally Posted by ah-blabla View Post
    Would it not be sensible to disable magic quotes server side though, since it is officially deprecated?
    In the message, magic_quotes was deprecated as of PHP 5.3.0, which is not the PHP version x10 uses.
    Last edited by xav0989; 10-15-2009 at 06:43 PM. Reason: Automerged Doublepost
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  7. #7
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP/Apache Configuration

    Quote Originally Posted by xav0989 View Post
    I'm not sure about the php_value beeing disabled. I recall someone (don't remember who) telling someone else to use it to add a file to check memory usage on pages.
    Was it garretroyce? Maybe it's a matter of which host you're on. Whenever I've tried to use php_value on lotus (such as before answering rlee0001's question), I get a 500 Internal Server Error. The logged error is "Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration". Poll time.
    Last edited by misson; 10-15-2009 at 08:16 PM. Reason: added link to poll.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  8. #8
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP/Apache Configuration

    Exactly, you have a better memory than I do

    I'll check on my host... but hey, could it be a premium account only feature. I know that garrett has one.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP/Apache Configuration

    Quote Originally Posted by xav0989 View Post
    Exactly, you have a better memory than I do
    It's probably worse. I tend to rely on offline memory (e.g. the web) and searching. Transhumanism, wot?

    Quote Originally Posted by xav0989 View Post
    I'll check on my host... but hey, could it be a premium account only feature. I know that garrett has one.
    I think you've hit the proverbial nail on its proverbial head.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  10. #10
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: PHP/Apache Configuration

    Quote Originally Posted by misson View Post
    I tend to rely on offline memory (e.g. the web) and searching.
    Isn't the web ONline?
    Last edited by xav0989; 10-15-2009 at 08:31 PM.
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Account keeps getting suspended
    By angels_scam_patrol in forum Free Hosting
    Replies: 8
    Last Post: 12-21-2007, 11:12 PM
  2. Website is down
    By JeffreyWalters in forum Free Hosting
    Replies: 17
    Last Post: 11-28-2007, 12:16 PM
  3. Replies: 7
    Last Post: 10-22-2007, 06:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers