简体   繁体   中英

Apache not serving php files

So I'm trying to get my LAMP stack to work in my Macbook. I've apache setup but PHP is not working. I've installed php55 with Brew and loaded the module in my httpd.conf file like this:

LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so

I've checked if the libphp5.so was at the location the module is pointing and it was there.

If I check my apache error.log I get the following message:

 [Sat Apr 23 21:36:59.307093 2016] [ssl:warn] [pid 7231] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
 [Sat Apr 23 21:36:59.358254 2016] [auth_digest:notice] [pid 7231] AH01757: generating secret for digest authentication ...
 [Sat Apr 23 21:36:59.360623 2016] [mpm_prefork:notice] [pid 7231] AH00163: Apache/2.4.18 (Unix) LibreSSL/2.2.6 PHP/5.5.34 configured -- resuming normal operations
 [Sat Apr 23 21:36:59.360661 2016] [core:notice] [pid 7231] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

I'm missing something but I'm not quite sure what at this point.

add the following line to your httpd.conf:

AddHandler application/x-httpd-php .php

after apache restart everything should work

Did you also update your Apache config to recognize .php extensions?

AddType application/x-httpd-php .php

or

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

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