在Leopard中启用PHP [英] Enabling PHP in Leopard

查看:45
本文介绍了在Leopard中启用PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用我的新Macbook Pro作为工作的开发平台,

所以我去寻找有关安装Apache,PHP,Postgres等的信息

豹。我在搜索中发现默认情况下已经安装了Apache和PHP,但是已禁用,所以我只需要启用

已经安装的版本。 br />

启动Apache并运行没问题。您只需选中启用

网络共享即可在共享控制面板中,你走了。得到

PHP工作证明并非如此简单。


我确保Apache没有运行,启动终端并关注

我在网上发现的说明。即我将CD转到/ etc / apache2,

然后sudo pico httpd.conf并取消注释加载的行

php5_module.so。我保存了更改并重新启动了服务器。没有

欢乐。服务器提供HTML没有问题,但是PHP文件并没有执行,只是回复了他们的源代码。


我很明显错过了什么,但什么?我是否需要将PHP

MIME类型添加到httpd.conf?没有任何一个网站提供

启用PHP的说明提到需要这样做。或者是否还有一些其他的步骤

我错过了?

I want to use my new Macbook Pro as a development platform for work,
so I went looking for info on installing Apache, PHP, Postgres, etc on
Leopard. I discovered in my search that Apache and PHP are already
installed by default, but disabled, so I''d just have to enable the
already-installed versions.

Getting Apache up and running was no problem. You just check "enable
web sharing" in the Sharing control panel and away you go. getting
PHP working is proving not to be so simple.

I made sure Apache was not running, started a terminal and followed
the instructions I had found online. Namely I CD''d to /etc/apache2,
then sudo pico httpd.conf and uncommented the line that loads
php5_module.so. I saved my changes and restarted the server. No
joy. The server was serving HTML no trouble, but PHP files were not
executing and just echoing their source code back.

I''m obviously missing something, but what? Do I need to add the PHP
MIME type to httpd.conf? None of the websites with instructions for
enabling PHP mentioned needing to do so. Or is there some other step
that I''m missing?

推荐答案

2007年12月11日星期二14: 43:05 +0100,Gordon< go ********** @ ntlworld.com>

写道:
On Tue, 11 Dec 2007 14:43:05 +0100, Gordon <go**********@ntlworld.com>
wrote:

我想用我的新Macbook Pro作为工作的开发平台,

所以我去寻找有关在
Leopard上安装Apache,PHP,Postgres等的信息。我在搜索中发现默认情况下已经安装了Apache和PHP,但是已禁用,所以我只需要启用

已经安装的版本。 br />

启动Apache并运行没问题。您只需选中启用

网络共享即可在共享控制面板中,你走了。得到

PHP工作证明并非如此简单。


我确保Apache没有运行,启动终端并关注

我在网上发现的说明。即我将CD转到/ etc / apache2,

然后sudo pico httpd.conf并取消注释加载的行

php5_module.so。我保存了更改并重新启动了服务器。没有

欢乐。服务器提供HTML没有问题,但是PHP文件并没有执行,只是回复了他们的源代码。


我很明显错过了什么,但什么?我是否需要将PHP

MIME类型添加到httpd.conf?没有任何一个网站提供

启用PHP的说明提到需要这样做。或者还有其他一些我错过了吗?
I want to use my new Macbook Pro as a development platform for work,
so I went looking for info on installing Apache, PHP, Postgres, etc on
Leopard. I discovered in my search that Apache and PHP are already
installed by default, but disabled, so I''d just have to enable the
already-installed versions.

Getting Apache up and running was no problem. You just check "enable
web sharing" in the Sharing control panel and away you go. getting
PHP working is proving not to be so simple.

I made sure Apache was not running, started a terminal and followed
the instructions I had found online. Namely I CD''d to /etc/apache2,
then sudo pico httpd.conf and uncommented the line that loads
php5_module.so. I saved my changes and restarted the server. No
joy. The server was serving HTML no trouble, but PHP files were not
executing and just echoing their source code back.

I''m obviously missing something, but what? Do I need to add the PHP
MIME type to httpd.conf? None of the websites with instructions for
enabling PHP mentioned needing to do so. Or is there some other step
that I''m missing?



< http://nl2.php.net/manual/en/install.macosx.bundled.php>

(这个仍然提到php4,但你得到漂移)


将这些行添加到httpd.conf,然后重启服务器:


AddType应用程序/ x-httpd-php .php

AddType application / x-httpd-php-source .phps


并且可能添加''index.php''到DirectoryIndex指令。

-

Rik Wasmus

<http://nl2.php.net/manual/en/install.macosx.bundled.php>
(this still mentions php4, but you get the drift)

Add these lines to httpd.conf, and then restart the server:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

And possibly add ''index.php'' to the DirectoryIndex directive.
--
Rik Wasmus


Rik Wasmus< lu ***** *******@hotmail.com写道:
Rik Wasmus <lu************@hotmail.comwrote:

星期二,2007年12月11日14:43:05 +0100,戈登< go **** ******@ntlworld.com>

