0

I posted earlier about my laravel projects always returning a 500 error, and I didn't receive much help but I've been trying to fix it for so many hours and I think I'm losing my mind.

I did a bunch of updates in the terminal I think and just as I thought I fixed it, I got a ERR_CONNECTION_REFUSED error from chrome.. and when I tried sudo apachectl start/restart/stop I got this error:

httpd: Syntax error on line 510 of /usr/local/etc/apache2/2.2/httpd.conf: </IfModule> without matching <IfModule> section

So I navigated to that file and here are its contents.

  #
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr/local/opt/httpd22"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8080

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module libexec/mod_authn_file.so
LoadModule authn_dbm_module libexec/mod_authn_dbm.so
LoadModule authn_anon_module libexec/mod_authn_anon.so
LoadModule authn_dbd_module libexec/mod_authn_dbd.so
LoadModule authn_default_module libexec/mod_authn_default.so
LoadModule authz_host_module libexec/mod_authz_host.so
LoadModule authz_groupfile_module libexec/mod_authz_groupfile.so
LoadModule authz_user_module libexec/mod_authz_user.so
LoadModule authz_dbm_module libexec/mod_authz_dbm.so
LoadModule authz_owner_module libexec/mod_authz_owner.so
LoadModule authz_default_module libexec/mod_authz_default.so
LoadModule auth_basic_module libexec/mod_auth_basic.so
LoadModule auth_digest_module libexec/mod_auth_digest.so
LoadModule cache_module libexec/mod_cache.so
LoadModule dbd_module libexec/mod_dbd.so
LoadModule dumpio_module libexec/mod_dumpio.so
LoadModule reqtimeout_module libexec/mod_reqtimeout.so
LoadModule ext_filter_module libexec/mod_ext_filter.so
LoadModule include_module libexec/mod_include.so
LoadModule filter_module libexec/mod_filter.so
LoadModule substitute_module libexec/mod_substitute.so
LoadModule deflate_module libexec/mod_deflate.so
LoadModule log_config_module libexec/mod_log_config.so
LoadModule log_forensic_module libexec/mod_log_forensic.so
LoadModule logio_module libexec/mod_logio.so
LoadModule env_module libexec/mod_env.so
LoadModule mime_magic_module libexec/mod_mime_magic.so
LoadModule cern_meta_module libexec/mod_cern_meta.so
LoadModule expires_module libexec/mod_expires.so
LoadModule headers_module libexec/mod_headers.so
LoadModule ident_module libexec/mod_ident.so
LoadModule usertrack_module libexec/mod_usertrack.so
LoadModule unique_id_module libexec/mod_unique_id.so
LoadModule setenvif_module libexec/mod_setenvif.so
LoadModule version_module libexec/mod_version.so
LoadModule proxy_module libexec/mod_proxy.so
LoadModule proxy_connect_module libexec/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/mod_proxy_http.so
LoadModule proxy_scgi_module libexec/mod_proxy_scgi.so
LoadModule proxy_ajp_module libexec/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/mod_proxy_balancer.so
LoadModule ssl_module libexec/mod_ssl.so
LoadModule mime_module libexec/mod_mime.so
LoadModule dav_module libexec/mod_dav.so
LoadModule status_module libexec/mod_status.so
LoadModule autoindex_module libexec/mod_autoindex.so
LoadModule asis_module libexec/mod_asis.so
LoadModule info_module libexec/mod_info.so
LoadModule suexec_module libexec/mod_suexec.so
LoadModule cgid_module libexec/mod_cgid.so
LoadModule cgi_module libexec/mod_cgi.so
LoadModule dav_fs_module libexec/mod_dav_fs.so
LoadModule vhost_alias_module libexec/mod_vhost_alias.so
LoadModule negotiation_module libexec/mod_negotiation.so
LoadModule dir_module libexec/mod_dir.so
LoadModule imagemap_module libexec/mod_imagemap.so
LoadModule actions_module libexec/mod_actions.so
LoadModule speling_module libexec/mod_speling.so
LoadModule userdir_module libexec/mod_userdir.so
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
LoadModule alias_module libexec/mod_alias.so
LoadModule rewrite_module libexec/mod_rewrite.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:8080

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/var/www/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/usr/local/var/www/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "/usr/local/var/log/apache2/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "/usr/local/var/log/apache2/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "/usr/local/var/log/apache2/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/var/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock /usr/local/var/run/apache2/cgisock
</IfModule>

