User Tools

Site Tools


Apache - PHP - MySQL


Edit the apache2 hosts configuration files (per user)

# cd /private/etc/apache2/users/
# ls
Guest.conf	username.conf
# cat username.conf
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/username/Sites
<Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

<VirtualHost *:80>
ServerName myDomain
DocumentRoot /Users/username/Sites/.../myDir
<Directory "/Users/sbolay/Sites/.../myDir/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
If you have a Forbidden 403 error : since the version 2.4+ of Apache, “Order allow,deny” and “Allow from all” are deprecated. Now use “Require all granted” instead.


Add the hostname to resolve
$sudo -e /private/etc/hosts       localhost       myHost broadcasthost
  ::1             localhost
  fe80::1%lo0     localhost


Uncomment both lines below

$sudo -e /usr/local/etc/httpd/httpd.conf
  LoadModule userdir_module libexec/apache2/

# User home directories Include /private/etc/apache2/extra/httpd-userdir.conf

Active modules and includes
LoadModule vhost_alias_module libexec/apache2/
LoadModule rewrite_module libexec/apache2/

# Virtual hosts Include /private/etc/apache2/extra/httpd-vhosts.conf

error_log problem


[Fri Jul 22 11:41:43.182364 2016] [core:alert] [pid 737] [client] /Users/mferreira/Sites/GIT/easyaccess-web/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

Only for version 5 of php, uncomment this line

LoadModule php5_module libexec/apache2/


Uncomment in /private/etc/apache2/extra/httpd-userdir.conf Add in /usr/local/etc/httpd/httpd.conf

Include /private/etc/apache2/users/*.conf


PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/, 9): image not found in Unknown on line 0

Install php for mac from

curl -s | bash -s 5.6
curl -s | bash -s 7.2


Install MySQL from (e.g. mysql-5.6.12-osx10.7-x86_64) and start it

$sudo installer -pkg /Users/"user"/Downloads/mysql-5.7.14-osx10.11-x86_64.pkg -target /Volumes/Macintosh\ SSD
$sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
$/usr/local/mysql/bin/mysqladmin -u root -p password NEWPASSWORD
export PATH="/usr/local/mysql/bin:$PATH"
Il se peut que /Library/StartupItems/MySQLCOM/MySQLCOM n'existe pas sur le système. Il faut aller sous préférences système → MySQL → Start et cocher AUtomatically STart on Startup
Warning: mysqli_connect(): (HY000/2002): No such file or directory in /Users/bfavre/Sites/git/easyaccess-web/lib/lib_dbconnection.php on line 27 Could not connect to server (2002) No such file or directory
If after the installation you don't know the root password you must launch mysql in safe mode (sudo mysqld_safe –skip-grant-tables) and know you can access mysql (mysql -u root) then you have to refresh the privileges (FLUSH PRIVILEGES;) and to finish you change the password (ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';)
mkdir /private/var/mysql/
ln -s /tmp/mysql.sock /private/var/mysql/
If you have the error “ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. You can use these commands:”
mysql -u root -p
alter user 'root'@'localhost' identified by 'totem' password expire never;


If you have installed a php7+ version, you don't need to install gettext (it is installed by the script).

Start by intalling the autotools, thanks to this. You can then try those instructions at first

[Wed Jun 26 19:21:19 2013] [error] [client ::1] PHP Fatal error: Call to undefined function bindtextdomain() in /Users/sbolay/Sites/GIT/easyaccess-web/lib/lib_language.php on line 66

Download gettext from

curl > gettext-
tar -xzf gettext-
cd gettext-
configure: error: in `/Users/mferreira/gettext-':
configure: error: C compiler cannot create executables
See `config.log' for more details.
configure: error: ./configure failed for gettext-runtime

Si il y a cette error,

export PATH=“/usr/bin:$PATH”

Relancer de nouveau


make all

/bin/sh ../libtool –tag=CC –mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\“\” -DEXEEXT=\“\” -DEXEEXT=\“\” -I. -I.. -I../intl -I../intl -I.. -I.. -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -I../intl -I/usr/include/libxml2 -I./libcroco -g -O2 -c -o stpncpy.lo stpncpy.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\“\” -DEXEEXT=\“\” -DEXEEXT=\“\” -I. -I.. -I../intl -I../intl -I.. -I.. -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -I../intl -I
/usr/include/libxml2 -I./libcroco -g -O2 -c stpncpy.c -fno-common -DPIC -o .libs/stpncpy.o
stpncpy.c:34: error: expected declaration specifiers or '…' before numeric constant
stpncpy.c:34: error: expected ')' before '!=' token
stpncpy.c:34: error: expected ')' before '?' token
make[4]: * [stpncpy.lo] Error 1
* [all] Error 2
make[2]: * [all-recursive] Error 1
* [all] Error 2
make: *** [all-recursive] Error 1

Edit gettext-tools/gnulib-lib/stpncpy.c line 34 (stpncpy) (char *dest, const char *src, size_t n) and modify it to (stpcpy) (char *dest, const char *src, size_t n)


sudo make install

Add in php.ini the support for gettext

$sudo -e /private/etc/php.ini
  error_reporting = E_ALL


Restart Apache

$sudo apachectl restart
operating_systems/apple/apache_-_php_-_mysql.txt · Last modified: 2021/11/18 14:24 by ateixeira