Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 5安装Web服务器在FreeBSD的6.0与2.2的Apache , MySQL 5.0的和PHP 5 -第5部分
Installing Apache 2.2, MySQL 5 and PHP 5 in FreeBSD 6.0 for a Reliable Web Server 安装的Apache 2.2 , MySQL的5和PHP 5在FreeBSD的6.0为一个可靠的Web服务器
Part 5 - Installing PHP Hypertext Preprocessor Scripting Language 5 and PHP 5 Extensions第5部分-安装的P HP超文本预脚本语言5和P HP5扩展
- Install by enter the following commands on FreeBSD OS command line, wait for previous command to finish before running the next command:安装由输入以下命令在FreeBSD操作系统的命令行,等待前面的命令完成之前,运行在明年的命令:
cd /usr/ports/lang/php5裁谈会/ usr/ports/lang/php5
make install clean make install的清洁 - If you’re prompted, select “use Apache 2.x instead”.如果您提示时,选择“使用的Apache 2.x的不是” 。
- Continue with the following commands to install PHP5 extensions and modules to enable the support of the modules in Apache:继续进行下面的命令来安装php5的扩展和模块,使支持该模块在Apache :
cd /usr/ports/lang/php5-extensions裁谈会/ usr/ports/lang/php5-extensions
make config使配置 - At Options for php5-extension 1.0 menu, select all PHP extensions and modules that you may use with Apache webserver.在选择php5延长1.0菜单中,选择所有的PHP扩展和模块,您可以使用与Apache网络服务器。 This is a part of the configuration for PHP, where you need to enable features of PHP that come in modules, such as ability to manage user sessions, interface with databases and many others.这是一个部分的配置PHP的,如果您需要启用功能的PHP来在模块,如管理能力用户会话,界面与数据库和许多其他问题。 Default extensions such as ctype functions support, HASH Message Digest Framework support, session support and etc have been selected.默认的扩展,如ctype职能的支持,哈希电文摘要框架的支持,会议的支持和等已选定。 Other popular extensions that you most likely to be in used are MySQL database support and GD library support.其他受欢迎的扩展,你最有可能被用在MySQL数据库的支持和GD库的支持。 Use space bar to select or unselect the extensions and press Enter when done.利用空间大律师公会,以选择或取消扩展和按下ENTER时,做了。
- Continue the installation of php5-extensions with the following commands:继续安装php5 -扩展与下列命令:
make install clean make install的清洁
- If there are any message the pops up and prompts you to select some options or configurations, you can just accept the default settings by pressing Enter.如果有任何讯息,持久性有机污染物,并提示您选择一些选项或配置,您可以只接受默认的设置按下ENTER 。 Some modules that may prompt you for action include php5-gd, php5-mbstring and php5-sqlite.一些模块,可能会提示您的行动,包括php5 -钆, php5 - mbstring和php5 - sqlite 。
- Edit the Apache configuration file in order to enable Apache web server to load the PHP modules when initialization:编辑Apache的配置文件,以便使Apache Web服务器加载的PHP模块时初始化:
- Go to Apache configuration file location by cd /usr/local/etc/apache2/到Apache配置文件位置的CD / usr/local/etc/apache2 /
- Edit Apache configuration file by vi httpd.conf编辑Apache配置文件httpd.conf中六
- Search for LoadModule lines, after the last LoadModule line, but within the same section, add the following 2 lines:搜索loadmodule线后,去年loadmodule线,但在同一节中,添加以下2行:
AddType application/x-httpd-php .php将AddType application / x -的httpd - PHP中。 PHP的
AddType application/x-httpd-php-source .phps将AddType application / x -的httpd - PHP的源。 phps
- Optionally, copy /usr/local/etc/php.ini-recommended or /usr/local/etc/php.ini-dist to /usr/local/etc/php.ini (in same directory), which will enable you to tune and change the default settings of behaviours of PHP.可选,复制/ usr / local /下等/ php.ini的推荐或/ usr /本地的/ etc /包中将php.ini - dist为/ usr / local的/ etc / php.ini中(在相同的目录中) ,这将使你调整和更改默认设置的行为的PHP 。
- Start the Apache HTTP web server by using apachectl start (or restart Apache HTTP web server by using apachectl restart).开始的Apache HTTP Web服务器使用apachectl开始(或重新启动的Apache HTTP Web服务器使用apachectl重新启动) 。 apachectl is located in /usr/local/sbin, if you encounter Command not found problem, try to change directory to its location. apachectl是位于/ usr /地方/ sbin ,如果您遇到命令没有发现问题,尝试将目录更改其位置。
- PHP5 installation done. php5安装工作要做。
A web server has been setup with the FreeBSD with Apache, MySQL and PHP. Web服务器已安装与FreeBSD的与Apache , MySQL和PHP 。 The document root of the web server (where you should put your HTML and PHP files is at /usr/local/www/apache22/data/ and you will need a SecureFTP (SFTP) client such as WinSCP to upload your files to web server securely.文档根目录Web伺服器(如你应该把你的HTML和PHP文件是在/ usr/local/www/apache22/data /和您将需要有一个secureftp ( SFTP发布)等客户端winscp ,以上传文件到你的Web伺服器安全。
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 4安装Web服务器在FreeBSD的6.0与2.2的Apache , MySQL 5.0的和PHP 5 -第4部分
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3安装Web服务器在FreeBSD的6.0与2.2的Apache , MySQL 5.0的和PHP 5 -第3部分
- Easily Set Up Web Server with XAMPP很容易成立的Web伺服器与xampp
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 1安装Web服务器在Windows XP的Apache2 , php5和mysql4 -第1部分
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 3安装Web服务器在Windows XP的Apache2 , php5和mysql4 -第3部分
- FreeBSD Apache HTTP Accept Filter Error FreeBSD上的Apache的HTTP接受过滤器的错误
- Using phpMyAdmin for Effective MySQL Management in Windows XP使用phpmyadmin有效MySQL的管理在Windows XP
- PHP 5 Unable to Open HTTP Request Stream with fopen or fsockopen Functions PHP 5中无法打开HTTP请求流与fopen或fsockopen职能
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database启用日志记录慢查询(慢速查询日志)在MySQL数据库
- Enable MySQL InnoDB Storage Engine Support in XAMPP Installation使MySQL的InnoDB存储引擎支持在xampp安装
















May 24th, 2006 10:23 2006年5月24日10时23分
Hi, I am trying to install, php5 with apache2.2 on freebsd 6.1.您好,我正尝试安装, php5与apache2.2在FreeBSD 6.1 。 I have followed the instructions on this page.我已指示,其次是在此页中。 I can get apache running well, but php will not interpret any pages.我可以得到Apache的运行良好,但PHP将不解释任何的页面。 I have a file; info.php with in it, but when I load it from a browser it tries to *download* the php file not display it.我有一个文件; info.php同在,但是当我负荷,它从一个浏览器,它试图*下载* PHP文件无法显示。 Furthermore, the httpd.conf does not have a entry to load the php module as a shared object.此外, httpd.conf中没有一个进入负荷PHP模块作为一个共享对象。 should it?应呢? its as if apache has not idea how to process php’s.其如Apache已不知道如何来处理PHP的。 Any guideance would be appreciated!任何guideance将不胜感激!
kind regards亲切问候
May 24th, 2006 10:30 2006年5月24日10时30分
Did you add the followng lines to your httpd.conf?你添加followng线到您的httpd.conf中?
AddType application/x- httpd-php .将AddType application/x-的httpd - PHP中。 php PHP的
AddType application/x- httpd-php-source .将AddType application/x-的httpd - PHP的源。 phps
Normally, ports installation will auto update the httpd.conf with php5 load module.通常,港口安装会自动更新的httpd.conf与php5负荷模块。 Check if your httpd.conf has the following line, if not try to add:检查如果您的httpd.conf中有以下的路线,如果没有尝试添加:
LoadModule php5_module libexec/apache22/libphp5.so loadmodule php5_module libexec/apache22/libphp5.so
May 24th, 2006 11:54 2006年5月24日11时54分
Yes, I certainly did add the AddType’s是的,当然,我没有添加将AddType的
the php5 port installation did not auto update httpd.conf with ‘LoadModule php5_module libexec/apache22/libphp5.so’.该php5港口安装没有自动更新的httpd.conf与' loadmodule php5_module libexec/apache22/libphp5.so ' 。 I would manually add it but the libphp5.so does not exist in the mentioned directory.我想手动添加它,但libphp5.so不存在在上述目录。 Any idea’s?任何想法的呢? I installed from the /usr/ports/lang/php5 port.我安装了从/ usr/ports/lang/php5港口。 I heard using /usr/ports/www/mod_php5 port may work.我听到使用/ usr/ports/www/mod_php5港口可能的工作。 Would/should it make any difference?会/应该作出任何差别吗?
May 24th, 2006 16:01 2006年5月24日16时01分
Hi Bruce, you may give mod_php5 a try, but I think you will lose some functionalities such as command line CLI.喜布鲁斯,你可以给mod_php5尝试,但我认为你会失去部分功能,如命令行CLI的。 Or else try to make clean in php5 first.否则,设法使清洁的php5第一。 Reinstalling from Apache again worth a try too.重新安装从阿帕奇再次值得一试。 Note that you should install Apache first, and php5 will detect which version of Apache you’re running.请注意,您应该安装的Apache首先,和php5将检测哪个版本的Apache您正在运行。
May 24th, 2006 16:11 2006年5月24日16时11分
Beside, make sure you updated to latest ports tree with旁边,请务必更新到最新的港口与树 portsnap or或 cvsup . 。
May 29th, 2006 20:59 2006年5月29日20时59分
You might missed to install the php for apache, only cgi and cli.你可能错过了要安装的PHP的Apache ,只有CGI和CLI 。
CD /usr/ports/php5裁谈会/ usr/ports/php5
make config使配置
then那么
make install clean make install的清洁
mayby you have to do mayby你必须做
make deinstall && make reinstall作出deinstall & &作出重新安装
June 4th, 2006 10:48 2006年6月4日10时48分
When you add the following lines to httpd.conf file, make sure you removed the extra spaces (there are 2 extra spaces in the original article, following doesnt’t have).当您将下列语句添加到httpd.conf文件,请确保您删除了多余的空格(有2个多余的空格在原来的文章,有下列doesnt't ) 。
AddType application/x-httpd-php .php将AddType application / x -的httpd - PHP中。 PHP的
AddType application/x-httpd-php-source .phps将AddType application / x -的httpd - PHP的源。 phps
June 7th, 2006 05:21 2006年6月7日5时21分
I’m having the same problem as Bruce above.我有同样的问题,因为布鲁斯以上。 I’m using FreeBSD 6.1, Apache 2.2, and PHP 5.1.4.我使用的FreeBSD 6.1 , 2.2的Apache ,和PHP 5.1.4 。 My ports tree is fresh and synched.我国港口的树是新鲜和同步。
I installed the PHP5 port with Apache module support.我安装了php5港口与Apache模块的支持。 The installation completes without complaining, but there is no Apache module built.安装完成后,没有抱怨,但没有Apache模块兴建。 The file /usr/local/libexec/apache22/libphp5.so does not exist.档案/ usr/local/libexec/apache22/libphp5.so不存在。 It doesn’t exist anywhere else in the filesystem either.它不存在任何其他地方的文件。 Something is broken with this port.事情是打破了这个港口。 I see source files in the work directories , like /usr/ports/lang/php5/work/php-5.1.4/sapi/apache that look appropriate to this module… but are not getting compiled.我看到源文件在工作目录,如/ usr/ports/lang/php5/work/php-5.1.4/sapi/apache看起来适当此模块… …但没有得到编译。 Any insights?任何见解?
June 9th, 2006 20:41 2006年6月9日20时41分
Ahmet gave a working answer.艾哈迈德了工作的答案。 I was having the same problems, until I noticed the extra space before the file extention, now everything works like a charm!我有相同的问题,直到我看到了额外空间,之前的档案延伸,现在一切都像一个工程的魅力!
June 9th, 2006 20:59 2006年6月9日20时59分
Thanks for point out, has since corrected the error.感谢指出,自更正的错误。
August 28th, 2006 10:55 2006年8月28日10时55分
Recompile php5 with ‘Apache Module’ included.重新编译php5与' Apache模块'包括在内。
‘cd /usr/ports/lang/php5′ '的CD / usr/ports/lang/php5 '
‘make deinstall’ ignore warnings '作出deinstall '听从警告
‘make config’ make sure to select apache module '使配置' ,请务必选择Apache模块
‘make install’ ' make install的'
September 26th, 2006 16:37 2006年9月26日16时37分
I’ve Done it successfully.我已经做了成功。 It doesnt work..它的doesn't工作..
How do i access it?我要如何访问它?
ive typed香港专业教育学院打字 http://192.168.1.9
November 29th, 2006 10:32 2006年11月29日10时32分
Had run into the same problem as those above with the extra spaces in the AddType declaration but solved it before looking at the comments.遇到了同样的问题,作为上述与多余的空格,在将AddType宣言,但解决它在研究的意见。 Would recommend updating the article as, all in all, this is a great tutorial.会建议更新文章,总而言之,这是一个伟大的补习。 Thanks.谢谢。
Ben本
November 29th, 2006 12:35 2006年11月29日12时35分
Thanks Ben, have since corrected the error.感谢本,自那时以来,纠正了错误。
January 6th, 2007 16:50 2007年1月6日16时50分
I’m running into the same issue.我运行到同一问题。 My php files are trying to download instead.我的PHP文件尝试下载。
I’ve gone over everything three and four times yet nothing.我已经经历过的一切3和4倍,但一无所获。
I’ve checked the additional spaces as well and no luck.我已经检查了额外的空间,以及没有运气。
Any assistance is appreciated!!任何援助表示赞赏!
January 9th, 2007 22:05 2007年1月9日22时05分
I had same issue.我有同样的问题。
Try make config and unselect CGI and be sure to select APACHE.尝试使配置和取消CGI和,一定要选择的Apache 。
Check at end of install that you have a line like:chmod 755 /usr/local/libexec/apache22/libphp5.so检查结束安装您有一个线,例如: chmod 755 / usr/local/libexec/apache22/libphp5.so
I config without CLI ang CGI. i配置没有CLI的昂的CGI 。
March 16th, 2007 08:28 2007年3月16日8时28分
Trying to install the package php5 without port sources via试图安装套件php5没有港口的来源,经
pkg_add -r php5 pkg_add - R的php5
only this doesnt install the apache module by the looks of it..只有这样的doesn't安装的Apache模块所期待的,它..
nor does it build it..也没有建设..
I dont want the sources on the server because it is to be a production server.. i不用想的来源在服务器上,因为它是一个生产服务器.. i’m gunna try a reinstall…我gunna尝试重新安装…
March 16th, 2007 08:36 2007年3月16日8时36分
reinstall was unsuccessful重新安装不成功
April 18th, 2007 05:40 2007年4月18日05:40
I uninstalled, reinstalled making double sure to include the Apache model, still no dice. i卸载,重新安装,使双重肯定,包括Apache的模型,仍然没有骰子。 So I uninstalled again and reinstalled without CLI and CGI and it still would startup no errors, but it would list the directories in document source and would treat cgi files as text files.因此,我再次卸载并重新安装,没有的CLI和CGI ,它仍然会启动没有错误,但它会列出目录的文件来源,并会处理CGI文件作为文本文件。 All my configs were in order, so I thought maybe it needed a reboot… and walah.我所有的configs人,秩序,所以我想,也许它需要重新启动… …和walah 。 Working like a charm.工作就像一个魅力。
I think Unix is for massochists =)我认为UNIX是为massochists = )
April 18th, 2007 05:42 2007年4月18日5时42分
edit..编辑.. I meant ” ..我的意思是“ .. would treat PHP files as text files ..” and not CGI.将处理PHP文件的文本文件.. “ ,而不是CGI模式。
Long day =0漫长的一天= 0
September 14th, 2007 17:03 2007年9月14日17时03分
I’ve been trying to install Timetrex and it requires Apache, php and postgresql.我一直在尝试安装timetrex和它需要的Apache , PHP和PostgreSQL的支持。 Postgresql is not a problem because I install it from source. PostgreSQL的是不是一个问题,因为我安装它从源头。 But as you can see from above, the FreeBSD ports system is so often in a state of flux that you’re not guaranteed anything that will work.但正如你可以看到从上述情况, FreeBSD的港口系统是如此,往往在一个国家的通量,您不能保证任何会的工作。
On this issue, the bosses, and I myself got so fed up with the results from FreeBSD that we installed Fedora and then took the vendors installation file, which only works on Linux and got on with the task.在这个问题上,老板和我自己了,所以厌倦了,结果从FreeBSD上,我们安装的Fedora ,然后采取了供应商的安装文件,其中只有工程在Linux上,得到了关于与任务。
With so many dependencies and librairies to update, the FreeBSD ports system as left me feeling very cautious about using it and it harkens me back to the old M$ “dll - hell” days when Windows 3x and Win9x were such a pain to deal with.如此众多的相依性,以及librairies更新, FreeBSD的港口体系,给我留下的感觉非常谨慎使用资讯科技及harkens我回到旧米元“的DLL -地狱”天当W indows3倍和W in9x被这样的疼痛处理。
November 30th, 2007 09:57 2007年11月30日9时57分
This series of articles has been very, very helpful.这一系列的文章,一直是非常,非常有帮助。 Many thanks for your contribution!许多感谢您的贡献!
December 11th, 2007 20:53 2007年12月11日20时53分
Should the problem with downloadable sourcecodes exist for anyone else, if it was just a problem occurring from localhost, changing the listening port from the default 80 to *:80 might help.应的问题与下载sourcecodes存在其他任何人,如果这只是问题的发生,从localhost ,因此改变的侦听端口从默认80 * : 80 ,可能的帮助。 It is highly likely that in the above mentioned cases Apache had not much to do with serving the files on localhost.这是极有可能在上述情况下的Apache已经没有太大的做与服务档案,对本地。
Fedora does not have less dependancies, they are just handeld elswehere out of user eyes. Fedora的没有少dependancies ,他们只是handeld elswehere出使用者眼睛是雪亮的。
Understanding the package & port system and when and why to update is part of the game.了解包&港口体系和何时及为何要更新的一部分游戏。
For those who go for Fedora on servers, you might opt for ubuntu instead.对于谁去Fedora的服务器上,您可以选择Ubuntu的不是。 it’s easy and fast as well as free.它的方便快捷,以及免费的。
May 10th, 2008 01:44 2008年5月10日1时44分
Lol, you should put this somewhere… lol ,你应该把这个某处…
Befor testing… REBOOT!前测试…重新启动! XD XD法
30 minutes lost trying to fix apache + php and all that was required was reboot ¬¬在30分钟内失去试图解决的Apache + PHP和所有需要的是重新启动¬ ¬