# FreeNAS: Newbie questions about compiling php mod and storage permission type



## guik (Aug 29, 2015)

Hello all,

I started my freenas home storage since one month. I'm a newbie with UNIX environment but I'm trying hard! I need some help with my owncloud jail and also some advises on storage permission type (Windows or Unix).
*
Jail Versions*

```
Freebsd : FreeBSD owncloud_1 9.3-RELEASE-p16 FreeBSD 9.3-RELEASE-p16 #1 r281084+74d0d7a: Mon Jun 29 14:32:16 PDT 2015     root@build3.ixsystems.com:/tank/home/jkh/build/FN/objs/os-base/amd64/tank/home/jkh/build/FN/FreeBSD/src/sys/FREENAS.amd64  amd64
Server: Apache/2.4.10 (FreeBSD) OpenSSL/1.0.2d
Database: SQLite
OC-Version: version":"8.1.1.3","versionstring":"8.1.1"
PHP-Version: PHP/5.4.32
```

*I. PHP module issue*
I'm trying to mount my SMB/CIFS Storage in owncloud WEB-GUI (it works fine with smbclient command) but the PHP script seems to have troubles with smb lib:

http-error.log

```
[Thu Aug 27 22:08:45.189795 2015] [:error] [pid 85907] [client x.x.x.x:51177] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in /usr/pbi/owncloud-amd64/ww
w/owncloud/apps/files_external/3rdparty/icewind/smb/src/RawConnection.php on line 95, referer: https://xxx.xxx.xxx/owncloud/index.php/settings/personal
```
According to owncloud forums, I need libsmbclient-php (https://github.com/eduardok/libsmbclient-php). So I installed dependencies such as net/samba-libsmbclient and archivers/php56-phar/. And now I've compiled it but I don't have good API version:

http-error.log

```
PHP Warning:  PHP Startup: libsmbclient: Unable to initialize module\nModule compiled with module API=20131226\nPHP    compiled with module API=2010052│
19│5\nThese options need to match\n in Unknown on line 0
```

My questions are:

I tried to compile with lang/php56-extensions/ but libsmbclient is missing when i run `make config`.  Is this the good way to compile the libsmbclient-php and if it is, how can I add the lib in the config, I didn't found port?
Owncloud packages (apache, php, etc.) are installed in my jail in /usr/pbi/owncloud-amd64/. Below is the MakeFile I used for compiling the libsmbclient-php with bad API version, is there something wrong? :
	
	



```
srcdir = /root/libsmbclient-php-0.6.1
```



```
builddir = /root/libsmbclient-php-0.6.1
top_srcdir = /root/libsmbclient-php-0.6.1
top_builddir = /root/libsmbclient-php-0.6.1
EGREP = /usr/bin/grep -E
SED = /usr/bin/sed
CONFIGURE_COMMAND = './configure' 'LDFLAGS=-L/usr/pbi/owncloud-amd64/local/lib'
CONFIGURE_OPTIONS = 'LDFLAGS=-L/usr/pbi/owncloud-amd64/local/lib'
SHLIB_SUFFIX_NAME = so
SHLIB_DL_SUFFIX_NAME = so
ZEND_EXT_TYPE = zend_extension
RE2C = exit 0;
AWK = nawk
LIBSMBCLIENT_SHARED_LIBADD = -lsmbclient
shared_objects_libsmbclient = libsmbclient.lo
PHP_PECL_EXTENSION = libsmbclient
PHP_MODULES = $(phplibdir)/libsmbclient.la
PHP_ZEND_EX =
all_targets = $(PHP_MODULES) $(PHP_ZEND_EX)
install_targets = install-modules install-headers
prefix = /usr/local
exec_prefix = $(prefix)
libdir = ${exec_prefix}/lib
prefix = /usr/local
phplibdir = /root/libsmbclient-php-0.6.1/modules
phpincludedir = /usr/pbi/owncloud-amd64/local/include/php
CC = cc
CFLAGS = -g -O2
CFLAGS_CLEAN = $(CFLAGS)
CPP = cc -E
CPPFLAGS = -DHAVE_CONFIG_H
CXX =
CXXFLAGS =
CXXFLAGS_CLEAN = $(CXXFLAGS)
EXTENSION_DIR = /usr/pbi/owncloud-amd64/local/lib/php/20131226
PHP_EXECUTABLE = /usr/pbi/owncloud-amd64/local/bin/php
EXTRA_LDFLAGS =
EXTRA_LIBS =
INCLUDES = -I/usr/pbi/owncloud-amd64/local/include/php -I/usr/pbi/owncloud-amd64/local/include/php/main -I/usr/pbi/owncloud-amd64/local/include/php/TSRM -I/$
LFLAGS =
LDFLAGS = -L/usr/pbi/owncloud-amd64/local/lib
SHARED_LIBTOOL =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
SHELL = /bin/sh
INSTALL_HEADERS =
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644

DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
```
*II. Storage permission type *
I'm trying to mount SMB in OC WEB GUI because i first tried UNIX and failed. What I need is to control access on my storage for windows and Unix users (owncloud all granted and other user not) but I faced different issues:

When I mount a storage with Windows permission type in owncloud jail using freenas WEB-GUI, I can explore all the files in shell but in owncloud web-gui some directories are empty. Below is an example of permissions of a folder with invisible contents in owncloud web-gui and there is no difference with a folder with visible contents: 
	
	



```
#ll ./folder 
drwxrwxr-x+  4 user group 4 Aug 17 18:30 ./
drwxrwxr-x+  7 user group 9 Aug 26 21:09 ../
drwxrwxr-x+ 10 user group 10 Aug 15 22:33 d1/
drwxrwxr-x+  7 user group 7 Aug 15 22:40 d2/
#getfacl folder/
# file: folder/
# owner: user
# group: group
            owner@:rwxpDdaARWcCos:fd----:allow
            group@:rwxpDdaARWcCos:fd----:allow
         everyone@:r-x---a-R-c---:fd----:allow
```

Unix permission type: I didn't manage to authorize only allowed Windows users to get read, write on CIFS share. Is it expected?
Unix type: I can't edit mp3 taps on my network drive with Windows softwares but I can rename file in Windows file explorer. Is it ACL issue?
Thanks in advance for help.

Best regards.


----------



## wblock@ (Aug 29, 2015)

Threads get the best response when there is a single clearly-stated question.  There are a bunch here.

It's also important to realize that FreeNAS is not an ordinary version of FreeBSD.  It has been customized, parts of FreeBSD have been removed and others added.  We usually recommend people using FreeNAS ask their questions on the FreeNAS forum, because they are the experts on how FreeNAS works.


----------

