Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Friday, June 28, 2013

Enable Xdebug in MAMP

Uncomment the zend_extension line and modify the /Applications/MAMP/bin/php/php5.x/conf/php.ini file to look like this:-
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
 
; On my machine, the default port 9000 has already been taken by something else.
xdebug.remote_port=9099
 
; Recommended when using Symfony
xdebug.max_nesting_level=250
Then restart the servers in MAMP.

Refs

Wednesday, June 26, 2013

Custom php.ini on shared hosting

  • Find the default php.ini path. Mine is /usr/local/lib/php.ini
<?php phpinfo() ?>
  • Copy the default php.ini to the user's home folder and customise it.
<?php copy("/usr/local/lib/php.ini", "/home/username/php.ini") ?>
  • Create a .htaccess file in the user's home folder with the following content.
SetEnv PHPRC /home/username/php.ini
# The following lines are important if the php.ini file is put in the document root.
<Files php.ini>
order allow,deny
deny from all
</Files>
Refs