#
# "/usr/local/var/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/var/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig /usr/local/etc/apache2/2.2/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile /usr/local/etc/apache2/2.2/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the /usr/local/etc/apache2/2.2/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include /usr/local/etc/apache2/2.2/extra/httpd-mpm.conf

# Multi-language error messages
#Include /usr/local/etc/apache2/2.2/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include /usr/local/etc/apache2/2.2/extra/httpd-autoindex.conf

# Language settings
#Include /usr/local/etc/apache2/2.2/extra/httpd-languages.conf

# User home directories
#Include /usr/local/etc/apache2/2.2/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include /usr/local/etc/apache2/2.2/extra/httpd-info.conf

# Virtual hosts
#Include /usr/local/etc/apache2/2.2/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include /usr/local/etc/apache2/2.2/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include /usr/local/etc/apache2/2.2/extra/httpd-dav.conf

# Various default settings
#Include /usr/local/etc/apache2/2.2/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include /usr/local/etc/apache2/2.2/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

# Echo & Co. changes

# Load PHP-FPM via mod_fastcgi
<IfModule mod_fastcgi>

  FastCgiConfig -maxClassProcesses 1 -idle-timeout 1500

  # Prevent accessing FastCGI alias paths directly
  <LocationMatch "^/fastcgi">
    <IfModule mod_authz_core.c>
      Require env REDIRECT_STATUS
    </IfModule>
    <IfModule !mod_authz_core.c>
      Order Deny,Allow
      Deny from All
      Allow from env=REDIRECT_STATUS
    </IfModule>
  </LocationMatch>

  FastCgiExternalServer /php-fpm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 1500
  ScriptAlias /fastcgiphp /php-fpm
  Action php-fastcgi /fastcgiphp

  # Send PHP extensions to PHP-FPM
  AddHandler php-fastcgi .php

  # PHP options
  AddType text/html .php
  AddType application/x-httpd-php .php
  DirectoryIndex index.php index.html
</IfModule>

# Include our VirtualHosts
Include /Users/samir/Sites/httpd-vhosts.conf

The line 510 is:

  # PHP options Line - 506
  AddType text/html .php Line - 507
  AddType application/x-httpd-phpe .php Line - 508
  DirectoryIndex index.php index.html Line - 509
</IfModule> Line - 510

And it is one of the last lines in the httpd.conf

I tried commenting out, and I got this error:

Invalid command 'FastCgiConfig', perhaps misspelled or defined by a module not included in the server configuration

I don't know what I can possibly do anymore, I also tried "resetting" the files by swapping the with the files from the /original folder, but the same errors occur.

I'm using a MacBook Pro OS X Yosemite 10.10.5

I will be indebted to anyone who can help me, thank you in advance.

Community
  • 1
  • 1
Sam Chahine
  • 530
  • 1
  • 17
  • 52

2 Answers2

1

Change

    <IfModule dir_module>
        DirectoryIndex index.html
    </IfModule>  

To

    <IfModule dir_module>
        DirectoryIndex index.php index.html
    </IfModule>
