Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mkdir: cannot create directory '/.local': Permission denied #518

Open
MarcPinnell opened this issue May 9, 2023 · 5 comments
Open

mkdir: cannot create directory '/.local': Permission denied #518

MarcPinnell opened this issue May 9, 2023 · 5 comments
Labels

Comments

@MarcPinnell
Copy link

MarcPinnell commented May 9, 2023

I've seen other similar posts, but none of the resolutions in those posts are helping me. I can open Chrome (and create a PDF) successfully from the command line, but when I try to use this library I am getting:

Chrome process stopped before startup completed. Additional info: mkdir: cannot create directory '/.local': Permission denied
touch: cannot touch '/.local/share/applications/mimeapps.list': No such file or directory

This is the code I am using (failing in the "createBrowser" step):

$browserFactory = new BrowserFactory('google-chrome');

// starts headless chrome
$browser = $browserFactory->createBrowser([
	'headless'		=> false,
	'keepAlive' 	       => true,
	'windowSize'	        => [1920, 1080],
	'noSandbox'		=> true,
	'debugLogger'	=> 'php://stdout', // will enable verbose mode
	'ignoreCertificateErrors' => true,
	'customFlags' => [
		'--headless=new',
	],
]);

Any suggestions on how to make this work?

@buismaarten
Copy link
Contributor

I see you are trying to use the new headless in Google Chrome, from my experience this doesn't work in Docker (yet).

@MarcPinnell
Copy link
Author

We are not using this with Docker.

@ditatompel
Copy link

Chrome process stopped before startup completed. Additional info: mkdir: cannot create directory '/.local': Permission denied
touch: cannot touch '/.local/share/applications/mimeapps.list': No such file or directory

Chrome should not create hidden /.local folder at the root of your operating system. This may be issue with the user environment variable who execute your php script.

@freelock
Copy link

freelock commented Sep 2, 2023

hmm in my case it was trying to touch '/var/www/.local', inside the Docker container. I tried creating that as root, and setting it so it was writable by the user, and now I get a different error:

RuntimeException: Chrome process stopped before startup completed. Additional info: chrome_crashpad_handler: --database is required Try 'chrome_crashpad_handler --help' for more information. [6673:6673:0902/154840.854156:ERROR:socket.cc(120)] recvmsg: Connection reset by peer (104) in HeadlessChromium\Browser\BrowserProcess->HeadlessChromium\Browser{closure}() (line 422 of /var/www/html/endelman-survey/survey-dev/vendor/chrome-php/chrome/src/Browser/BrowserProcess.php).

Copy link

stale bot commented Mar 13, 2024

This issue has been automatically marked as stale because there has been no recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants