1
macmend
PHP scripts aproblem in .htaccess
  • 2006/3/15 10:13

  • macmend

  • Quite a regular

  • Posts: 285

  • Since: 2004/2/27


any php_flag script put in an htaccess file on ftp throw a 500 error on my sites, this is difficult because i can't secure my site. My hosts run phpsuexec

I read this:
Quote:
This means that you either need to comment out those invalid PHP-related directives from the .htaccess file by putting a '#' symbol before them, or you need to place your PHP-related directives in an "IfModule" container so that they can be ignored on our system without throwing an error.


Whats an If module container and how does that work with the following scripts:
Quote:
php_flag zlib.output_compression on
php_value zlib.output_compression_level 6

php_flag session.use_trans_sid off

php_flag register_globals off

php_flag session.use_only_cookies on


I also read this:

Quote:
php_value
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. By 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


so does anyone know how do I create a php.ini file and how do i write the above scripts into it. would it look like this for example??

[PHP]

session.use_trans_sid off
Free Mac Support

Ordinary Wisdom

apache server with php sshexec turned on
xoops version 2.0.18.1 & 2.3.1
php version 5.2.5
mysql version 5.0.45

2
svaha
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 11:33

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


With a simple text editor you can create a php.ini file, just save the text as php.ini and ftp that to your site


session.use_cookies = 1
register_globals=off
session.use_trans_sid = 0
zlib.output_compression = On

3
macmend
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 18:49

  • macmend

  • Quite a regular

  • Posts: 285

  • Since: 2004/2/27


thanks...I am slowly getting there, all back up and running at least.
Free Mac Support

Ordinary Wisdom

apache server with php sshexec turned on
xoops version 2.0.18.1 & 2.3.1
php version 5.2.5
mysql version 5.0.45

4
macmend
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 19:09

  • macmend

  • Quite a regular

  • Posts: 285

  • Since: 2004/2/27


I created a php.ini file and learning more a phpinfo file which I used to check. Problem is the PHP info file says that all my instructions have worked, however the protector module tells me that (as an example) register globals in on when phpinfo tells me at both core and locally (as i scripted php.ini) it is off.

Or maybe this needs to be in the module section under scripts and protector module
Free Mac Support

Ordinary Wisdom

apache server with php sshexec turned on
xoops version 2.0.18.1 & 2.3.1
php version 5.2.5
mysql version 5.0.45

5
m0nty
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 22:30

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


zlib.output_compression = On may cause problems with certain scripts.. especially for IE users.

2. the reason protector doesn't agree is that unlike htaccess which affects all sub dirs..

php.ini only affects files executed in the folder it's placed in. therefore for php.ini method, you have to place the ini file in every folder that has a script that executed from the browser..

for example.. you would need it in root, and also every modules folder where xoops_version.php resides and also the admin folders.. and so on..

6
macmend
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 22:38

  • macmend

  • Quite a regular

  • Posts: 285

  • Since: 2004/2/27


Thanks, so my work around needs more work!...so I have to put php.ini in all folders. I thought when you put php.ini in root that all scripts run were effected, other wise what would be the point in having it in the core?

Is there anyother workaround for php sshexec?
Free Mac Support

Ordinary Wisdom

apache server with php sshexec turned on
xoops version 2.0.18.1 & 2.3.1
php version 5.2.5
mysql version 5.0.45

7
m0nty
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 22:44

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


it's not suexec that is the reason u can't have php flags in htaccess, its cos php is running in cgi mode..

nope.. htaccess will do what you require, but php.ini needs to be placed in each folder..

not every folder, just the ones that have scripts in that are executed from the browser itself..

so no need to place it in class folders or include folders etc.

you could probably try placing an include or require call to a php.ini file in the header.php file in the root XOOPS folder, or maybe mainfile.php with an absolute path to the php.ini not relative.. that may work, but i haven't tried it..

8
m0nty
Re: PHP scripts aproblem in .htaccess
  • 2006/3/15 22:46

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


also with suexec, you shouldn't have to set your folders to 777 either.. 755 should suffice.. because the scripts should run as the user instead of nobody..

Login

Who's Online

447 user(s) are online (312 user(s) are browsing Support Forums)


Members: 0


Guests: 447


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits