0

I'm looking at the ubuntu sets up php for both apache (mod_php) and php cli. They have one configuration ini in /etc/php5/apache2/php.ini which contains settings for apache+php and another configuration ini in /etc/php5/cli/php.ini for php cli. How do I duplicate these settings? I'm compiling php in a rhel environment

3 Answers 3

2

when you compile php, you will need to compile it twice. so what you can do is first check out your php info for the mod_php and than your cli. they may be compiled differently. <?php print phpinfo();?> will give you your config command for mod_php. a simple php -i for your cli version will give you your cli config command. that is the best way to confirm what you are currently working with is actually what you will compile with.

so for mod_php, you might do something with: ./configure <more-configs-here> --prefix=/some/prefix/dir --with-apxs2=/path/to/your/apache --disable-cli --disable-cgi --with-config-file-path=/etc/php5/apache2

for php cli: ./configure <more-configs-here> --prefix=/some/prefix/dir --with-config-file-path=/etc/php5/cli

it is importantly to not configure apxs2 while you are configuring your cli.

of course make && make install or whatever you need to do at the end.

0

Those values are hard coded at compile time. On Debian/Ubuntu packages these paths appear to be modified via the patches/006-debian_quirks.patch patch that is applied as part of the packaging process. Specifically this fragment of the patch.

--- php5.orig/sapi/cli/php.1.in
+++ php5/sapi/cli/php.1.in
@@ -374,13 +374,14 @@ Shows configuration for extension
 Show configuration file names
 .SH FILES
 .TP 15
-.B php\-cli.ini
+.B /etc/php5/cli/php.ini
 The configuration file for the CLI version of PHP.
 .TP
-.B php.ini
-The standard configuration file will only be used when 
-.B php\-cli.ini
-cannot be found.
+.B /etc/php5/cgi/php.ini
+The configuration file for the CGI version of PHP.
+.TP
+.B /etc/php5/apache2/php.ini
+The configuration file for the version of PHP that apache2 uses.
 .SH EXAMPLES
 .TP 5
 \fIphp \-r 'echo "Hello World\\n";'\fP

On a Debian/Ubuntu system do an apt-get source php5, to get the source package, which will include all the build scripts, and patches that are used. Be sure to look over the scripts, there may be more configuration related to this, that I am not seeing with a quick grep.

0

Answer of @Zoredache is the proper one.

Missing info is "how do I apply those path?

let's say you get the source package for PHP in Debian 7

  apt-get source php5
  #then
  cd php5-5.4.41

All further steps assume you are in this directory.

In this directory, you can find the "debian" subdirectory, which contains a "debian/patches" directory which contains the patches that debian apply to the original sources.

   ls debian/patches
   # gives files ending with .patch
   # we need debian/patches/0004-006-debian_quirks.patch
   # found via grep -Ri 'php5/cli/php.ini' *

We will create a patch that fits in this hierarchy using the tool called "quilt":

apt-get install quilt

The quilt patch system manages a stack of patches to the original source. We then apply all patches contained in the package.

  export QUILT_PATCHES=debian/patches
  quilt push -a

if you want to apply it just for the php.ini location, in for example PHP 5.3 source, you can try to delete in debian/patches/ all of the files except 0004-006-debian_quirks.patch and then move it in the PHP 5.3 folder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .