这篇文章主要介绍了关于php的安装以及与apache整合的介绍,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
apache 2.4.29
php 5.4.45
# tar -zxvf php-5.4.45.tar.gz # cd php-5.4.45 # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml2=/usr/include/libxml2 # make # make install
/configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml2=/usr/include/libxml2
错误log:
立即学习“PHP免费学习笔记(深入)”;
Sorry, I cannot run apxs. Possible reasons follow: 1. Perl is not installed 2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs 3. Apache was not built using --enable-so (the apxs usage page is displayed) The output of /usr/local/apache2/bin/apxs follows: ./configure: /usr/local/apache2/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory configure: error: Aborting
按照提示安装perl
# perl -v //先查看果然没安装 # yum install -y perl # perl -v //安装成功 This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
再次./configure仍然提示这个错误。于是百度。。。。
才知道需要先按照perl再按照apache才行,不安装perl的情况下安装apache,apxs就无法运行。
补救办法:
查看文件
# cat /usr/local/apache2/bin/apxs
第一行是 #!/replace/with/path/to/perl/interpreter -w
改为:#!/usr/bin/perl -w
再次:
X-Cart号称是全球最强大的PHP购物车软件,几乎囊括所有电子商务功能,采用网页方式管理后台,多语言支持,智能库存管理,模板定制灵活,功能插件化、模块化。X-Cart分为gold版和Pro版这两个版本。Gold版为普通商店版,Pro为商城版。这款软件的优势是功能比较强大,由于是付费方式采用终生制的开源软件,软件的稳定性、安全性以及可扩展性较强。目前已知的能与x-cart跨平台整合的软件包括了国外
0
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml2=/usr/include/libxml2
成功!
如果php安装正确,apache的配置文件会自动被备份(httpd.conf.bak)和修改,修改如下
打开如下注释,加载php模块。
LoadModule php5_module modules/libphp5.so
如果想让apache解析php文件,还需要在httpd.conf中加入(#AddOutputFilter INCLUDES .shtml下面):
AddType application/x-httpd-php .html AddHandler php5-script .php
让apache解析PHP代码
AddHandler php5-script .php
让apache解析html里的PHP代码
AddType application/x-httpd-php .html
<?php phpinfo(); ?>
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号