Donkarnash
  • 12,433
  • 5
  • 26
  • 37
  • I just did, I still only see the source code of the php even after uncommenting the loadmodule and restarting apache, what else can I do? – Sam Chahine Feb 19 '16 at 07:58
  • I think there is a typo in "AddType application/x-httpd-phpe .php Line - 508" , it should be AddType application/x-httpd-php .php instead – Donkarnash Feb 19 '16 at 08:00
  • I changed it, restarted apache and still nothing, should I add my updated httpd.conf file in my answer above? I just edited – Sam Chahine Feb 19 '16 at 08:07
  • Please see my edit, I just realised there is no Load module php5 etc. in this file? Which is located at /usr/local/etc/apache2/2.2 ?? Why? How else will it know what to link? – Sam Chahine Feb 19 '16 at 08:54
  • On Linux, you could do sudo a2enmod php5 in terminal, I guess you could do the same on mac also, but I am not sure about the exact commands – Donkarnash Feb 19 '16 at 09:28
  • You can manually list the contents of /usr/local/etc/apache2/mods_available to check if the php5 module is there and also check the /usr/local/etc/apache2/mods_enabled contents if there is a symlink for the php5 module. Then you can enable the php5 module if not already enabled. – Donkarnash Feb 19 '16 at 09:33
  • I don't have a mods_available folder, all I have is usr/local/etc/apache2/2.2/ and then then httpd.conf, extra folder, original folder etc. What else can I do? In the /usr/local/etc/ directory I have php/5.6/ folder with php.in and all the other files, is this helpful at all? – Sam Chahine Feb 19 '16 at 09:37
  • Ok I found it in /usr/libexec/apache2 and I do not have the mod for php5 – Sam Chahine Feb 19 '16 at 09:39
  • First you may have to install the lib-apache2-mod-php5 probably issuing the following command in the terminal `sudo apt-get install libapache2-mod-php5`. Check the exact command on mac though. Once you have installed that then you can enable the module – Donkarnash Feb 19 '16 at 09:44
  • I just found in the libexec/apache2/ folder there is a file called `libphp5.so` Is that what I needed? – Sam Chahine Feb 19 '16 at 09:47
  • Yes then you can just add a line in your apache conf as "LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so" and restart apache – Donkarnash Feb 19 '16 at 09:50
  • I did that with php56 and i got this?? `httpd: Syntax error on line 115 of /usr/local/etc/apache2/2.2/httpd.conf: Cannot load /usr/local/opt/php56/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php56/libexec/apache2/libphp5.so, 10): Library not loaded: /usr/local/lib/libpng16.16.dylib\n Referenced from: /usr/local/opt/php56/libexec/apache2/libphp5.so\n Reason: image not found` But the file exists? – Sam Chahine Feb 19 '16 at 09:55
  • I added exactly this `LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so` to the /usr/local/etc/apache2/2.2/httpd.conf file – Sam Chahine Feb 19 '16 at 09:56
  • So its just a question of a symlink to the file hmm.... I don't know about mac but in linux you could just do do in terminal sudo a2enmod php5 – Donkarnash Feb 19 '16 at 10:01
  • Basically now just a symlink for mods_enable/php5 linking it to mods_available/php5 is required for everything to work for you. You could try sudo a2enmod php5 if it works – Donkarnash Feb 19 '16 at 10:05
  • I tried that but it won't work on mac, I even did this answer http://stackoverflow.com/questions/3775102/creating-a-symbolic-link-in-sites-directory (Marvo's) i will update my answer with the current httpd.conf – Sam Chahine Feb 19 '16 at 10:07
  • Are all of the LoadModules supposed to be uncommented? – Sam Chahine Feb 19 '16 at 10:09
  • No only the ones you want to load should be uncommented. Here I found another question which shows how to make apache2 with php 5 work on mac, probably it will help you http://stackoverflow.com/questions/22181045/apache-2-4-not-loading-php5-5-with-mac-os-10-8 – Donkarnash Feb 19 '16 at 10:13
  • Also I would suggest you to save a backup of your current httpd.conf and take a fresh copy of it from elsewhere and start again. Cause I see you have changed quite some things here for example you are using httpd2 as your document root folder - no problems with that but then probably some other issues which might have croped up due to trial and error. – Donkarnash Feb 19 '16 at 10:15
  • I just did everything that article suggested, still getting the same stupid error. I don't see how Apache can't tell I'm trying to link.. How do I create it manually?? – Sam Chahine Feb 19 '16 at 10:18
  • I can't tell you for sure how to do it on a mac but would tell you about how to do it on lonux, may be you can then relate it to mac scenario. – Donkarnash Feb 19 '16 at 10:20
  • Okay yes please, I will try anything – Sam Chahine Feb 19 '16 at 10:22
  • In linux all modules available for apache 2 are in the /etc/apache2/mods_available folder. For any module to be used a symlink has to be there in the /etc/apache2/mods_enabled folder which can be achieved by a2enmod php5 or by manually creating a symlink as sudo ln -s /etc/apache2/mods_enabled/php5 /etc/apache2/mods_available/php5 – Donkarnash Feb 19 '16 at 10:23
  • I only know of the directory usr/libexec/apache2 for the modules.. there are 2 different ones? – Sam Chahine Feb 19 '16 at 10:30
  • I was on board till you said ../apache2/mods_available because there are 2 folders where libphp5.so is, that is `usr/libexec/apache2` and `usr/local/opt/php56/libexec/apache2/libphp5.so` and since they are already in both of them, I shouldn't have to symlink anything right? – Sam Chahine Feb 19 '16 at 10:35
  • one of them should be a symlink i guess. Can you open both files and see their contents – Donkarnash Feb 19 '16 at 10:44
  • Okay so I THINK I understood what you wanted me to do, this is what I executed `sudo ln -s /usr/libexec/apache2/libphp5.so /usr/local/opt/httpd22/libexec/` and this is the error I got `httpd: Syntax error on line 115 of /usr/local/etc/apache2/2.2/httpd.conf: Cannot load /usr/local/opt/httpd22/libexec/libphp5.so into server: dlopen(/usr/local/opt/httpd22/libexec/libphp5.so, 10): Symbol not found: _ap_unixd_config\n Referenced from: /usr/local/opt/httpd22/libexec/libphp5.so\n Expected in: /usr/local/Cellar/httpd22/2.2.31/bin/httpd\n in /usr/local/opt/httpd22/libexec/libphp5.so` – Sam Chahine Feb 19 '16 at 10:44
  • Did you follow the point 4 exactly as described in http://stackoverflow.com/questions/22181045/apache-2-4-not-loading-php5-5-with-mac-os-10-8 ? It seems that homebrew creates a config_vars.mk file which is used for auto symlining. Also in the same article in point 3.2 there is mention to export the path. Have you followed that? I can't test at my end as I do not have a mac. – Donkarnash Feb 19 '16 at 10:58
  • I get "Warning: Tap homebrew/dupes already tapped." so I assume it's already been done, then i get "Tap homebrew/versions already tapped.", then "Tap josegonzalez/php already tapped." but THEN I get this annoying error `Error: Formulae found in multiple taps: * homebrew/php/php53 * josegonzalez/php/php53 Please use the fully-qualified name e.g. homebrew/php/php53 to refer the formula.` – Sam Chahine Feb 19 '16 at 11:02
  • I don't know what to do here? – Sam Chahine Feb 19 '16 at 11:02
  • What I meant was did you also create the symlink given in that article 4.2 as "cd /usr/share/ sudo ln -s /usr/local/Cellar/apache24/< apache version installed >/ httpd" probably replacing http with httpd2 in your case. – Donkarnash Feb 19 '16 at 11:06
  • I think it would be better if you can uninstall homebrew and start from scratch following that article. - Just a suggesstion – Donkarnash Feb 19 '16 at 11:07
  • I hope I won't have to.. It looks like it's successfully installing homebrew/php/php56.. and it has done it. It is successfully installed.. Now I will reinstall apache. This has taken me so long, should I quit programming? I really hope I can get this working before midnight – Sam Chahine Feb 19 '16 at 11:22
  • I'd just like to say.. either way, thank you so much for all of your help, you didn't have to but you helped so much and I do really appreciate it, thank you – Sam Chahine Feb 19 '16 at 11:22
  • You are welcome. stackoverflow is the place where we can try to solve each others problems and in the process learn a few new things. So no worries. Also sometimes it happens that when we get stuck in something it gets so extended that we feel ages have gone by for something which should have been simple. But its a part of learning right? So take a coffee break and resume. Happy Coding! Let me know if everything worked. – Donkarnash Feb 19 '16 at 11:26
  • I'm 99% sure I did everything right although I get this when trying to start apachectl `(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80 (48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down AH00015: Unable to open logs` – Sam Chahine Feb 19 '16 at 11:50
  • But when I go to localhost it says "it works!" so that's a good sign, but when I go to blog.dev it says "error connection refused" so I assume that's because of the error i just commented – Sam Chahine Feb 19 '16 at 11:51
  • What is your v-host conf? Try to bind the Listen directive in your httpd.conf to the ip + port for eg:192.150.10.20:8080 instead of just the port 8080. Because the error suggests that apache is trying to listen to any ip on port 80 – Donkarnash Feb 19 '16 at 11:53
  • Well following the link you gave me I pasted at the bottom of httpd.conf this http://paste.ofcode.org/3494Gvs2gA6wspkVXMAkwhg, is there another file I edit? – Sam Chahine Feb 19 '16 at 11:57
  • Just try Listen 127.0.0.1:80 in your httpd.conf – Donkarnash Feb 19 '16 at 11:59
  • I just add it anywhere? or at the bottom? – Sam Chahine Feb 19 '16 at 12:00
  • in your httpd.conf there is a Listen 8080 around line 42 or so change it to Listen 127.0.0.1:80 – Donkarnash Feb 19 '16 at 12:01
  • Okay it worked perfectly, no error, though i still can't connect to the blog.dev which is my user/samir/Sites/blog – Sam Chahine Feb 19 '16 at 12:03
  • can you post the code for your virtual host config for blog.dev? – Donkarnash Feb 19 '16 at 12:05
  • Do you mean /usr/local/etc/apache2/extra/httpd-vhosts.conf ? – Sam Chahine Feb 19 '16 at 12:07
  • http://paste.ofcode.org/TMRuLijEsVNt6HMc4JAFw4 This is it, I forgot what I had to do last time – Sam Chahine Feb 19 '16 at 12:07
  • Presently you do not have a virtual host setup for blog.dev You will need to set up one by either changing one of the two examples given or copy and paste a block and replace contents as DocumentRoot /path/to/the public/directory/of/blog/dev ServerName blog.dev ServerAlias www.blog.dev. – Donkarnash Feb 19 '16 at 12:13
  • Also you will need a entry 127.0.0.1 blog.dev and 127.0.0.1 www.blog.dev in your hosts file – Donkarnash Feb 19 '16 at 12:14
  • I tried http://paste.ofcode.org/MXhRRsneKkUAubR37v6dt Did i do it correctly? also how do I enter those entries in the hosts file? And which one, this one? or etc/hosts? – Sam Chahine Feb 19 '16 at 12:16
  • The DocumentRoot should be the path to your public folder containing the index.php file for example /usr/samil/Sites/blog.dev/public ServerName blog.dev and ServerAlias www.blog.dev – Donkarnash Feb 19 '16 at 12:21
  • yes the /etc/hosts file should have entries 127.0.0.1 blog.dev and 127.0.0.1 www.blog.dev – Donkarnash Feb 19 '16 at 12:22
  • http://paste.ofcode.org/dfEJ5i6BdfhTuKtbxgZRx3 Is this correct? I will do the hosts now – Sam Chahine Feb 19 '16 at 12:23
  • http://paste.ofcode.org/58gJZAy7uGcdJHDYVEVRT I also have another site whose vhosts I made a long time ago, is this correct? – Sam Chahine Feb 19 '16 at 12:25
  • Restart apache and try again – Donkarnash Feb 19 '16 at 12:27
  • I fixed the usr/samir to `DocumentRoot “/Users/samir/Sites/blog/public/”` – Sam Chahine Feb 19 '16 at 12:29
  • Nope it's not working, still getting err-connection-refused, what can I do? I'll try to make a fresh blog – Sam Chahine Feb 19 '16 at 12:35
  • Also when I go to http://localhost/blog It says `The requested URL /blog was not found on this server.` – Sam Chahine Feb 19 '16 at 12:37
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/103955/discussion-between-donkarnash-and-samir-chahine). – Donkarnash Feb 19 '16 at 12:43
0

Apparently, a directive like <IfModule mod_fastcgi>, <IfModule fastcgi> or equivalent is missing after comment # Load PHP-FPM via mod_fastcgi

ajlittoz
  • 414
  • 1
  • 5
  • 14
  • Okay thank you, that got rid of the error, I ran `apachectl start` and refreshed and I got the source code of the php, what am I doing wrong, I feel as though I am really close... – Sam Chahine Feb 19 '16 at 07:02