简体   繁体   中英

building php 5.5 from source in centos, missing mod_php

I am building php 5.5 from source using this command:

sudo ./configure --enable-mbstring --enable-intl --with-gd --with-mysql --with-pdo-mysql --with-curl --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --includedir=/usr/include --prefix=/opt/php5

then

sudo make install

No problems at all during compiling and I can do php -v at the end which gives me the right version of php but the problem is when I try to use httpd (apache) and when I do 'http:// localhost' I can see php source code.

I cannot enable mod_php and there is no mod_php in my /etc/httpd/modules/ directory. What do I need to do to create a mod_php so I can enable it in httpd (apache) server?

I had to include

 --with-apxs2

and before recompiling I had to install:

sudo yum install httpd-devel

Then dont forget include in vhost:

<IfModule mod_php5.c>
    AddType application/x-httpd-php .php
</IfModule>

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