Well, GeoGig it's a new tool for versioning geodata, it has the same funcionality as git has. I'm implementing this new tool but I'm facing a problem when I use the shell_exec("geogig init"). I've setted the PATH variable in apache, which points to /opt/geogig/bin, where are the binaries files of geogig, with this I can use the command line geogig inside my php. My problem is that this command create a certain part of the local repository, but gets an error which shell_exec throws:
12:15:33.678 [main] ERROR o.locationtech.geogig.cli.GeogigCLI - An unhandled error occurred: java.io.IOException: Permission denied. See the log for more details.
org.locationtech.geogig.storage.ConfigException: java.io.IOException: Permission denied
at org.locationtech.geogig.storage.fs.IniFileConfigDatabase$2.iniFile(IniFileConfigDatabase.java:63) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.fs.INIFile.checkReload(INIFile.java:330) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.fs.INIFile.get(INIFile.java:56) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.fs.IniFileConfigDatabase.getGlobal(IniFileConfigDatabase.java:100) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.bdbje.JEObjectDatabase.newTransaction(JEObjectDatabase.java:878) ~[geogig-bdbje-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.bdbje.JEObjectDatabase.putInternal(JEObjectDatabase.java:630) ~[geogig-bdbje-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.AbstractObjectStore.put(AbstractObjectStore.java:224) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.ForwardingObjectDatabase.put(ForwardingObjectDatabase.java:127) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.di.ObjectDatabasePutInterceptor$GraphUpdatingObjectDatabase.put(ObjectDatabasePutInterceptor.java:65) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.storage.ForwardingObjectDatabase.put(ForwardingObjectDatabase.java:127) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.api.porcelain.InitOp.callInternal(InitOp.java:216) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.api.porcelain.InitOp._call(InitOp.java:125) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.api.porcelain.InitOp._call(InitOp.java:64) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.api.AbstractGeoGigOp.call(AbstractGeoGigOp.java:133) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.cli.porcelain.Init.runInternal(Init.java:99) ~[geogig-cli-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.cli.AbstractCommand.run(AbstractCommand.java:68) ~[geogig-cli-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.cli.GeogigCLI.executeInternal(GeogigCLI.java:543) [geogig-cli-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.cli.GeogigCLI.execute(GeogigCLI.java:385) [geogig-cli-1.0-RC1a.jar:1.0-RC1a]
at org.locationtech.geogig.cli.GeogigCLI.main(GeogigCLI.java:340) [geogig-cli-1.0-RC1a.jar:1.0-RC1a]
Caused by: java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:1.8.0_74]
at java.io.File.createNewFile(File.java:1012) ~[na:1.8.0_74]
at org.locationtech.geogig.storage.fs.IniFileConfigDatabase$2.iniFile(IniFileConfigDatabase.java:61) ~[geogig-core-1.0-RC1a.jar:1.0-RC1a]
... 18 common frames omitted
An unhandled error occurred: java.io.IOException: Permission denied. See the log for more details.
Anyone have an idea? thanks
There is some file that GeoGig is trying to read or write that the user PHP is running as doesn't have permission to read or write. I would suggest you do as the error message says and "See the log for more details." to find out what that file is.
I solved the problem by adding in the visudo with the command line sudo visudo: secure_path="......:/opt/geogig/bin"
and at the end of the file: www-data ALL=NOPASSWD: ALL
And in the shell_exec I've added "sudo geogig init"
I hope this helps anyone that is facing the same problem.
Thank you Chris