Skip to navigation
Integrate PHP with Apache
15.01.15
If this is your first install, you need to enable php56-apache2handler in your web server. To enable the php56-apache2handler, run: Register PHP with Apache $ cd /opt/local/apache2/modules $ sudo /opt/local/apache2/bin/apxs -a -e -n "php5" mod_php56.so This should return the message: [activating module `php5' in /opt/local/apache2/conf/httpd.conf] Update Apache’s httpd.conf - /opt/local/apache2/conf/httpd.conf - file to enhance the "DirectoryIndex" directive to include additional "index" files. Search for: DirectoryIndex index.html and change it this way: DirectoryIndex index.php index.html Verify that at the end of the httpd.conf file the following lines exist so that Apache includes the mod_php "AddType" configurations # Include PHP configurations Include conf/extra/mod_php56.conf Verify that in the Dynamic Shared Object (DSO) Support section the following have been added. # Load the PHP module LoadModule php5_module modules/mod_php56.so Note: either of the above two edits are only required if the lines are not present in the httpd.conf file, as the apxs command (executed above) will add those for you. Step 3: MySQL setup for PHP Setup the MySQL default socket to use the MacPorts configuration (/opt/local/var/run/mysql56/mysqld.sock) $ sudo -i # cd /opt/local/etc/php56 # cp php.ini php.ini.bak # defSock=`/opt/local/bin/mysql_config --socket` # cat php.ini | sed \ -e "s#pdo_mysql\.default_socket.*#pdo_mysql\.default_socket=${defSock}#" \ -e "s#mysql\.default_socket.*#mysql\.default_socket=${defSock}#" \ -e "s#mysqli\.default_socket.*#mysqli\.default_socket=${defSock}#" > tmp.ini # grep default_socket tmp.ini # Check it! # mv tmp.ini php.ini # exit # OR rm php.ini.bak && exit The "grep" check should return: pdo_mysql.default_socket=/opt/local/var/run/mysql56/mysqld.sock mysql.default_socket=/opt/local/var/run/mysql56/mysqld.sock mysqli.default_socket=/opt/local/var/run/mysql56/mysqld.sock Restart Apache so that your changes take effect $ sudo port unload apache2 $ sudo port load apache2
https://trac.macports.org/wiki/howto/MAMP
Reply
Anonymous
Information Epoch 1736603014
Data dominates.
Home
Notebook
Contact us