Permission denied when migrating in DigitalOcean - digital-ocean

I'm using the DigitalOcean terminal to try run a Phinx migration vendor/bin/phinx migrate -e development but I get the error "permission denied"
I have tried writing the command in different ways, I have made sure the data in my phinx.php is correct.
I'm really stuck, anyone have any experience with this?
Full Command:
root#webportal-project-name:/home/project/project-name# vendor/bin/phinx migrate -e development
Error:
-bash: vendor/bin/phinx: Permission denied
Phinx.php:
<?php
return
[
'paths' => [
'migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations',
'seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds'
],
'environments' => [
'default_migration_table' => 'phinxlog',
'default_environment' => 'development',
'production' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'production_db',
'user' => 'root',
'pass' => '',
'port' => '3306',
'charset' => 'utf8',
],
'development' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'customer_portal',
'user' => 'root',
'pass' => 'pK74He7NbqvNyFxz',
'port' => '3306',
'charset' => 'utf8',
],
'testing' => [
'adapter' => 'mysql',
'host' => 'localhost',
'name' => 'testing_db',
'user' => 'root',
'pass' => '',
'port' => '3306',
'charset' => 'utf8',
]
],
'version_order' => 'creation'
];

Related

Encountering error "Request has invalid Client token" but my credentials is correct

I'm having this error when I call the startDocumentTextDetection even I have the correct credentials because I was able to upload the my pdf in s3. I also allowed Textract to call other services on my behalf.
$client = new TextractClient([
'region' => env('AWS_DEFAULT_REGION'),
'version' => '2018-06-27',
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY')
]
]);
$result = $client->startDocumentTextDetection([
'ClientRequestToken' => 'DocumentDetectionToken',
'DocumentLocation' => [ // REQUIRED
'S3Object' => [
'Bucket' => 'XXXXX',
'Name' => 'HNlLrVxE4cDqyJh0RHmSfTGtZVKzOWUG75ycHfyE.pdf',
],
],
'FeatureTypes' => ['FORMS','TABLES'],
'JobTag' => 'HNlLrVxE4cDqyJh0RHmSfTGtZVKzOWUG75ycHfyE.pdf',
'NotificationChannel' => [
'RoleArn' => 'XXXXX', // REQUIRED
'SNSTopicArn' => 'XXXXX', // REQUIRED
],
'OutputConfig' => [
'S3Bucket' => 'XXXXXX',
],
]);

Naming an AWS EC2 security group IP permissions rule

