dqcuq4138 2018-04-26 11:46
浏览 32
已采纳

在自定义编译的Apache上安装PHP时出错

I have downloaded and compiled Apache into my home directory, and it works on its own properly. The script I am using for this is [REDACTED] which downloads Apache, APR, and [REDACTED] to make an installation into whatever the current directory.

I have tried adding PHP support for this in a few ways. The first I tried was just to install the default php package with apt-get which can come with the Raspbian operating system (I believe this was some version of php5). I then removed that and installed php7.0 with libapache2-mod-php7.0 also using apt-get, but the results of both installations resulted in Apache not seeing the module. I also would like to stick with everything being encapsulated into the current directory (in this case it is ~ currently).

I then downloaded the php-7.2.4 package from php.net and compiled the source on my own with

configure --prefix=~/php --with-apxs2=~/apache/bin/apxs --enable-mbstring --with-openssl --enable-zip
make
make test
make install
cp php-production.ini ~/php/lib/php.ini
libtool --finish ~/php7/libs
~/apache/bin/apachectl restart

I can then run ~/php/bin/php -v without problems.

In the ~/apache/conf/httpd.conf the lines added for

LoadModule php7_module modules/libphp7.so
...
<IfModule php7_module>
    AddType application/x-httpd-php .php
    AddHandler application/x-httpd-php .php
</IfModule>
...
<IfModule dir_module>
    DirectoryIndex index.php index.htm index.html
</IfModule>

The PHP installer added the LoadModule line for me. I also do not have the a2enmod (or variants) as they seem to be specific to certain distributions.

  • 写回答

1条回答 默认 最新

  • dqy012345 2018-04-26 14:10
    关注

    I have found the problem after looking for the answer to Dave's comment. Between the last time I looked for libphp7.so and the time of the initial posting, I must have run the libtool and not restarted Apache. Everything is working as intended now. :)

    Main post updated with command chain correction.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