{"id":13192,"date":"2025-05-20T10:26:08","date_gmt":"2025-05-20T10:26:08","guid":{"rendered":"https:\/\/myprojects.advchaweb.com\/?p=13192"},"modified":"2025-05-20T14:52:46","modified_gmt":"2025-05-20T14:52:46","slug":"install-php-with-macports-on-mac-big-sur","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2025\/05\/20\/install-php-with-macports-on-mac-big-sur\/","title":{"rendered":"Install PHP with MacPorts on Mac Big Sur"},"content":{"rendered":"<p>Install MacPorts based on your mac version.<br \/>\npls see https:\/\/www.macports.org\/install.php<\/p>\n<p>if you have already MacPorts, pls update\/upgrade it:<\/p>\n<pre>sudo port -v selfupdate<\/pre>\n<p>Install PHP7.4<br \/>\nread: https:\/\/ports.macports.org\/port\/php74\/<\/p>\n<p>run: sudo port install php74<br \/>\ninstall some php7.4 extension: sudo port install php74-apache2handler php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite php74-xdebug<\/p>\n<p>Select php74 as the active PHP version:<br \/>\nsudo port select php php74<\/p>\n<p>check:<br \/>\nphp -v<br \/>\nPHP 7.4.33 (cli) (built: Oct 13 2024 09:21:46) ( NTS )<br \/>\nCopyright (c) The PHP Group<br \/>\nZend Engine v3.4.0, Copyright (c) Zend Technologies<br \/>\nwith Zend OPcache v7.4.33, Copyright (c), by Zend Technologies<br \/>\nwith Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans<\/p>\n<p>Install Apache2<br \/>\ncheck apache2: (the default apache2 from mac)<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>httpd -V           \r\n[Tue May 20 20:27:24.618540 2025] [so:warn] [pid 902] AH06665: No code signing authority for module at \/usr\/local\/opt\/php@7.4\/lib\/httpd\/modules\/libphp7.so specified in LoadModule directive. Proceeding with loading process, but this will be an error condition in a future version of macOS.\r\nhttpd: Syntax error on line 188 of \/private\/etc\/apache2\/httpd.conf: Cannot load \/usr\/local\/opt\/php@7.4\/lib\/httpd\/modules\/libphp7.so into server: dlopen(\/usr\/local\/opt\/php@7.4\/lib\/httpd\/modules\/libphp7.so, 10): image not found\r\nServer version: Apache\/2.4.56 (Unix)\r\nServer built:   Apr 12 2023 20:59:26\r\nServer's Module Magic Number: 20120211:126\r\nServer loaded:  APR 1.5.2, APR-UTIL 1.5.4, PCRE 8.44 2020-02-12\r\nCompiled using: APR 1.5.2, APR-UTIL 1.5.4, PCRE 8.44 2020-02-12\r\nArchitecture:   64-bit\r\nServer MPM:     prefork\r\n  threaded:     no\r\n    forked:     yes (variable process count)\r\nServer compiled with....\r\n -D APR_HAS_SENDFILE\r\n -D APR_HAS_MMAP\r\n -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)\r\n -D APR_USE_FLOCK_SERIALIZE\r\n -D APR_USE_PTHREAD_SERIALIZE\r\n -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT\r\n -D APR_HAS_OTHER_CHILD\r\n -D AP_HAVE_RELIABLE_PIPED_LOGS\r\n -D DYNAMIC_MODULE_LIMIT=256\r\n -D HTTPD_ROOT=\"\/usr\"\r\n -D SUEXEC_BIN=\"\/usr\/bin\/suexec\"\r\n -D DEFAULT_PIDLOG=\"\/private\/var\/run\/httpd.pid\"\r\n -D DEFAULT_SCOREBOARD=\"logs\/apache_runtime_status\"\r\n -D DEFAULT_ERRORLOG=\"logs\/error_log\"\r\n -D AP_TYPES_CONFIG_FILE=\"\/private\/etc\/apache2\/mime.types\"\r\n -D SERVER_CONFIG_FILE=\"\/private\/etc\/apache2\/httpd.conf\"<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>read: https:\/\/trac.macports.org\/wiki\/howto\/Apache2<\/p>\n<pre class=\"wiki\"> sudo port install apache2<\/pre>\n<p>verify the config file:<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>\/opt\/local\/sbin\/apachectl -t\r\nAH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Satrias-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message\r\nSyntax OK<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Activate apache2 :<br \/>\nsudo port load apache2<\/p>\n<p>to remove the warning:<br \/>\nAH00558: httpd: Could not reliably determine the server&#8217;s fully qualified domain name, using Satrias-MacBook-Pro.local. Set the &#8216;ServerName&#8217; directive globally to suppress this message<br \/>\nedit \/opt\/local\/etc\/apache2\/httpd.conf &#8211;&gt; should use admin to edit it<br \/>\nOpen geany as admin via command line: sudo &#8220;\/Applications\/Geany.app\/Contents\/MacOS\/geany&#8221;<br \/>\nthen add this line:<br \/>\nServerName localhost:80<br \/>\nthen unload and load again apache2:<br \/>\nsudo port unload apache2<br \/>\nsudo port load apache2<br \/>\nthen<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>\/opt\/local\/sbin\/apachectl -t\r\nSyntax OK<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>Test it on the browser: http:\/\/localhost\/ &#8211;&gt; it should work<\/p>\n<p>Link PHP7.4 with apache2<br \/>\nread: https:\/\/trac.macports.org\/wiki\/howto\/MAMP<br \/>\nGo to this dir:<br \/>\ncd \/opt\/local\/lib\/apache2\/modules<br \/>\nthen run:<br \/>\n[codesyntax lang=&#8221;bash&#8221;]<\/p>\n<pre>sudo \/opt\/local\/bin\/apxs -a -e -n php7 mod_php74.so\r\nPassword:\r\n[activating module `php7' in \/opt\/local\/etc\/apache2\/httpd.conf]<\/pre>\n<p>[\/codesyntax]<\/p>\n<p>then modify <em>\/opt\/local\/etc\/apache2\/httpd.conf<\/em>, so it&#8217;ll be:<br \/>\nDirectoryIndex index.php index.html<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install MacPorts based on your mac version. pls see https:\/\/www.macports.org\/install.php if you have already MacPorts, pls update\/upgrade it: sudo port -v selfupdate Install PHP7.4 read: https:\/\/ports.macports.org\/port\/php74\/ run: sudo port install php74 install some php7.4 extension: sudo port install php74-apache2handler php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2025\/05\/20\/install-php-with-macports-on-mac-big-sur\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install PHP with MacPorts on Mac Big Sur&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,48],"tags":[],"class_list":["post-13192","post","type-post","status-publish","format-standard","hentry","category-macosx","category-php-2"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/13192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=13192"}],"version-history":[{"count":8,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/13192\/revisions"}],"predecessor-version":[{"id":13194,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/13192\/revisions\/13194"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=13192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=13192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=13192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}