阿帕奇2.4不加载php5.5与Mac OS 10.8 [英] Apache 2.4 not loading php5.5 with Mac OS 10.8

查看:277
本文介绍了阿帕奇2.4不加载php5.5与Mac OS 10.8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Mac迷你与Mac OS 10.8.5使用Apache 2.4.7与php5.5

安装了Apache 2.4.7按照此处 说明

运行apachectl中-v,显示

 服务器版本:阿帕奇/ 2.4.7(UNIX)
Server内置:2014年3月4日19时23分56秒

PHP5.5安装继这里 说明p>

运行PHP -v,显示

  PHP 5.5.8(CLI)(建:2014年1月12日十八时50分29秒)
版权所有(c)1997-2013的PHP集团
Zend引擎V2.5.0,版权所有(C)1998年至2013年Zend技术
与Zend OPcache v7.0.3-dev的,版权所有(C)一九九九年至2013年,由Zend技术
与Xdebug的V2.2.3,版权所有(C)2002至13年,由德里克Rethans的

我在Apache http.conf文件以下行添加

 的LoadModule php5_module /usr/local/php5/libphp5.so

但它似乎没有工作,因为当我尝试启动与服务器

 须藤apachectl中启动

它产生以下错误

 的httpd:对/usr/local/apache-2.4.7/conf/httpd.conf 151行语法错误:
    无法加载/usr/local/php5/libphp5.so到服务器:
        的dlopen(/usr/local/php5/libphp5.so,10):找不到符号:
            unixd_config \\ n
从参考:/usr/local/php5/libphp5.so
预计:在/usr/local/php5/libphp5.so /usr/local/apache-2.4.7/bin/httpd

正如我所链接的教程建议,我修改了我的bash的个人资料

 出口PATH =〜/斌:在/ usr /本地/ PHP5 /斌:$ PATH
出口MANPATH =的/ usr /本地/ Apache /人:$ MANPATH

我一直在尝试了几个小时不同的解决方案,这是据我得到了。

如果有人可以给我一些提示,我会很开心,我很绝望......!


解决方案

在时间和尝试这个小时和做到这一点,我设法使它工作。

我将介绍我做什么,以帮助其他人保存这些个小时!

注意,这个解决方案适用于Mac OS X的10.8.5。它可能不适合你!