I am using the AWS PHP SDK version 3. I am able to create security groups using the API, as well as creating IP Permission rules. What I can't figure out is how give the IP Permissions rule a name.
Here's what I have:
$params =
[
'Description' => 'My Security Group',
'GroupName' => 'my_security_group',
'VpcId' => 'vpc-a9d2h3d7',
'TagSpecifications' => [
[
'ResourceType' => 'security-group',
'Tags' =>
[
['Key' => 'Name', 'Value' => 'My Security Group']
]
]
],
];
$Ec2Client->createSecurityGroup($params);
At this point the group is created
Then I create an IP Permissions rule:
$ip_permissions = [
'GroupName' => 'my_security_group',
'FromPort' => 0,
'ToPort' => 65535,
'IpProtocol' => 'tcp',
'IpRanges' => [['CidrIp' => 'xx.xxx.xx.xxxx/32', 'Description' => 'Main Office']],
];
$Ec2Client->authorizeSecurityGroupIngress($ip_permissions);
Through the AWS Console, I can see that the rule is created, but the Name column is empty. How do I create the Name through the API?
It would be same, by using TagSpecifications. But instead of security-group you need to have security-group-rule:
'TagSpecifications' => [
[
'ResourceType' => 'security-group-rule',
'Tags' =>
[
['Key' => 'Name', 'Value' => 'My Security Group Rule']
]
]
]
Full example in AWS CLI (don't have php):
aws ec2 authorize-security-group-ingress --group-id sg-00102bde0b55e29fe --ip-permissions FromPort=0,IpProtocol=tcp,IpRanges='[{CidrIp=10.10.10.10/32,Description="Main Office"}]',ToPort=65535 --tag-specifications ResourceType=security-group-rule,Tags='[{Key=Name,Value=MyName}]'

The request signature we calculated does not match the signature you provided

I am using SES for sending email here is my code can you anybody tell me what is the problem ?
Is there anyone facing the same problem??
I have also check my credentials they are also correct.
$client = SesClient::factory(array(
'version'=> 'latest',
'region' => REGION,
'credentials' => array(
'key' => "AKIA***********",
'secret' => "AoIM6Z/clu********************",
),
));
try {
$result = $client->sendEmail([
'Destination' => [
'ToAddresses' => [
RECIPIENT,
],
],
'Message' => [
'Body' => [
'Html' => [
'Charset' => CHARSET,
'Data' => HTMLBODY,
],
'Text' => [
'Charset' => CHARSET,
'Data' => TEXTBODY,
],
],
'Subject' => [
'Charset' => CHARSET,
'Data' => SUBJECT,
],
],
'Source' => SENDER,
// If you are not using a configuration set, comment or delete the
// following line
'ConfigurationSetName' => CONFIGSET,
]);
$messageId = $result->get('MessageId');
echo("Email sent! Message ID: $messageId"."\n");
} catch (SesException $error) {
echo("The email was not sent. Error message: ".$error-
>getAwsErrorMessage()."\n");
}
}
After so much googling I found out that my credentials are wrong. Just regenerate the credentials, try it again and it should work. Another thing is that the when key includes '/', it will not work, so if your key contains '/', regenerate it.

Yii2 UrlManager route a file name

I have the following rule in my UrlManager:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'cache' => null,
'rules' => [
'classic_articles/<route:.*>' => 'site/classic-articles',
// your rules go here
]
],
However it is not going to the new path when route is a file name
i.e blank%20document.pdf
It does work when there is no .pdf on the end.

Doctrine PDOException No such file or directory

I am using ZF2 with DoctrineOrm and have recently installed a local environment using vagrant on my mac running OSX (Yasomite).
Everything works as expected except I get the following error when I attempt to use Doctrine vendor tools:
./vendor/bin/doctrine-module orm:schema-tool:create --dump-sql
The error reads:
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002]
No such file or directory' in
example.com/trunk/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43
EDIT
Line 43 from the offending class: parent::__construct($dsn, $user, $password, $options);
class PDOConnection extends PDO implements Connection, ServerInfoAwareConnection
{
public function __construct($dsn, $user = null, $password = null, array $options = null)
{
try {
parent::__construct($dsn, $user, $password, $options);
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $exception) {
throw new PDOException($exception);
}
}
When I dump the variables from the catch statement, they are as expected.
I can access the mysql location via adminer: http://192.168..../adminer/
And the website loads albeit with errors as I am unable to create the DB.
I remember when I originally set up my local MAMP environment having a similar problem and had to add the following line to my pdo settings:
/Applications/MAMP/tmp/mysql/mysql.sock
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => 'localhost',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
]
]
],
I can't help but think that I need to do the same thing, however I am not really sure how to.
EDIT:
SSHing into the Vbox I see the socket is located here: /var/lib/mysql/mysql.sock
What would the correct settings be to connect to this? The following does not work:
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => '192.168.56.101/',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/var/lib/mysql/mysql.sock' //To use Doctrine Entity Generator
]
]
],
Any help would be appreciated!
Managed to get this to work, it was a setting:
'connection' => [
'orm_default' => [
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => [
'host' => 'localhost',
'port' => '3306',
'user' => 'games_cloud',
'password' => 'games_cloud',
'dbname' => 'games_cloud',
'unix_socket' => '/var/lib/mysql/mysql.sock'
]
]
],