Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a centos 6 VM running as a guest within Virtualbox. I've set up a LAMP stack which I am able to access from the host (Windows) environment.

I've mounted a SMB share using 'mount -t cifs' and I'm able to use apache to serve files from that share (all good so far)

problem I'm now trying to run a simple test.php script from the command line This is the output I get (below)

notice what happens if I don't spell the filename correctly (different message), so the file is there, it's as if php is unable to execute it.

I've included this as an image because I can't find any way to copy from my VM terminal. Any help appreciated, I've already spent much more time than I's imagined getting this up and running.

edit3: I AM able to run php from the command line when not trying to run a file from the samba share so it's got somthing to do with the mount. I mounted the drive thus...

mount -t cifs -o username=xxxx,password=xxxx,nounix,fir_mode=0777,file_mode=0777,gid=48,uid=48 //path/to/samba/share /var/www/vhosts

enter image description here

edit1: -bash: hexdump test.php 0000000 6574 7473 6620 6c69 0a65 000000a

edit2:

strace -o mystraceoutput.txt -f -e trace=file php test.php

4423  execve("/usr/bin/php", ["php", "test.php"], [/* 19 vars */]) = 0
4423  access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
4423  open("/etc/ld.so.cache", O_RDONLY) = 3
4423  open("/lib/libcrypt.so.1", O_RDONLY) = 3
4423  open("/usr/lib/libedit.so.0", O_RDONLY) = 3
4423  open("/lib/libncurses.so.5", O_RDONLY) = 3
4423  open("/usr/lib/sse2/libgmp.so.3", O_RDONLY) = 3
4423  open("/lib/libbz2.so.1", O_RDONLY) = 3
4423  open("/lib/libz.so.1", O_RDONLY)  = 3
4423  open("/lib/libpcre.so.0", O_RDONLY) = 3
4423  open("/lib/libm.so.6", O_RDONLY)  = 3
4423  open("/lib/libdl.so.2", O_RDONLY) = 3
4423  open("/lib/libnsl.so.1", O_RDONLY) = 3
4423  open("/usr/lib/libxml2.so.2", O_RDONLY) = 3
4423  open("/lib/libgssapi_krb5.so.2", O_RDONLY) = 3
4423  open("/lib/libkrb5.so.3", O_RDONLY) = 3
4423  open("/lib/libk5crypto.so.3", O_RDONLY) = 3
4423  open("/lib/libcom_err.so.2", O_RDONLY) = 3
4423  open("/usr/lib/libssl.so.10", O_RDONLY) = 3
4423  open("/usr/lib/libcrypto.so.10", O_RDONLY) = 3
4423  open("/lib/libc.so.6", O_RDONLY)  = 3
4423  open("/lib/libresolv.so.2", O_RDONLY) = 3
4423  open("/lib/libfreebl3.so", O_RDONLY) = 3
4423  open("/lib/libtinfo.so.5", O_RDONLY) = 3
4423  open("/lib/libkrb5support.so.0", O_RDONLY) = 3
4423  open("/lib/libkeyutils.so.1", O_RDONLY) = 3
4423  open("/lib/libpthread.so.0", O_RDONLY) = 3
4423  open("/lib/libselinux.so.1", O_RDONLY) = 3
4423  statfs64("/selinux", 84, {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=2711275, f_bfree=2380713, f_bavail=2242985, f_files=689520, f_ffree=642048, f_fsid={-1727257207, 1632688387}, f_namelen=255, f_frsize=4096}) = 0
4423  open("/proc/filesystems", O_RDONLY|O_LARGEFILE) = 3
4423  getcwd("/var/www/vhosts/vhosts/user/mysite.co.uk/web", 4096) = 45
4423  open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
4423  open("/etc/localtime", O_RDONLY)  = 3
4423  lstat64("/usr/local/sbin/php", 0xbfe43dec) = -1 ENOENT (No such file or directory)
4423  lstat64("/usr/local/bin/php", 0xbfe43dec) = -1 ENOENT (No such file or directory)
4423  lstat64("/sbin/php", 0xbfe43dec)  = -1 ENOENT (No such file or directory)
4423  lstat64("/bin/php", 0xbfe43dec)   = -1 ENOENT (No such file or directory)
4423  lstat64("/usr/sbin/php", 0xbfe43dec) = -1 ENOENT (No such file or directory)
4423  lstat64("/usr/bin/php", {st_mode=S_IFREG|0755, st_size=3281860, ...}) = 0
4423  lstat64("/usr/bin", {st_mode=S_IFDIR|0555, st_size=20480, ...}) = 0
4423  lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
4423  access("/usr/bin/php", X_OK)      = 0
4423  open("/usr/bin/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
4423  open("/etc/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
4423  open("/usr/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
4423  open("/etc/php.ini", O_RDONLY)    = 3
4423  lstat64("/etc/php.ini", {st_mode=S_IFREG|0644, st_size=69109, ...}) = 0
4423  lstat64("/etc", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
4423  open("/etc/php.d", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
4423  stat64("/etc/php.d/curl.ini", {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
4423  open("/etc/php.d/curl.ini", O_RDONLY) = 3
4423  stat64("/etc/php.d/fileinfo.ini", {st_mode=S_IFREG|0644, st_size=57, ...}) = 0
4423  open("/etc/php.d/fileinfo.ini", O_RDONLY) = 3
4423  stat64("/etc/php.d/json.ini", {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
4423  open("/etc/php.d/json.ini", O_RDONLY) = 3
4423  stat64("/etc/php.d/phar.ini", {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
4423  open("/etc/php.d/phar.ini", O_RDONLY) = 3
4423  stat64("/etc/php.d/zip.ini", {st_mode=S_IFREG|0644, st_size=47, ...}) = 0
4423  open("/etc/php.d/zip.ini", O_RDONLY) = 3
4423  open("/usr/lib/php/modules/curl.so", O_RDONLY) = 3
4423  open("/etc/ld.so.cache", O_RDONLY) = 3
4423  open("/usr/lib/libcurl.so.4", O_RDONLY) = 3
4423  open("/lib/libidn.so.11", O_RDONLY) = 3
4423  open("/usr/lib/libldap-2.4.so.2", O_RDONLY) = 3
4423  open("/lib/librt.so.1", O_RDONLY) = 3
4423  open("/usr/lib/libssl3.so", O_RDONLY) = 3
4423  open("/usr/lib/libsmime3.so", O_RDONLY) = 3
4423  open("/usr/lib/libnss3.so", O_RDONLY) = 3
4423  open("/usr/lib/libnssutil3.so", O_RDONLY) = 3
4423  open("/lib/libplds4.so", O_RDONLY) = 3
4423  open("/lib/libplc4.so", O_RDONLY) = 3
4423  open("/lib/libnspr4.so", O_RDONLY) = 3
4423  open("/usr/lib/libssh2.so.1", O_RDONLY) = 3
4423  open("/usr/lib/liblber-2.4.so.2", O_RDONLY) = 3
4423  open("/usr/lib/libsasl2.so.2", O_RDONLY) = 3
4423  open("/usr/lib/php/modules/fileinfo.so", O_RDONLY) = 3
4423  open("/usr/lib/php/modules/json.so", O_RDONLY) = 3
4423  open("/usr/lib/php/modules/phar.so", O_RDONLY) = 3
4423  open("/usr/lib/php/modules/zip.so", O_RDONLY) = 3
4423  open("/proc/sys/crypto/fips_enabled", O_RDONLY) = 3
4423  stat64("/root/.terminfo", 0xbfe454b0) = -1 ENOENT (No such file or directory)
4423  stat64("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
4423  access("/etc/terminfo/l/linux", R_OK) = -1 ENOENT (No such file or directory)
4423  stat64("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
4423  access("/usr/share/terminfo/l/linux", R_OK) = 0
4423  open("/usr/share/terminfo/l/linux", O_RDONLY|O_LARGEFILE) = 3
4423  open("/root/.editrc", O_RDONLY)   = -1 ENOENT (No such file or directory)
4423  open("/etc/nsswitch.conf", O_RDONLY) = 3
4423  open("/etc/ld.so.cache", O_RDONLY) = 3
4423  open("/lib/libnss_files.so.2", O_RDONLY) = 3
4423  open("/etc/protocols", O_RDONLY|O_CLOEXEC) = 3
4423  open("/etc/protocols", O_RDONLY|O_CLOEXEC) = 3
4423  open("test.php", O_RDONLY)        = 3
4423  getcwd("/var/www/vhosts/vhosts/user/mysite.co.uk/web", 4096) = 45
4423  lstat64("/var/www/vhosts/vhosts/user/mysite.co.uk/web/test.php", {st_mode=S_IFREG|0777, st_size=10, ...}) = 0
4423  lstat64("/var/www/vhosts/vhosts/user/mysite.co.uk/web", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
4423  lstat64("/var/www/vhosts/vhosts/user/mysite.co.uk", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
4423  lstat64("/var/www/vhosts/vhosts/user", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
4423  lstat64("/var/www/vhosts/vhosts", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
4423  lstat64("/var/www/vhosts", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
4423  lstat64("/var/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
4423  lstat64("/var", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

Then execution is interrupted by the same error as before( PHP Fatal error: etc....)

share|improve this question
    
can you please add the output of: strace -f -e trace=file php test.php –  Mircea Vutcovici Dec 29 '11 at 15:27
    
@Mircea As requested –  calumbrodie Dec 29 '11 at 15:55
    
You do not have a permission problem. The call open("test.php", O_RDONLY) = 3 returned a file descriptor, not an error. This means that php could open the test.php file. –  Mircea Vutcovici Dec 29 '11 at 21:29
    
I would continue with strace and run it like: strace -f php test.php take a look on the last lines. –  Mircea Vutcovici Dec 29 '11 at 21:30

3 Answers 3

Resolved by adding the "noserverino" to the mount parameters

share|improve this answer

Are you sure that test.php does include test.php? This can cause nasty results.

share|improve this answer
    
positive ........ –  calumbrodie Dec 30 '11 at 10:02

If you can run the same PHP file from the CLI when copied to a local filestore then I'd think it might be a SELinux security issue.

Try looking in messages for SELinux notifications or just disabling it temporarily. We have had a lot of problems (until we figured it out) even on a local filesystem with files that SELinux was blocking access to.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.