2

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....)

calumbrodie
  • 182
  • 1
  • 2
  • 12

3 Answers3

1

Resolved by adding the "noserverino" to the mount parameters

mulaz
  • 10,472
  • 1
  • 30
  • 37
0

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

symcbean
  • 19,931
  • 1
  • 29
  • 49
0

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.

Dave
  • 345
  • 1
  • 2
  • 12