第一次获得了新的MBP2016。尝试设置PHP,MySQL和Apache。使用命令启动Apache
sudo apachectl restart
然后通过安装PHP
brew install php71 --with-httpd24
还做了以下更改...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index.html index.php
SetHandler application/x-httpd-php
ServerName dev-server
另外,在主机文件/etc/hosts/
中也进行了更新
但是,每当我尝试使用命令sudo apachectl restart
或sudo apachectl stop
停止/重新启动apache时,都会出现以下错误。
AH00557: httpd: apr_sockaddr_info_get() failed for Sureshs-MacBook-Pro.local
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
但是,奇怪的是,当我从浏览器http://localhost/index.php
执行任何PHP文件时,它工作正常。就像在index.php文件中一样,我正在使用代码<?php phpinfo(); ?>
,它显示了加载的PHP版本PHP Version 7.1.4
。
尝试了很多,但没有发现哪里出了什么问题。
-更新-
更新我的127.0.0.1 Sureshs-MacBook-Pro.local
文件中的/private/etc/hosts
后,解决了一个错误。现在,我只得到一个以下错误。
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Sureshs-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
参考方案
最后,我通过更新文件ServerName localhost:8080
上的/usr/local/etc/apache2/2.4/httpd.conf
解决了这一问题。这是一个我不知道的不同的httpd.conf文件。
另外,对于Apache start/restart/stop
,以下命令sudo /usr/sbin/apachectl start
对我有效。
我正在尝试从服务器上的apache切换到nginx。唯一的问题是我在PHP脚本中使用的getallheaders()函数,该函数不适用于Nginx。我已经尝试过用户在getallheaders函数上的php站点上提供的注释,但这并不返回所有请求标头。请告诉我如何解决这个问题。我真的想切换到Nginx。 参考方案 您仍然可以使用它,但是您必须像这里一样重新定义…
PHP:将字符串拆分为字母和数字部分的最佳方法 - php我有几个格式的字符串AA11 AAAAAA1111111 AA1111111 分离字符串的字母和数字部分的最佳方法(最有效)? 参考方案 如果它们都是一系列字母,然后是一系列数字,并且没有非字母数字字符,那么sscanf()可能比regexp更有效$example = 'AAA11111'; list($alpha,$numeric) =…
php-casperjs获取内部文本 - php我正在为casperjs使用php包装器-https://github.com/alwex/php-casperjs我正在网上自动化一些重复的工作,我需要访问一个项目的innerText,但是我尚不清楚如何从casperjs浏览器访问dom。我认为在js中我会var arr = document.querySelector('label.input…
PHP:从函数返回值并直接回显它? - php这可能是一个愚蠢的问题,但是……的PHPfunction get_info() { $something = "test"; return $something; } html<div class="test"><?php echo get_info(); ?></div> 有没有办…
php:是否有充分的理由引用所有数组键/索引? - php我正在遍历别人的代码,他们总是避免转义其数组键。例如:$ row_rsCatalogsItems [名称]代替$ row_rsCatalogsItems ['名称']因此,我不断地对自己接触的所有事物进行微小的更改,以应对这些惰性。但是现在我想知道这样做是否有很多好处。我得到它会在默认为字符串之前检查常量(我在处理常量时会讨厌php中的行为,因为即使未定义,…