?
Solved

using .htaccess to configure PHP

Posted on 2010-01-09
3
Medium Priority
?
641 Views
Last Modified: 2013-12-13
We use a 3rd party hosting service to host our PHP-enabled websites. They have blocked access to php.ini, so I read up on php.net about using .htaccess files to set configuration directives.

In a directory I use for learning PHP, called _learning, i created a .htaccess file with the following contents, in order to override values in PHP.ini (see code window):

..but when I accessed a php script in this directory, I got a server error.
There was no entry in the error_log afterwards
If I comment out the last line in .htaccess, the script works as normal.

any ideas?
Is use of .htaccess disabled? I don't think so because I think a colleague used them before, but how can I tell?
Am i using correct format?
#php_value name value
#php_value pcre.backtrack_limit "100001"
php_flag session.auto_start on

Open in new window

0
Comment
Question by:zorba111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 1000 total points
ID: 26274942
Put this in your .htaccess in your test folder

Redirect permanent / http://news.bbc.co.uk

Then go http://mydomain.com/_learning/ and you will be redirected to the BBC news page if the .htaccess is working

0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 1000 total points
ID: 26274962
ask your webhost if you can use a custom php.ini file. For instance, in the past I've used the following in an .htaccess file:
SetEnv PHPRC /path/to/my/custome/config/file

when my site was executed, the server was loading:
/path/to/my/custome/config/file/php.ini

As for "Is use of .htaccess disabled?"
If the server has a :
php_admin_flag session.auto_start off

then you would not be able to override that with
php_flag session.auto_start on

So see if you can use your own php..ini file
0
 

Author Comment

by:zorba111
ID: 26275170
This is what the hosting ppl said:

Our servers do not support PHP directives in .htaccess due to suPHP that we have to used in a shared environment.

so that's that !

I found a way around the immediate need to configure include_path (i.e. just specify the library with complete path)
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question