| 240 | }}} |
| 241 | then make changes to that newly created php.ini file - ''/opt/local/etc/php56/php.ini'' |
| 242 | |
| 243 | = Step 3: Install phpMyAdmin = #phpmyadmin |
| 244 | |
| 245 | Use MacPorts to install the latest version of `phpMyAdmin`. |
| 246 | |
| 247 | {{{ |
| 248 | $ sudo port install phpmyadmin |
| 249 | }}} |
| 250 | |
| 251 | '''phpMyAdmin''' must be configured before it can be used. We do this in Step 5 below. |
| 252 | |
| 253 | = Step 4: Visit [[howto/MAMP]] for integration information = |
| 254 | [[howto/MAMP]] must be consulted next for modifications to the Apache Configuration file to enable PHP and MySQL. |
| 255 | |
| 256 | = Trouble shoot = |
| 257 | If by some reason the server still doesn't interpret PHP files (i.e. your web client tries to download them) it means the PHP configurations, as described at [[howto/MAMP#job1]], are not taking effect. |
| 258 | Typically, the file ''"Include conf/extra/mod_php56.conf"'' - is not being processed; the file is missing; or the contents incorrect. That file contains the two "AddType" lines below. |
| 259 | |
| 260 | == Verify your config file again! == |
| 261 | Verify any changes you have made to the config file: /opt/local/apache2/conf/httpd.conf - The most common problem is that the files in the "extra" directory are not "readable" |
| 262 | All files in that directory should be "-rw-r--r--" |
| 263 | |
| 264 | {{{ |
| 265 | $ /opt/local/apache2/bin/apachectl -t |
| 266 | }}} |
| 267 | This will return either "Syntax OK" or a specific line by line error listing. |
| 268 | The typical error message: ''"Could not open configuration file /opt/local/apache2/conf/extra/httpd-mod_php56.conf: Permission denied"'' |
| 269 | After correcting any config errors and saving the updated config file, simply run: |
| 270 | {{{ |
| 271 | $ sudo port unload apache2 |
| 272 | }}} |
| 273 | |
| 274 | to stop apache (even though it is not running) and then start it using |
| 275 | |
| 276 | {{{ |
| 277 | $ sudo port load apache2 |
| 278 | }}} |
| 279 | |
| 280 | to start it again. |
| 281 | |
| 282 | If the above fails to cause php files to be interpreted, you can edit the Apache httpd.conf file itself again and search for the block: |
| 283 | {{{ |
| 284 | <IfModule mime_module> |
| 285 | }}} |
| 286 | |
| 287 | And then add the following two lines before the end of that block. |
| 288 | |
| 289 | {{{ |
| 290 | AddType application/x-httpd-php .php |
| 291 | AddType application/x-httpd-php-source .phps |
| 292 | }}} |
| 293 | |
| 294 | Then restart the server. |
| 295 | |
| 296 | As a last check, reboot and verify that everything has autostarted and is running (i.e., repeat the above tests). |
| 297 | |
| 298 | = Step 5: Configure phpMyAdmin = |
| 299 | |
| 300 | Edit the phpMyAdmin configuration file at ''/opt/local/www/phpmyadmin/config.inc.php''. \\ |
| 301 | A sample configuration file is installed at /opt/local/www/phpmyadmin/config.sample.inc.php. |
| 302 | |
| 303 | Consult the documentation on your server at ''"/opt/local/www/phpmyadmin/doc/html/config.html"'' |
| 304 | |
| 305 | NOTE: This option expects ''"/opt/local/www/phpmyadmin/doc/html"'' to be accessible under "<Document Root>." This can be accomplished by |
| 306 | {{{ |
| 307 | $ cd <Document Root> |
| 308 | $ ln -s /opt/local/www/phpmyadmin/doc/html/ phpmyadmin-doc |
| 309 | }}} |
| 310 | and then accessing ''http://<servername>/phpmyadmin-doc/'' |
| 311 | |
| 312 | Finally, you need to set up the `phpMyAdmin` configuration to access MySQL. |
| 313 | |
| 314 | First create the config.inc.php file: |
| 315 | {{{ |
| 316 | $ cd /opt/local/www/phpmyadmin/ |
| 317 | $ sudo cp config.sample.inc.php config.inc.php |
| 318 | }}} |
| 319 | |
| 320 | This will create a file `config.inc.php` in the `phpMyAdmin` directory. \\ |
| 321 | Next, Edit that file, and locate the line: |
| 322 | {{{ |
| 323 | $cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)? - default is Cookie. |
| 324 | }}} |
| 325 | It will be right at the beginning in the section labeled: "/* Authentication type */" |
| 326 | |
| 327 | You will need to add the following two lines immediately after it. |
| 328 | {{{ |
| 329 | $cfg['Servers'][$i]['user'] = 'root'; // MySQL user |
| 330 | $cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed with auth_type = 'config') |
| 331 | }}} |
| 332 | |
| 333 | Where ' ' is an empty password; fill it with your MySQL root password. \\ |
| 334 | '''NOTE:''' You should change the 'auth_type' from 'config' to 'cookie' or 'httpd' so that you do not need to provide the password you selected for the MySQL root user in the 'password' option. |
| 335 | (I.e. leaving it in plain text in this config file.) \\ |
| 336 | However, as this is to simply get you "up-and-running," details for configuring those two authorization options are not given here. |
| 337 | Details on "Using Authentication Modes" can be found at "''https://docs.phpmyadmin.net/en/latest/setup.html#using-authentication-modes''." |
| 338 | |
| 339 | |
| 340 | There is also an interactive setup, see http://www.phpmyadmin.net/documentation/#setup_script and the demo at http://www.phpmyadmin.net/documentation/setup/ |
| 341 | |
| 342 | 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). |
| 343 | |
| 344 | |
| 345 | = Step 6: Install pmadb = #pmadb |
| 346 | Some consider the installation of pmadb "optional." \\ |
| 347 | However, phpMyAdmin will flag the fact that it is missing and therefore certain features are not functional with the message: |
| 348 | {{{ |
| 349 | The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why. |
| 350 | Or alternately go to 'Operations' tab of any database to set it up there. |
| 351 | }}} |
| 352 | |
| 353 | For additional features provided by pmadb (http://wiki.phpmyadmin.net/pma/pmadb), run |
| 354 | {{{ |
| 355 | $ mysql -u root -p < /opt/local/www/phpmyadmin/examples/create_tables.sql |
| 356 | }}} |
| 357 | |
| 358 | Next: create a file: ''mysql_phpMyAdmin_pmaSetup.sql'' - it is a one-time use scratch file so you can place it anywhere. (It is not included with the phpMyAdmin distribution.) |
| 359 | {{{ |
| 360 | -- HOW TO USE THIS FILE (with MacPorts installation) |
| 361 | -- mysql -u root -p < /opt/local/www/phpmyadmin/examples/create_tables.sql |
| 362 | -- mysq5 -u root -p < mysql_phpMyAdmin_pmaSetup.sql |
| 363 | |
| 364 | CREATE USER 'pma'@'localhost' IDENTIFIED BY 'pmapass'; |
| 365 | |
| 366 | GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'pmapass'; |
| 367 | GRANT SELECT ( |
| 368 | Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv, |
| 369 | Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, |
| 370 | File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, |
| 371 | Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, |
| 372 | Execute_priv, Repl_slave_priv, Repl_client_priv |
| 373 | ) ON mysql.user TO 'pma'@'localhost'; |
| 374 | GRANT SELECT ON mysql.db TO 'pma'@'localhost'; |
| 375 | GRANT SELECT ON mysql.host TO 'pma'@'localhost'; |
| 376 | GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) |
| 377 | ON mysql.tables_priv TO 'pma'@'localhost'; |
| 378 | |
| 379 | -- Privileges |
| 380 | GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO 'pma'@localhost; |
| 381 | }}} |
| 382 | |
| 383 | Then run this SQL to setup the pma 'controluser' (change the 'pmapass' to your password). |
| 384 | |
| 385 | Finally, verify that the config file, at ''/opt/local/www/phpmyadmin/config.inc.php'', is like this:\\ |
| 386 | '''Note:''' The database name is ''pma underscore underscore'' -- two underscores! |
| 387 | {{{ |
| 388 | /* User used to manipulate with storage */ |
| 389 | // $cfg['Servers'][$i]['controlhost'] = ''; |
| 390 | // $cfg['Servers'][$i]['controlport'] = ''; |
| 391 | $cfg['Servers'][$i]['controluser'] = 'pma'; |
| 392 | $cfg['Servers'][$i]['controlpass'] = 'pmapass'; |
| 393 | /* Storage database and tables */ |
| 394 | // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; |
| 395 | // $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; |
| 396 | // $cfg['Servers'][$i]['relation'] = 'pma__relation'; |
| 397 | // $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; |
| 398 | // $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; |
| 399 | // $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; |
| 400 | // $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; |
| 401 | // $cfg['Servers'][$i]['history'] = 'pma__history'; |
| 402 | // $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; |
| 403 | // $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; |
| 404 | // $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; |
| 405 | // $cfg['Servers'][$i]['recent'] = 'pma__recent'; |
| 406 | // $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; |
| 407 | // $cfg['Servers'][$i]['users'] = 'pma__users'; |
| 408 | // $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; |
| 409 | // $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; |
| 410 | // $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; |
| 411 | // $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; |
| 412 | }}} |