Go Back   CP Web Hosting - reseller hosting > Server Scripting
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2007, 02:27 PM
Junior Member
 
Join Date: Mar 2007
Posts: 5
Default Statements in .htaccess resulting in 500 error

Hi,

Whenever a php script requires write access to a file or directory, you have to chmod that directory (or file) to 777 (or 666 for files) on most servers. This is because on most servers apache and php runs as user 'nobody'.
Although giving world write access will make it possible to use the script, it also means a security hole, which can be used by hackers.

To avoid this security hole some ISP's install phpsuexec on their servers. Using phpsuexec php runs under your own username on the server. This removes the necessity to make files and folders world writable. Instead you can just use 755 for folders (the default) and 644 for files (also the default).
Reply With Quote
  #2 (permalink)  
Old 05-21-2007, 02:49 PM
Amb Amb is offline
Junior Member
 
Join Date: Apr 2007
Posts: 5
Default

But using phpsuexec will result in an error 500 (internal server error) for some statements in .htaccess.
Reply With Quote
  #3 (permalink)  
Old 05-21-2007, 02:53 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Default

Quote:
Originally Posted by Amb View Post
But using phpsuexec will result in an error 500 (internal server error) for some statements in .htaccess.
For this, you need to make sure, that whenever you are using files with (or without) an extension different then the normal extension for that filetype you can use ForceType in your .htaccess file to make it clear to the server how to handle that file (or all the files in the folder) (this works on servers without phpsuexec).

??? ForceType application/x-httpd-php

However, when your server uses phpsuexec this will result in an internal server error. To solve this you can simply use SetHandler instead of ForceType, so your .htaccess-file becomes:

??? SetHandler application/x-httpd-php
Reply With Quote
  #4 (permalink)  
Old 05-21-2007, 02:56 PM
Junior Member
 
Join Date: Apr 2007
Posts: 4
Default

On a server without phpsuexec it is possible to use the php_value statement in a .htaccess-file to change settings of php (actually overwrite the settings from php.ini).

On a sever with phpsuexec this will also result in a server error. To solve this you can use a php.ini file which you put in the same folder as where you would have put your .htaccess file. In that php.ini file you can change all the php values. You only have to put the values you want to modify in that file. Let me give one example if you want to set the short_open_tag to Off you would have used short_open_tag? = off in your .htaccess file. Using a php.ini file this results in:

[php]

short_open_tag = Off
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 07:50 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0