[MacPorts] howto/PHP added

MacPorts noreply at macports.org
Mon Dec 29 12:44:45 PST 2014


Page "howto/PHP" was added by larryv at macports.org
Comment: move contents of "howto/PhP"
Content:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
[[PageOutline]]

[wiki:howto <- Back to the HOWTO section]

This page describes the installation of the PhP 5.6 server under OSX (Yosemite 10.10.2) via MacPorts (version 2.3).   Date 28 December 2014 

For information on integration '''Apache''' with '''MySql''' and '''PhP''', see:''' [[howto/MAMP]]'''


= Step 1: Install PHP 56 = #php

{{{
sudo port install php56-apache2handler
sudo port install php56-mysql
}}}


  '''''Note:''''' the php56 port contains the core PHP features, but there are many optional features available in separate ports, some of which you may want to install as well . Use `port search php56` to see all the ports that are available.


= Step 2: PhP Configuration file setup =

Set up your PHP configuration files. For development purposes use:
{{{
cd /opt/local/etc/php56
sudo cp php.ini-development php.ini
}}}
or for a production server:
{{{
cd /opt/local/etc/php56
sudo cp php.ini-production php.ini
}}}
then make changes to that newly created php.ini file - ''/opt/local/etc/php56/php.ini''

= Step 3: Install phpMyAdmin  = #phpmyadmin

Use MacPorts to install the latest version of `phpMyAdmin`.

{{{
sudo port install phpmyadmin
}}}

'''phpMyAdmin''' must be configured before it can be used. We do this in Step 5 below.

= Step 4: Visit [[howto/MAMP]] for integration information =
 [[howto/MAMP]] must be consulted next for modifications to the Apache Configuration file to enable PhP and MySQL.

= Trouble shoot =
If by some reason the server still doesn't interpret PHP files (your web client tries to download them) it means the PHP configurations, as described above, are not taking effect and in that case you should open the Apache httpd.conf file once again and search for the block

{{{
<IfModule mime_module>
}}}

And then add before the end

{{{
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
}}}

Then restart the server.

As a last check, reboot and verify that everything has autostarted and is running (i.e., repeat the above tests).

= Step 5: Configure phpMyAdmin =

Edit the PhpMyAdmin configuration file at ''/opt/local/www/phpmyadmin/config.inc.php''. \\
A sample configuration file is installed at /opt/local/www/phpmyadmin/config.sample.inc.php.

Consult the documentation at file:///opt/local/www/phpmyadmin/doc/html/config.html \\
Note that this file will not be accessible to your browser until it is linked in to your Document root.

Finally, you need to set up the `phpMyAdmin` configuration to access mySQL. 

First create the config.inc.php file:
{{{
cd /opt/local/www/phpmyadmin/
sudo cp config.sample.inc.php config.inc.php
}}}

This will create a file `config.inc.php` in the `phpMyAdmin` directory. Edit that file, and locate the lines:

{{{
$cfg['Servers'][$i]['auth_type']      = 'config';    // Authentication method (config, http or cookie based)? - default is Cookie.
$cfg['Servers'][$i]['user']              = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
                                                    // with 'config' auth_type)
}}}

Where ' ' is an empty password; fill it with your MySQL root password. You can either change the 'auth_type' from 'config' to 'cookie' or 'httpd', or alternatively provide the password you selected for the root user in the 'password' option.

There is also an interactive setup, see http://www.phpmyadmin.net/documentation/#setup_script and the demo at http://www.phpmyadmin.net/documentation/setup/

To check your phpMyAdmin installation, point your browser to http://localhost/phpmyadmin and verify that phpMyAdmin loads and can access your database (by providing a username and password, depending on the authentication method you selected).


= Optional pmadb = #phpMyAdmin_pmadb

For additional features provided by pmadb (http://wiki.phpmyadmin.net/pma/pmadb), run 
{{{
mysql5 -u root -p < /opt/local/www/phpmyadmin/examples/create_tables.sql
}}}

Then run this SQL to setup the pma 'controluser' (change the 'pmapass' to your password).
{{{
-- HOW TO USE THIS FILE (with MacPorts installation)
-- mysql5 -u root -p < /opt/local/www/phpmyadmin/examples/create_tables.sql
-- mysql5 -u root -p < mysql_phpMyAdmin_pmaSetup.sql

CREATE USER 'pma'@'localhost' IDENTIFIED BY 'pmapass';

GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass';
GRANT SELECT (
    Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
    Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
    File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
    Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
    Execute_priv, Repl_slave_priv, Repl_client_priv
    ) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
    ON mysql.tables_priv TO 'pma'@'localhost';

-- Privileges
GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO 'pma'@localhost;
}}}

Finally, edit the config file, at {{{/opt/local/www/phpmyadmin/config.inc.php}}}, so it's like this:
{{{
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
}}}
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/howto/PHP>
MacPorts <https://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'howto/PHP' page.
If it was not you, please report to .


More information about the macports-changes mailing list