Asked  2 Years ago    Answers:  5   Viewed   68 times

Background: I've got some code that checks to see if a user has a valid session before processing the php page that I would like to set as the auto_prepend_file. However, I need to exclude the page where the user attempts to login from requiring a valid session. I would like to be able to set the auto_prepend_file value on an per directory basis.

Environment: PHP 5.2.6m Apache 2, running php as a cgi not as mod_php, on Windows (if that matters) and on a machine that I have complete control over (not a hosted environment)

Using a htaccess file is out b/c I am not using mod_php. I have not been able to alter the in php.ini to set the auto_prepend_file, the server throws an internal error. And ini_set() does not work b/c it has already loaded the session checking file before I can change the value of auto_prepend_file.

I do not see a way to set auto_prepend_file on a per directory basis if you are not using mod_php/htaccess. Am I missing something?



Use .user.ini files.

Tuesday, December 6, 2022

This will allow either someone from IP or logged as a valid user. Stick it either in your config or .htaccess file.

    <Files learn.php>
        Satisfy any
        Order deny,allow
        Deny from all
        Allow from

        AuthType Basic
        AuthName "private"
        AuthUserFile /var/www/
        AuthGroupFile /dev/null
        Require valid-user

IP Alone:

    <Files learn.php>
        Order deny,allow
        Deny from all
        Allow from

That definitely answers your question.

Wednesday, November 23, 2022

Can I successfully configure Apache/PHP to respond to this request?

Yes. Just use the MultiviewsMatch directive to tell Apache that it can serve .php files regardless of whether their MIME type is compatible with the Accept header:

<Files "*.php">
    MultiviewsMatch Any

From the docs, the effect is as follows:

You may finally allow Any extensions to match, even if mod_mime doesn't recognize the extension.

Friday, October 28, 2022

On the server I ran sudo chown -R git:git /srv/git/ - this fixed my problem but I am wondering if this was the correct thing to do?

Absolutely. The problem previously was that the git user, who you're logging in as via SSH, could not write to the repository.

Depending on your needs, you may consider different combinations of users and SSH keys, or one of the many additional programs (gitolite etc) that can be used to more finely control access.

Saturday, November 26, 2022

It looks like your p4settings.txt config file isn't being used; otherwise the client name returned by "p4 info" would match the P4CLIENT value in the config file. Run:

p4 set P4CONFIG=p4settings.txt

and make sure that when you run "p4 info" you're doing it from a directory underneath ~/dev/trunk. (Your "p4 info" output in the question shows your current directory as /Applications, so that might explain the problem on its own -- just do "cd ~/dev/trunk" and try again.)

The "client unknown" error suggests that maybe your client spec got deleted (this is assuming you're connecting to the same server and using the same client name you were successfully using before). If that's what happened you can create a new one with the same name by running:

p4 client
Monday, December 12, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :

Browse Other Code Languages