jide / clamp

Command Line Apache MySQL PHP
http://jide.github.io/clamp
GNU General Public License v2.0
79 stars 9 forks source link

Running "clamp apache start" results in config error: No MPM loaded. #46

Open andreborud opened 4 years ago

andreborud commented 4 years ago

I just made a fresh install of MacOS Catalina. Installed clamp as usual with Homebrew. Then tried to run clamp apache start in the folder I always use. I have to type my password, the I get the following error and it gets stuck: AH00534: httpd: Configuration error: No MPM loaded.

rqelibari commented 4 years ago

This means that Apache needs the MPM module to be loaded. I will not be able to provide a new configuration file for Catalina for the next few weeks.

mahdi-ninja commented 4 years ago

I fixed it on my machine using the answer from https://github.com/jide/clamp/issues/30

in the config file, before loadmodule section, use this line:

 "\" -C \"loadmodule mpm_prefork_module": "/usr/libexec/apache2/mod_mpm_prefork.so"

(not sure about the path of mod_mpm_prefork.so on your system but in my case, it was in /usr/libexec/apache2/)

Here's a sample config that I used:

{
    "address": "localhost",
    "memory": "256M",
    "database": "db",
    "apache": {
        "commands": {
            "httpd": "sudo httpd"
        },
        "options": {
            "<Directory": " '{{$cwd}}'>",
            "AllowOverride": "All",
            "</Directory>": "",
            "servername": "{{$.address}}",
            "listen": "80",
            "documentroot": "'{{$cwd}}'",
            "serverroot": "'{{$cwd}}'",
            "pidfile": "'{{$cwd}}/.clamp/tmp/httpd.pid'",
            "defaultruntimedir": "'{{$cwd}}/.clamp/tmp",
            "loglevel": "info",
            "errorlog": "'{{$cwd}}/.clamp/logs/apache.error.log'",
            "customlog": "'{{$cwd}}/.clamp/logs/apache.access.log' common",
            "addtype": "application/x-httpd-php .php",
            "directoryindex": "index.html index.php",
            "setenv": "LOCAL_SERVER true",
            "user": "`whoami`",
            "autoopen": false,
            "group": "_www",
            "\" -C \"loadmodule mpm_prefork_module": "/usr/libexec/apache2/mod_mpm_prefork.so",
            "loadmodule": {
                "authz_host_module": "/usr/libexec/apache2/mod_authz_host.so",
                "authz_core_module": "/usr/libexec/apache2/mod_authz_core.so",
                "dir_module": "/usr/libexec/apache2/mod_dir.so",
                "env_module": "/usr/libexec/apache2/mod_env.so",
                "mime_module": "/usr/libexec/apache2/mod_mime.so",
                "log_config_module": "/usr/libexec/apache2/mod_log_config.so",
                "rewrite_module": "/usr/libexec/apache2/mod_rewrite.so",
                "php7_module": "/usr/libexec/apache2/libphp7.so",
                "unixd_module": "/usr/libexec/apache2/mod_unixd.so"                
            },
            "php_admin_value": "{{$.php.options}}"
        }
    },
    "host": {
        "options": {
            "127.0.0.1": "{{$.address}}"
        }
    },
    "mysql": {
        "commands": {
            "mysql": "$(brew --prefix mariadb)/bin/mysql",
            "mysqld": "$(brew --prefix mariadb)/bin/mysqld",
            "mysqladmin": "$(brew --prefix mariadb)/bin/mysqladmin",
            "mysqldump": "$(brew --prefix mariadb)/bin/mysqldump",
            "mysql_install_db": "$(brew --prefix mariadb)/bin/mysql_install_db"
        },
        "databases": [
            "{{$.database}}"
        ],
        "options": {
            "bind-address": "127.0.0.1",
            "port": "3306",
            "lower_case_table_names": 2,
            "basedir": "$(brew --prefix mariadb)",
            "datadir": "'{{$cwd}}/.clamp/data'",
            "socket": "'{{$cwd}}/.clamp/tmp/mysql.sock'",
            "pid-file": "'{{$cwd}}/.clamp/tmp/mysql.pid'",
            "log_error": "'{{$cwd}}/.clamp/logs/mysql.error.log'",
            "max_binlog_size": "10M",
            "max_allowed_packet": "32M"
        }
    },
    "php": {
        "options": {
            "memory_limit": "{{$.memory}}",
            "pdo_mysql.default_socket": "{{$.mysql.options.socket}}",
            "mysql.default_socket": "{{$.mysql.options.socket}}",
            "mysqli.default_socket": "{{$.mysql.options.socket}}"
        }
    }
}
fulldecent commented 3 years ago

@mahdi-ninja That fixed it for me, thank you.

Created PR: https://github.com/jide/clamp/issues/46#issuecomment-557852146

fulldecent commented 3 years ago

@mahdi-ninja do you think that's gtm for now?

alanfluff commented 3 years ago

Sadly, that fix didn't work for me.

I have Big Sur on an M1, Home-brew installed (Apple silicon version) happily, as did clamp, but when I run clamp, I get:

httpd: Configuration error: No MPM loaded.

My config file is the one created by clamp config write, to which I then added the above MPM line.

I checked and that path is valid, I do have this file here:

/usr/libexec/apache2/mod_mpm_prefork.so

I just returned to Mac after a long hiatus in the Windows and I missed clamp. I'd love to start using it again. Happy to try any suggestions and report back.

Cheers