Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Nov 2008 10:19:23 -0500
From:      Greg Larkin <glarkin@FreeBSD.org>
To:        APseudoUtopia <apseudoutopia@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: PHP Session Support in /tmp
Message-ID:  <492AC5FB.4030002@FreeBSD.org>
In-Reply-To: <27ade5280811231602m4900af50t83daafca16f94b97@mail.gmail.com>
References:  <27ade5280811231602m4900af50t83daafca16f94b97@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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-----




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?492AC5FB.4030002>