Jump to content

Per user .htaccess and php.ini


neogranas

Recommended Posts

I started the thread here, did get some response but it didn't go far. I was hoping I could get some more answers.

 

I have a Fedora 9 server running Apache 2 and PHP 5. For the life of me I cannot get .htaccess to work at all, and if I put a second php.ini file outside of /etc, say in the folder where I had a Joomla install, it would not recognize it.

 

I was told that I had to compile php as a cgi binary, not a module for apache. Does anyone know how to do that or knows of a decent how to article that was already written?

Link to comment
Share on other sites

You will need to get .htaccess working firstly. Try the following in a .htaccess file:

###

deny from all

###

and see if you get a webpage access denied.

If it does not work, then you'll need to add "allow overrride all" to your apache config.

 

Once you have .htaccess working for a particular directory, then you can look towards using a specific php.ini.

 

-steve

Link to comment
Share on other sites

deny from all did not work, however, I did get a rewrite to work. So I assume it is working, but not fully or as I would expect.

 

And I should clarify, it's not really per 'user' it would be per directory so I can have a php.ini or .htaccess in any directory containing the rules and settings that I want for that directory specifically.

Link to comment
Share on other sites

I finally found out how to get it all working.

 

.htaccess:

In either the httpd.conf/apache.conf or if you use your own config files in conf.d add this:

<Directory /path/to/your/public/folder/>
    AllowOverride All
</Directory>

Then any folder after that will also be able to use them.

 

php.ini for your directories:

You'll need to install mod_suPHP first.

Then in your /etc/httpd/conf.d/suphp.conf file you should see options for:

#suPHP_AddHandler php5-script

Uncomment that line to activate suPHP, then below that you should see:

#suPHP_ConfigPath /etc

Below that is where you specify where you want additional directories to be checked for php.ini files. Because I am hosting a few different websites using VirtualHosts, here is what I use:

suPHP_ConfigPath /home/*/public_html/*

That allows any user's folders in the public_html folder (which isn't actually publicly available, just the ones inside it) to have their own php.ini

 

You'll obviously need to restart apache after configuring all of this, but I tested it on my system and it's working as expected. You'll need to look at different php.ini settings as most will reference root owned folders for some things like sessions and such, but it will at least get it working!

 

It was incredibly simply once I knew what to install.

Link to comment
Share on other sites

I talked to a few other people who knew linux (both Ubuntu and Fedora) better than I, you should have any problem chmod'ing /var/lib/php/sessions to 777, getting around the pesky error about not having access to it, and you don't have to create/specify a different directory for each user.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.