写道:
On Tue, 11 Dec 2007 14:43:05 +0100, Gordon <go**********@ntlworld.com>
wrote:

我想用我的新Macbook Pro作为开发平台工作,

所以我去寻找有关安装Apache,PHP,Postgres等的信息

Leopard。我在搜索中发现默认情况下已经安装了Apache和PHP,但是已禁用,所以我只需要启用

已经安装的版本。 br />

启动Apache并运行没问题。您只需选中启用

网络共享即可在共享控制面板中,你走了。得到

PHP工作证明并非如此简单。


我确保Apache没有运行,启动终端并关注

我在网上发现的说明。即我将CD转到/ etc / apache2,

然后sudo pico httpd.conf并取消注释加载的行

php5_module.so。我保存了更改并重新启动了服务器。没有

欢乐。服务器提供HTML没有问题,但PHP文件执行并没有回复他们的源代码。
I want to use my new Macbook Pro as a development platform for work,
so I went looking for info on installing Apache, PHP, Postgres, etc on
Leopard. I discovered in my search that Apache and PHP are already
installed by default, but disabled, so I''d just have to enable the
already-installed versions.

Getting Apache up and running was no problem. You just check "enable
web sharing" in the Sharing control panel and away you go. getting
PHP working is proving not to be so simple.

I made sure Apache was not running, started a terminal and followed
the instructions I had found online. Namely I CD''d to /etc/apache2,
then sudo pico httpd.conf and uncommented the line that loads
php5_module.so. I saved my changes and restarted the server. No
joy. The server was serving HTML no trouble, but PHP files were not
executing and just echoing their source code back.



这正是我所做的。


我第一次遇到同样的问题试图执行一些PHP,但它后来似乎自己纠正了(不明白为什么)。它目前工作正常。

我最初认为识别<?前缀但是

它可以用<?php,或者它不喜欢直接进入PHP

没有HTML标题,因为它工作后我做了那些改变。在

进一步调查后,这些变成了红色鲱鱼。我有一个名为info.php的测试

文件工作正常,它包含以下

单行:


< ?的phpinfo(); ?>


Mac OS X 10.5.1,Apache 2.2.6(标准)和PHP 5.2.4(标准)。


我保留了原始httpd.conf的副本并将其与我的

版本进行比较,我所做的唯一相关更改是取消注释

LoadModule php5_module。 .."在我启用PHP的

时间周围,/ var / log / apache2 / error_log中我看不到任何奇怪的内容。


它显示Apache启动时加载了PHP,这不是以前的时间。

That''s exactly what I did.

I had the same problem the first time I tried to execute some PHP but it
seemed to correct itself subsequently (no idea why). It is working fine
at the moment.

I initially thought there was a problem recognising the "<?" prefix but
it was OK with "<?php", or it didn''t like jumping straight into PHP
without an HTML header, as it worked after I made those changes. On
further investigation these turned out to be red herrings. I have a test
file called info.php which works fine and it contains the following
single line:

<? phpinfo(); ?>

Mac OS X 10.5.1, Apache 2.2.6 (standard) and PHP 5.2.4 (standard).

I''ve kept a copy of the original httpd.conf and comparing it to my
version, the only relevant change I made was uncommenting the
"LoadModule php5_module ..." line.

I can''t see anything strange in /var/log/apache2/error_log around the
time I enabled PHP. It shows Apache starting up with PHP loaded, which
it didn''t the previous time.


我明显错过了什么,但是什么?我是否需要将PHP

MIME类型添加到httpd.conf?没有任何一个网站提供

启用PHP的说明提到需要这样做。或者还有其他一些我错过了吗?
I''m obviously missing something, but what? Do I need to add the PHP
MIME type to httpd.conf? None of the websites with instructions for
enabling PHP mentioned needing to do so. Or is there some other step
that I''m missing?



< http://nl2.php.net/manual/en/install.macosx.bundled.php>

(这个仍然提到php4,但你得到漂移)


将这些行添加到httpd.conf,然后重启服务器:


AddType应用程序/ x-httpd-php .php

AddType application / x-httpd-php-source .phps


并且可能添加''index.php''到DirectoryIndex指令。


<http://nl2.php.net/manual/en/install.macosx.bundled.php>
(this still mentions php4, but you get the drift)

Add these lines to httpd.conf, and then restart the server:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

And possibly add ''index.php'' to the DirectoryIndex directive.



这些都不是必需的。有一个文件/etc/apache2/other/php5.conf

包含所有这些指令,条件是PHP5模块

正在加载。 其他中的所有文件都包含在httpd.conf中。


-

David Empson
de ***** @ actrix.gen.nz


12月11日,14日:24,demp ... @ actrix.gen.nz(David Empson)写道:
On 11 Dec, 14:24, demp...@actrix.gen.nz (David Empson) wrote:

我最初认为识别<?时出现问题;前缀但是

可以使用<?php
I initially thought there was a problem recognising the "<?" prefix but
it was OK with "<?php"



您可能需要特定地设置短标签。或者更好的是,根本不要使用

''em。

You may have to spcifically set short tags on. Or better, don''t use
''em at all.


这篇关于在Leopard中启用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