
Are you seeing messages like the following in your web server’s error logs?
cd: 1: can't cd to ~
cd: 1: can't cd to ~
cd: 1: can't cd to ~
cd: 1: can't cd to ~
Though it lacks a timestamp, the reason for the error is somewhat self-explanitory–somewhere there is code trying to execute the command “cd ~”. However, the source may be hard to track down. If you’re using the AWS SDK for PHP, I have your answer:
You haven’t created the config file config.inc.php either in the root directory for the SDK (/usr/share/php/AWSSDKforPHP/ on Ubuntu if installed from PEAR) or in your home directory. The file sdk.class.php looks in the SDK root folder for the config file. If it isn’t found there, it checks for $_ENV['HOME'] and $_SERVER['HOME']. If neither of those variables are set, it tries to execute the command “cd ~ && pwd”. Of course, there’s a very good chance the apache user won’t have a home directory, so this command will fail.
The fix is simple: Create the config file or at least create an empty file that it can open up and be done with.
In our environment, the config file is not desirable because we populate all of the required variables through our built-in site config. I just ran “touch /usr/share/php/AWSSDKforPHP/config.inc.php” and the problem went away.
Note: This information is valid as of SDK version 1.5.3 in April 2012.