Access denied for 'root'#'localhost' but I'm not root - symfony

I developed a little management application with Symfony. It works a lot on local. I put it all on my webserver (called Planethoster), and I've got the following message when I try to login in my application using app.php:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
But in my parameters.yml file, I have not put the root user, it's another standard user that can only SIUD. I believe that app.php does not load my parameters.yml or config.yml file.
The last but not the least, I can log in using app_dev.php. It works but not with app.php.

Verify your Database settings in app/config_prod.yml for production use.
clear your cache by php app/console cache:clear --env=prod

Related

Why does mariabackup always give me access denied?

Context
Running MariaDb 10.6.7 on Windows 11. Trying to use mariabackup to do a partial backup of my database. Database, target backup folder and backup process all on the same PC.
Issue
In a batch file I have this:
cd C:\"Program Files\MariaDB 10.6\bin"
mariabackup --backup --target-dir='D:\OneDrive\Backups\MariaDb' --databases-exclude="*test" --user=root --password=myPasswordWithNoQuotes
Which keeps giving me the response:
Failed to connect to MariaDB server: Access denied for user 'root'#'localhost' (using password: YES)
Things I've checked
Running the batch file as administrator
root has full priviliges
Password is correct - checked by logging into root with MySQL Workbench and MySQLClient and HeidiSQL.
Question
How do I set access rights so that the backup can proceed?
When I changed the root password to something simple everything worked. So it looks like the issue was a special character in the password (a % character perhaps) or the way that the password parameter was formed in the mariabackup command.

access denied for image file server in nginix

I am using prestashop on nginx provided by plesk . two image on inner folders have the same permission but one of them is available from browse the other is not !!
I've already gave them both 777 permission and their parent folder have the same permission either.
How I can access them from Browser?
Edit:
the physical address of Images Are like that : /var/www/vhosts/site.com/httpdocs/modules/slider/img/view/slides/1.jpg
and the URI that i'm using is site.com/modules/slider/img/view/slides/1.jpg
and the error_log is Permission denied: access to /modules/slider/views/img/slides/1.jpg denied
Most servers will not work with permissions on 777 because too many permissions are very risky, most servers work perfectly with permissions in...
Folders: 0755
Files: 0644
We have a publication about how to configure the correct permissions: https://www.rolige.com/en/blog/how-to-assign-the-correct-permissions-to-my-prestashop-files-and-folders-n7

Debian Stretch MariaDB cannot authenticate from PHP application

I'm using a fresh installation of Debian Stretch, and installed PHP7 and MariaDB as recommended:
sudo apt-get install nginx mariadb-server mariadb-client php-mysqli php7.0-fpm php7.0-curl
Then using sudo mysql_secure_installation I followed the prompts to remove test users etc.
MariaDB seems to use unix_socket authentication (which is a new concept to me). I like how it restricts root access to sudoers and allows me to grant DB permissions to specific OS users.
However I'd prefer to assign individual user/passwords for each web application running on the server. They all run as www-data user on the system and I see no reason to let them share databases.
So I created a user for my first PHP script and granted access to a new database:
CREATE USER 'telemetry'#'localhost' IDENTIFIED BY 'yeah_toast';
UPDATE mysql.user SET plugin='mysql_native_password' WHERE user='telemetry';
GRANT ALL PRIVILEGES ON telemetry TO 'telemetry'#'localhost';
FLUSH PRIVILEGES;
But it refuses to let me connect from the application:
[error] 19336#19336: *20 FastCGI sent in stderr: "PHP message: PHP Warning: mysqli::real_connect(): (HY000/1045): Access denied for user 'telemetry'#'localhost' (using password: YES) in /path/to/database.inc.php on line 30
The credentials I'm using from the application are as follows:
Host: localhost (also tried 127.0.0.1)
Username: telemetry
Password: yeah_toast
Database: telemetry
I tried deleting and re-creating the username in case it was a password problem, and creating a user #'localhost' and #'%' but none seem to work. In fact when I log in using the same credentials from the command line without sudo it works great (mysql -utelemetry -p).
Am I missing a MariaDB configuration step here?

Deploy in projet with DeployBundle

I'm trying to deploy one in my project with DeployBundle and made the following settings:
parameter.yml
jordi_llonch_deploy:
config:
project: delivve
vcs: git
servers_parameter_file: app/config/parameters_deployer_servers.yml
local_repository_dir: /home/deploy/local_repository
clean_max_deploys: 7
ssh:
proxy: cli
user: user
password: 'password'
public_key_file: '/home/user/.ssh/id_rsa.pub'
private_key_file: '/home/user/.ssh/id_rsa'
private_key_file_pwd: 'password'
zones:
prod_myproj:
deployer: delivve
environment: prod
checkout_url: 'https://user#bitbucket.org/user/project-webservice.git'
checkout_branch: master
repository_dir: /var/www/production/delivve/deploy
production_dir: /var/www/production/delivve/code
parameters_deployer_servers.yml
prod_myproj:
urls:
- user#localhost:22
It has also the service and the setting but it seems this working out that part.
My problem is when I give the command:
sudo php app/console deployer:initialize --zones=prod_myproj
of the following error:
[prod_myproj]
[2016-01-04 18:25:55] app.CRITICAL: Not implemented
ROLLBACK [prod_myproj]
[2016-01-04 18:25:55] app.CRITICAL: Not implemented
Anyone know what can this happening, and how could solve, or to deploy with this bundle?
This looks like comming from the password authentication (https://github.com/jordillonch/DeployBundle/blob/3f8e679eb2ac87d0cef9ea9dd4765afd24c6a266/SSH/CLISshProxy.php#L60).
Try removing jordi_llonch_deploy.config.ssh.password from your config.yml (https://github.com/jordillonch/DeployBundle/blob/3f8e679eb2ac87d0cef9ea9dd4765afd24c6a266/SSH/SshClient.php#L76).

Symfony2 - send email Warning: mkdir(): No such file or directory in

After configuration smtp in prameters.yml I trying to send email but I have this type of warning:
ContextErrorException: Warning: mkdir(): No such file or directory in /home/crashend/domains/tombax.com/public_html/gbuy/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php line 273
On the localhost everything worked fine but the problem appeared after transfer project to the server.
Emails are not deliver.
Code from controller where are send emails:
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom(array('exapmle#abc.net' => 'Tom'))
->setTo(array('exapmle2#abc.net' => 'Jan'))
->setBody('abcd')
;
$this->get('mailer')->send($message);
Code from parameters.yml:
mailer_transport: smtp
mailer_host: smtp.myserver.com
mailer_user: exapmle#abc.net
mailer_password: pass
Please help.
After comment this:
if (is_writable($tmpDir = sys_get_temp_dir())) {
$preferences->setTempDir($tmpDir)->setCacheType('disk');
}
in the /vendor/swiftmailer/swiftmailer/lib/preferences.php everything works fine.
I think that the problem was in the permission to the directory. Swiftmailer uses sys_get_temp_dir() function which trying refer to /tmp directory.
I had the same problem today. Find this article
All I have to do was: set PrivateTmp to false
PrivateTmp=false
in
/lib/systemd/system/apache2.service
and then reload services
sudo systemctl daemon-reload
sudo systemctl restart apache2
You probably have your spool path set wrong (it is different on server, than your dev environment)
Look in your config.yml and make sure the SwiftMailer spool directory is correct, and that it exists (and your user has permissions to it) on the server.

Resources