Bin/gpm and bin/grav not working

For some reason when I try to run either bin/gpm or bin/grav on some sites on my local server, I get this error:

: No such file or directory

I tried setting the permissions to 755 for the both files, but they has the same permissions as other sites where they do work. I tried downloading the newest version and just replacing the user folder, but still nothing. I’m running PHP 5.5.9.

what directory are you running the command from?

A directory called Development inside home/alex. I’m using a version of Ubuntu.

check who owns the files, as opposed to the logged in user.

I got this error before adding my user account to the www-data group.
I would get permission denied running it with my account, and your error when trying to run it with sudo.

Also check that it’s executable by the user.

Root is the owner for both the working and non-working sites, and they’re executable. Thanks patmcgroin, I’ll look into the user group.

OK, so I added my user to the www-data group, but I get the same error.

Maybe it’s PHP from the command line that is giving you trouble. Try:

$ php -v

What do you get?

if the file is owned by root, then you would need to be root to run it right?

i dont know if its the best practice, but I would change the ownership of all the files and directories in /var/www (i’m assuming this is where you are) to www-data.

sudo chown -R www-data /var/www

this way apache has no problems writing to anything, and if you want to run gpm (and have it able to write access directories) just run it with sudo too.

My hunch is that the PHP version is not valid, or can’t be found in the path, hence the error.

This is what I get from php -v:

PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul  2 2015 15:23:08) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
---

Weird though, after setting up git on my live server and cloning the version off of there, suddenly bin/gpm and bin/grav work now.

lol… job done?

I guess so. Unless it happens again, haha. Thanks guys.