From owner-freebsd-questions@FreeBSD.ORG Mon Nov 24 15:19:28 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A635D106564A for ; Mon, 24 Nov 2008 15:19:28 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from mail1.sourcehosting.net (113901-app1.sourcehosting.net [72.32.213.11]) by mx1.freebsd.org (Postfix) with ESMTP id 85B238FC1C for ; Mon, 24 Nov 2008 15:19:28 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from 68-189-244-97.dhcp.oxfr.ma.charter.com ([68.189.244.97] helo=Gregory-Larkins-Computer.local) by mail1.sourcehosting.net with esmtp (Exim 4.69 (FreeBSD)) (envelope-from ) id 1L4dDh-000Itc-9P; Mon, 24 Nov 2008 10:19:26 -0500 Received: from [127.0.0.1] (fireball.entropy.prv [192.168.1.12]) by Gregory-Larkins-Computer.local (Postfix) with ESMTP id A2E4327DD838; Mon, 24 Nov 2008 10:19:24 -0500 (EST) Message-ID: <492AC5FB.4030002@FreeBSD.org> Date: Mon, 24 Nov 2008 10:19:23 -0500 From: Greg Larkin Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: APseudoUtopia References: <27ade5280811231602m4900af50t83daafca16f94b97@mail.gmail.com> In-Reply-To: <27ade5280811231602m4900af50t83daafca16f94b97@mail.gmail.com> X-Enigmail-Version: 0.95.7 OpenPGP: id=1C940290 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.6 (-) Cc: freebsd-questions@freebsd.org Subject: Re: PHP Session Support in /tmp X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: glarkin@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2008 15:19:28 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 APseudoUtopia wrote: > Hey. > > PHP stores session data for the 'file' handler in /tmp, by default. > For organizational purposes, I'd like to change this to something like > /tmp/php_sessions/ or so. However, I have the clear_tmp_enable feature > enabled, so /tmp is cleared on reboot. PHP wont create the > php_sessions dir on it's own. > > So basically, I'm looking for a way to create the dir > /tmp/php_sessions/ each time the server is booted BEFORE apache > starts. I'm sure I could do this somehow with the rc.d scripts, but I > really have no idea how. > > Thanks very much. Hi APseudoUtopia, In addition to the other solutions offered, you can also create a simple script like this and place it in /usr/local/etc/rc.d/make_php_session_dir: - ---------- cut ---------- cut ---------- cut ---------- cut ---------- # PROVIDE: make_php_session_dir # REQUIRE: mountcritlocal # Create the PHP session file directory mkdir -p /tmp/php_sessions - ---------- cut ---------- cut ---------- cut ---------- cut ---------- By using the "REQUIRE: mountcritlocal" tag, the rcorder system invokes this script before the Apache startup script in /usr/local/etc/rc.d. I tested this on 7.0 with a standard Apache 2.2 installation from the ports tree. I hope this helps, and please post any follow-up questions you have. Best regards, Greg - -- Greg Larkin http://www.FreeBSD.org/ - The Power To Serve http://www.sourcehosting.net/ - Ready. Set. Code. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFJKsX70sRouByUApARApxhAJ9IaNPLMchvKf2J4I0P85AxV+JiOgCfSv+8 Y0SwTCn3f288E+lyWL1IMgs= =pm8E -----END PGP SIGNATURE-----