以下是有阿帕奇2.4.7 PHP 5.5 工作


  1. 更​​新和下载工具,你需要的。

    1.1 - X code。从苹果商店免费得到它。

    1.2 - X code命令行。转到X code,preferences,下载,并获得命令行。

    1.3 - 家酿。使用下面的命令:

     红宝石-e$(卷曲-fsSL https://raw.github.com/Homebrew/homebrew/go/install)

    请参阅网站获得更多信息。


  2. 若干检查

    2.1 - 检查没有当前Apache或PHP的安装目录讨厌周围。要做到这一点我删除了他们,追杀配置文件,以防万一,用命令

     找到的/ usr -name阿帕奇找到的/ usr -name的httpd找到的/ usr -namePHP

    2.2 - 使用BREW医生确认无CONFIGS是恼人的安装

      BREW医生

    2.3 - 检查你做的对通过确认以下命令不工作

      PHP -v
    apachectl中-v
    httpd的-v


  3. 安装Apache

    3.1 - 使用href=\"https://github.com/djl/homebrew-apache2\"从DJL rel=\"nofollow\">自制的Apache2的

      BREW自来水DJL /自制-的Apache2
    BREW安装DJL / Apache2的/ apache24

    3.2 - 修改你的.bash_profile为了让在/ usr / local / bin目录的优先级文件夹(因此系统会从像/ usr / sbin目录,而不是有其他的文件夹中的Apache和PHP)

     回声'出口PATH =的/ usr / local / bin目录:$ PATH'>> 〜/ .bash_profile中

    3.3 - 确认Apache的作品。看来要做到这一点,启动服务,去为localhost其中,它的工作原理。然后关闭该用PHP进行。

     须藤apachectl中启动
    (转到浏览器并打开本地主机)
    须藤apachectl中停止


  4. 安装PHP

    4.1使用href=\"https://github.com/josegonzalez/homebrew-php\" rel=\"nofollow\">从josegonzalez 自制PHP的

      BREW自来水自制/易受骗的人
    BREW自来水自制软件/版本
    BREW自来水josegonzalez /自制的PHP
    酿造安装php55

    4.2的情况下的没有奏效由于以下错误的:

    在/ usr / sbin目录/ apxs的行217没有这样的文件或目录:

     无法打开/usr/share/httpd/build/config_vars.mk。

    ...创建一个符号链接是这样的:

      CD的/ usr /共享/
    须藤LN -s在/ usr /本地/库/ apache24 /< Apache的版本安装> / httpd的

    ...并再次执行安装。

    <安装Apache的版本>将取决于安装的版本。
    在写这篇文章的此刻,它是2.4.10


  5. 告知Apache关于它的新朋友。

    5.1修改httpd.conf。
    首先打开该文件。

      CD的/ usr / local / etc中/ Apache2的/
    须藤纳米的httpd.conf

    ...然后添加PHP模块LoadModule节(搜索的LoadModule)

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

    ...并在mime_module添加PHP类型。搜索mime_module,在这部分中,搜索#过滤器

    ......添加下一行下他们。

     使用Apache PHP模块#处理PHP类型的文件
    将AddType应用/ X的httpd - PHP的.php

    这告诉Apache运行该文件通过它的PHP处理器之前,将它发送给客户端。

    ...保存并退出。


  6. 可选的,如果您想将网站存储在您的用户文件夹而不是WebService的。

    6.1再次修改httpd.conf中。
    打开文件。

      CD的/ usr / local / etc中/ Apache2的/
    须藤纳米的httpd.conf

    和添加以下行在文件的结尾,您的用户名替换。

     服务器名dev.local
    用户<用户名>
    集团员工的DocumentRoot/用户/<用户名> /网站
    错误日志/usr/local/var/log/apache-error.log
    的CustomLog/usr/local/var/log/apache-access.log共同
    <目录/用户/<用户名> /网站>
      所有的选项
      所有的AllowOverride
      IndexOptions NameWidth = *  要求所有被拒绝
      需要主机本地主机
      需要主机127.0.0.1
    < /目录>


  7. 完成它!

    7.1启动Apache服务

     须藤apachectl中启动

    7.2创建您的网站文件夹的根目录下的PHP文件(如果你做了第6步,在/Users//Sites/test.php创建它)

    7.3打开它。

     进入浏览器和本地主机/ test.php的


祝你好运。

I am trying to use Apache 2.4.7 with php5.5 in my Mini Mac with Mac Os 10.8.5

Apache 2.4.7 installed following instructions in here

Run apachectl -v, shows

Server version: Apache/2.4.7 (Unix)
Server built:   Mar  4 2014 19:23:56

PHP5.5 installed following instructions in here

Run php -v, shows

 PHP 5.5.8 (cli) (built: Jan 12 2014 18:50:29) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

I added in the apache http.conf file the following line

LoadModule php5_module /usr/local/php5/libphp5.so

But it does not seem to work, as when I try to start the server with

sudo apachectl start

It produces the following error

httpd: Syntax error on line 151 of /usr/local/apache-2.4.7/conf/httpd.conf:
    Cannot load /usr/local/php5/libphp5.so into server: 
        dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found:
            unixd_config\n
Referenced from: /usr/local/php5/libphp5.so
Expected in: /usr/local/apache-2.4.7/bin/httpd in /usr/local/php5/libphp5.so

As suggested in the tutorials I have linked, I modified my bash profile with

export PATH=~/bin:/usr/local/php5/bin:$PATH
export MANPATH=/usr/local/apache/man:$MANPATH

I have been trying for hours different solutions, and this is as far as I got.

If someone can give me some hints I would be very happy, I am quite desperate...!

解决方案

After hours and hours of try this and do that, I managed to make it work.

I will describe what I did, in order to help other people save those hours!

Be aware that this solution works for the MAc OS X 10.8.5. It might not work for you!

The following is to have apache 2.4.7 with php 5.5 working

  1. Update and download tools you need.

    1.1 - XCode. Get it from Apple Store for free.

    1.2 - XCode command line. Go to XCode, Preferences, Downloads, and get the command line.

    1.3 - Homebrew. Use the following command:

    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    

    See the website for more info.

  2. Several checks

    2.1 - Check that there is no current apache or php instalation annoying around. To do so I deleted them and hunted down config files, just in case, with the commands

    find /usr -name "apache"
    
    find /usr -name "httpd"
    
    find /usr -name "php
    

    2.2 - Use brew doctor to confirm no configs are annoying the setup.

    brew doctor
    

    2.3 - Check that you did it right by confirming that following commands do not work

    php -v
    apachectl -v
    httpd -v
    

  3. Install apache

    3.1 - Use the homebrew apache2 from djl.

    brew tap djl/homebrew-apache2
    brew install djl/apache2/apache24
    

    3.2 - Modify your .bash_profile in order to make the /usr/local/bin the priority folder (so the system gets the apache and php from there instead other folder like /usr/sbin)

    echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
    

    3.3 - Confirm that apache works. To do this, start the service and go to localhost where "It works" appears. Then shut it down to proceed with php.

    sudo apachectl start
    (Go to browser and open localhost)
    sudo apachectl stop
    

  4. Install php

    4.1 Use the homebrew php from josegonzalez

    brew tap homebrew/dupes
    brew tap homebrew/versions
    brew tap josegonzalez/homebrew-php
    brew install php55
    

    4.2 In case it did not work because of the following error :

    cannot open /usr/share/httpd/build/config_vars.mk: No such file or directory at /usr/sbin/apxs line 217.
    

    ... create a symlink this way:

    cd /usr/share/
    sudo ln -s /usr/local/Cellar/apache24/< apache version installed >/ httpd
    

    ... and execute the install again.

    < apache version installed > will depend on the version installed. At the moment of this writing, it is 2.4.10

  5. Tell Apache about its new friend.

    5.1 Modify the httpd.conf. First open the file.

    cd /usr/local/etc/apache2/
    sudo nano httpd.conf
    

    ... then add the php module in the LoadModule section (search for LoadModule)

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

    ... and add the php type in the mime_module. Search for mime_module and, in that section, search for # Filters

    ... add the next line under them.

    # process php type files using apache php module
    AddType application/x-httpd-php .php
    

    that tells Apache to run the file through it's php processor prior to sending it to the client.

    ... save and exit.

  6. OPTIONAL, if you want to store the Sites in your User folder instead of WebService.

    6.1 Modify again the httpd.conf. Open the file.

    cd /usr/local/etc/apache2/
    sudo nano httpd.conf
    

    And add the following lines at the end of the file, replacing with your username.

    ServerName dev.local
    User <username>
    Group staff
    
    DocumentRoot "/Users/<username>/Sites"
    ErrorLog "/usr/local/var/log/apache-error.log"
    CustomLog "/usr/local/var/log/apache-access.log" common
    <Directory "/Users/<username>/Sites">
      Options All
      AllowOverride All
      IndexOptions NameWidth=*
    
      Require all denied
      Require host localhost
      Require host 127.0.0.1
    </Directory>
    

  7. Finish it!

    7.1 Start apache service

    sudo apachectl start
    

    7.2 Create a php file in the root of your Sites folder (If you did step 6, create it in /Users//Sites/test.php)

    7.3 Open it.

    Go to Browser and localhost/test.php
    

Good luck.

这篇关于阿帕奇2.4不加载php5.5与Mac OS 10.8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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