简体   繁体   中英

Configuring php with Apache - where is php.ini supposed to be?

I am trying to configure Apache with php on CENTOS.

  • Apache is 2.2.31 built from source
  • PHP is 5.6.18 also built from source.

I used the following configure for the php build:

./configure --prefix=/apps/php --with-apxs2=/apps/httpd/bin/apxs --with-config-file-path=/apps/httpd/php --with-mysql

The make/make install worked, and then I copied the php.ini-development to /apps/httpd/php/php.ini.

The problem I'm having is that when I view the phpinfo.php in a web page, it shows:

Configuration File (php.ini) Path   /apps/httpd/php
Loaded Configuration File   (none) 

Also I think that it's reading (or not reading) a php.ini file from some unknown location because param changes I make in the /apps/httpd/php/php.ini file are not showing, so I've been trying to determine where it's looking for the php.ini file. I've even run Apache under strace and I see this:

stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
stat("/apps/httpd/\342\200\234/apps/httpd/php/php.ini\342\200\235", 0x7fffe0da9b10) = -1 ENOENT (No such file or directory)
open("/apps/httpd/\342\200\234/apps/httpd/php/php.ini\342\200\235/php-apache2handler.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/apps/httpd/\342\200\234/apps/httpd/php/php.ini\342\200\235/php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)

I don't understand because it appears that it's looking in paths that have the "\\342\\200\\234"??

Can anyone tell me (a) what is going on and (b) how I might be able to build php or configure it to work correctly with my Apache?

Thanks, Jim

PS I've seen some older threads about similar problems but don't seem to be the same or the solutions provided didn't seem to work in my case.

它看起来像字符编码问题“ \\ 342 \\ 200 \\ 235”,在这种情况下发现了意外字符“ please”,请再次重写所有命令以进行构建

"\\342\\200\\235" is a byte sequenc in octal notation. It the same as e2 80 9c in hexadecimal. And in utf-8 encoding this stands for "LEFT DOUBLE QUOTATION MARK".

Did you
a) open any of the source files in a word processor or
b) (more likely) copy&pasted a config argument containing a double-quote eg from your browser to the console?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM