OS X issues?
| From: | Ed Finkler | Date: | Tue, 30 Apr 2002 16:15:04 +0000 |
| Subject: | OS X issues? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3932@lists.php.net to get a copy of this message | ||
I'm curious to know if anyone has attempted using Smarty under OS X.
Yesterday, I attempted to set Smarty up under PHP 4.2.0 on my TiBook running OS X. I followed the Quickstart instructions closely, setting the permissions and ownership for the template_c directory to 700/www:www, respectively (Apache on OS X runs as the www user by default).
When I tried to view the example described in the Quickstart file, though, I got a ton of permission errors on the stat and mkdir commands. I checked in template_c, and found that the subdirectories that it was producing appeared to have *no* permissions set. I tried pretty much any permutation I could think of to let Smarty write in there, including a chmod on the dir to 777, and changing the _create_dir_structure fuction to make sure the umask is zeroed out:
/*======================================================================*\
Function: _create_dir_structure
Purpose: create full directory structure
\*======================================================================*/
function _create_dir_structure($dir)
{
if (!file_exists($dir)) {
$dir_parts = preg_split('!/+!', $dir, -1, PREG_SPLIT_NO_EMPTY);
$new_dir = ($dir{0} == '/') ? '/' : '';
foreach ($dir_parts as $dir_part) {
$new_dir .= $dir_part;
echo "Setting umask to 0000<br>";
$old_umask = umask(0000); // eliminate umask and backup existing setting
if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) {
$this->trigger_error("problem creating directory \"$dir\"");
return false;
}
echo "Setting umask back to $old_umask<br>";
umask($old_umask); // restore existing umask setting
$new_dir .= '/';
}
}
}
This didn't seem to help.
However, if I set up the Quickstart examples under a Linux server running PHP 4.1.2, it works without a hitch.
The TiBook is behind a tight firewall, so I saved the OS X-serverd page in question (with a dump of the $smarty class instance's properties, as well as a phpinfo() dump) to:
http://www-test.cerias.purdue.edu/smarty.php.html
Thanks in advance!
--
Ed Finkler
Web and Security Archive Administrator
CERIAS - Purdue University
http://www.cerias.purdue.edu/
v: 765.496.6771 f: 764.496.3181