Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.