Hello
This may be a silly question, but I can't actually figure out how to get this to work. I got as far as building a PHP from source, but then figured out I was missing the Apache modules (libphp5.x.x.so file) because I forgot to add the apxs2 module (I think?). Trying it again, I can't get this to build; I have apache installed but phpbrew complains about permissions:
Exception: Apache module dir /usr/lib/httpd/modules is not writable.
Please consider using chmod or sudo.
This seems fairly logical, as these are system wide folders. When I use sudo, it suddenly wants to put files in my /root/ folder instead of my home folder instead. I guess I could change permissions in order to get my local user to be able to read and write files, but this seems bad practice and I would much rather not use sudo at all and have these files end up in my home folder along with the rest of the built files (so the rest of my system remains untouched), is this at all possible?
Thanks in advance
Hi @hotoiledgoblinsack,
phpbrew depends on the environment variables, when you run phpbrew with sudo, it actually runs phpbrew as root user, and a sudo-root user can't read the environment variables from the shell of current user. unless you pretty sure that your root user have the correct environment variables, or you can't install it without the environment variables that phpbrew depends on.
Hence I removed 'sudo' from the messages, people should run 'chmod' instead of 'sudo phpbrew'.
cc @marcioAlmada
Thanks for the information, then it is as I thought in my first post: chmod-ing does indeed work, but it leaves me with a rather bad in my mouth to give all users access to these system folders.
Would it perhaps be an option to be able to place the modules and files into a custom folder (or a default one somewhere in ~/.homebrew/)? This way the setup could work as follows:
/usr/lib/httpd/modules/libphp5.so is created by me (or a sudo command to homebrew) to point to ~/.homebrew/some_folder_containing_the_active_php_build/libphp5.sohomebrew use 5.5.27 changes ~/.homebrew/some_folder_containing_the_active_php_build/libphp5.so to point to e.g. ~/.homebrew/some_build_folder/libphp5.5.27.so/usr/lib/httpd/modules/libphp5.so (i.e. there is no need for homebrew to update it).This way homebrew can remain confined to the home folder and no permission changes would be necessary. Or am I missing something that makes this impossible? :P
This is indeed to be improved, but I am not sure if we can configure the installed .so path with apxs2. it would be great if you know and you can submit a PR for this. :)
Not sure if this is of any help, but if I understood correctly, php-build applies a patch to the makefile in order to get the libphp5.so file to output somewhere else [1]. (Note however, that this patch could be outdated for modern PHP versions.)
[1] https://github.com/php-build/php-build/blob/master/bin/php-build#L625
yeah, we do that too, see https://github.com/phpbrew/phpbrew/blob/develop/src/PhpBrew/Patch/PatchCollection.php#L27 so it's possible to replace some specific paths.
Has there been any movement on this? I don't feel comfortable changing the permissions of the apache2 module dir.
Most helpful comment
Has there been any movement on this? I don't feel comfortable changing the permissions of the apache2 module dir.