Double slash in file path reference breaks php

I’ve installed Grav successfully in a few environments. Now I’m trying to install it in a different environment. Our IT support person set up a bitnami stack on our Intranet. Unfortunately I cannot get Grav to install. I am trying to install it in a subfolder of the home folder.

The Apache error log shows that there is a double slash that a that appears immediately after the cache folder in file path references. First it wanted Grav wanted to create the folder …cache//compiled/files and couldn’t do that. I created the folders manually. After that it got past that point but tried to open a file for writing in …cache//compiled/files/something.yaml.php

In summary: a rogue slash appears after the word “cache” in the file path which breaks php.

Marius

First Grav wanted to create the folder …cache//compiled/files and failed.
I then created the folders manually. After that the Grav installation goes past that step but fails when it when it tries to open a file in write mode with the path …/cache//compiled/files/something.yaml.php

Got error 'PHP message: PHP Fatal error: Uncaught exception ‘RuntimeException’ with message 'Opening file for writing failed on error fopen(/opt/bitnami/apache2/htdocs/cat/cache//compiled/files/7baf2eed73ea52b9ba464d97c92557d4.yaml.php)

Notice the double forward slash.

Latest version I assume, right? I am unable to find other references to a similar problem with the double slashes.

I think the issue is with permissions rather than the double slash, try first checking the permission docs and make sure that PHP/Webserver runs with the same user that edits the files.

@flaviocopes
You are probably correct that it is not a double slash issue but a permissions problem - but I can’t put my finger on it. I would have presumed that a Bitnami installation in an Ubuntu VM would work out of the box - that does not seem to be the case here.

I’ve tried setting file and folder permissions. I’ve changed the owner and the group. I’ve even set the folder so that anyone can write to it - but I still get the same error. I go and create the directory and or file manually that Grav wants to create during setup and then the installation goes one step further - but somewhere I’m missing something. I’ve spent a couple of hours on this - but I’m out of my depth.

Could it possibly be some httpd.conf or php.ini setting ?

I’m making progress… slowly. I had the rewrite base on (in .htaccess) with the name of the subfolder in which I have my site. After I commented that out - the installation went a bit further but still with mkdir permission errors. I then change the permission to allow everyone to write (I know that is a No-No, but this is for development purposes till I can sort out the problems.)

The installation continued till the point where Grav at least gives me a page about issues found - mainly that certain folders exist but are not writeable. I did make them writeable for the owner and the group and changed both of those to bitnami. Obviously php is running as someone else.

Who is php?

<?php echo exec('whoami');
	echo shell_exec('whoami');
 ?>

At least I’ve now isolated the problem. php runs as daemon and that causes the permissions errors. How do I fix that?

Yei!! "Grav is Running! You have installed Grav successfully"
Not sure if it is the best approach but I made daemon the owner and bitnami the group of all files and directories in my site folder - including the site folder and set all the permissions to 775 for folders and 664 to files.