Settings up xdebug on MAMP PRO - mamp

I am trying to set up xdebug on mamp pro with no success. I searched all over the internet, nothing helped me.
First I have tried just to uncomment the following line in php.ini:
zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
Next, I've tried the wizard:
http://xdebug.org/wizard.php
Next, I've tried adding these lines to php.ini:
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
Nothing helps. I can't see xdebug in my phpinfo.
MAMP PRO Version: 2.1.1
PHP Version: PHP 5.4.4
Thanks!

Since release of MAMP 2.01 XDebug is already included.
Solved. Here's the tutorial that helped me:
Start MAMP
Edit php.ini template file through MAMP to enable the extension. Edit the template file via File -> Edit Template -> PHP -> PHP php.ini
Edit bottom of php.ini template file so that it ends up looking like if you want profile output
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
If you don’t want profile output and just want xdebug running then use
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
Now when you have errors, if they are sent to standard out, you will see something like this
My php.ini file:
Save edited template and close edit window
Restart MAMP
Open MAMP’s WebStart page and navigate to PHPInfo tab. Check to make sure that Xdebug is running. Doing a search in the browser window for “Xdebug” makes this easy.
If you used the same settings that I have above, when you run PHP code, Xdebug will put the cachegrind.out files in your ‘/tmp’ directory. Open your ‘/temp’ directory and run one of your PHP files to make sure it is working correctly. You can open the ‘/tmp’ directory in finder by opening the terminal and running
open /tmp
Now you can use any app that understands those cachegrind.out files to view the profile data. Apps like KCacheGrind (Linux/Windows, KDE), WinCacheGrind (Windows), xdebugtoolkit, and Webgrind.  I went the simple route and used webgrind. Webgrind is a simple web based application that you can run locally on MAMP and it will look for the cachegrind.out files automatically with just one click. Continue for steps on setting up with webgrind.
Download Webgrind
Setup Webgrind host on MAMP to run Webgrind
Visit webgrind url setup on your local MAMP installation. Mine was simply webgrind/
If you already have cachegrind output files you should be able to select the file in the “Auto (newest)” dropdown or leave it select at Auto and click update which will reveal the profile data
Throw a celebratory fist pump

I had trouble with setting up MAMP Pro and nginx myself and the above answer did not work for me.
The problem was that the default port setting is 9000, which in my case I have that port already in use so I looked in my nginx conf at this line:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
then go to the file located when fastcgi_pass is set to, and in there you will find the correct port number. In my case it was in Applications/MAMP/Library/logs/fastcgi and the filename is dependent on your host's php version.
Then open that file, and set whatever PID is in there to xdebug.remote_port in php.ini, for me it was 13267.
It may be worthwhile to mention my MAMP config for PHP is set to CGI mode, not modules.
EDIT:
I just realized that the port number dynamically changes way too much. So I set a hardcoded value for fastcgi pass in my nginx template for MAMP like so:
fastcgi_pass 127.0.0.1:9072;
# comment out the regular setting just in case.
# fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;

Related

Installing Moodle: It is requesting 5000 under Max_input_vars

I cannot find the php.ini file or .htaccess file where I'm meant to change the max_input_vars to 5000 in my moodle website folder. I'm using mamp and myphpadmin
Moodle explains "To change max_input_vars you can either set it in php.ini or modify it in runtime, for example for Apache you can create .htaccess file: php_value max_input_vars 5000"
I searched in finder.
Create a test php file in the root of the Moodle folder with
<?php
phpinfo();
Then open it from the browser, not the command line (the command line and web server might use different versions of php)
eg: yourmoodlesite/test.php
This will display the location of the php.ini file that is being used, eg:
Loaded Configuration File /etc/php/7.4/apache2/php.ini
I haven't used MAMP, but the documentation says the php file can also be edited via the menu in MAMP PRO
File > Open Template > PHP > [PHP version] -> php.ini
It also says the location is
/Library/Application Support/appsolute/MAMP PRO/conf
https://documentation.mamp.info/en/MAMP-PRO-Mac/Menu/

Typo3 v9.5 BE login not working after fresh installation

I have installed fresh TYPO3 v9.5 in my local server. After complete installation i open the backed and then try to login with my username and password but every time i getting error. see below screenshot.
I try to search many solution for this but not getting success. I know about Argon2i password Hashing problems for new fresh Typo3 v9 installation. So, i select another password Hashing method via INSTALL TOOL. But still i am getting same error. Sometime i clear whole cache via install tool and open the back end, but when i enter my username and password will getting same error.
Someone help please.
This problem is associate with Apache. In Windows case you have to include in httpd.conf next lines:
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>
Last thing you have to take into account with installation in Windows beacuse you should configure ssl in this system, is more easy in a Unix distribution based.
You could follow the tutorial in https://www.pagemachine.de/blog/tutorial-update-typo3-9lts-testsystem-windows-installieren/?cn-reloaded=1 , the only thing is this written in german.
I uncomment below line in httpd.conf file.
Include conf/extra/httpd-mpm.conf
And added below code in httpd-mpm.conf file and it's work fine for me.
<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>

Setting up XDEBUG in my dev environment

At my company, our PHP file isn't configured to use XDEBUG. This is making me feel like a blind man when trying to fix bugs and I absolutely need the debugger to understand the flow of code. We develop remotely, with our servers set elsewhere. I want to configure the php.ini file to have xdebug but more importantly I want to do this specifically for my development environment. Essentially the php.ini file i intend to alter resides in
/etc folder. (needs root access, I have root access)
Our dev folder is more like:
developer1 developer2 developer3 developer4 developer5 myDevelopmentEnvironment
So technically, i want to edit this php.ini file but have the settings changed only for myDevelopmentEnvironment, essentially override the main php.ini file in my folder.
Other particulars of interest :
Development machine : Windows
Server : linux (I putty in)
Editor: Eclipse (may move to NetBeans)
You can enable XDEBUG from an .htaccess file,
Eg.
php_value zend_extension=/usr/lib/php/modules/xdebug.so
php_flag xdebug.remote_enable on
php_value xdebug.remote_port 9000
php_value xdebug.idekey PHPSTORM-XDEBUG
php_flag xdebug.remote_connect_back on

Changed upload_max_filesize in php.ini but phpinfo doesn't show the change

Basically phpinfo says upload_max_filesize is 2M, but I changed it in the php.ini file to 8M. I am using MAMP, so I restarted MAMP and phpinfo still says 2M. I checked the path to the php.ini file that phpinfo shows and it matched up exactly. See the YouTube video of me documenting all of this.
You should change the file in /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
After you should reset MAMP. I also changed all php.ini before, and phpinfo() doesn't had been change, but I don't sure if it is need to works, so if only changing the file in the path above, try change the others also.
I hope that help you.
On MAC os make sure you are at the right path:
/Applications/MAMP/bin/php/phpx.x.x/conf/php.ini
I see a lot of people had trouble with this since there is also another conf directory
To be sure, write a file with this PHP content:
<?php
phpInfo();
?>
and save it in your main MAMP document root (as any other web page) with name info.php
Open that file as a web URL in your browser as any other MAMP web page, as an example: http://127.0.0.1:8888/info.php
Search for the string: php.ini in that page.
You will find a line like this:
Configuration File (php.ini) Path /Applications/MAMP/bin/php/php7.2.8/conf
That line will show you the correct path for the ini file PHP is using in that moment. It depends on the PHP version you are using.
Delete (or rename with an unguessable name) the info.php file, after (avoid giving all this info to the world).
In httpd.conf file the PhpIniDir had the wrong path. It was off by one directory. That was the fix!
You can update PHP configurations using below:
File(menu) -> Open template -> PHP -> {select PHP version that you want update}
Source: http://blog-en.mamp.info/2009/09/increase-php-memory-limit-with-mamp-pro.html
MAMP PRO php config file is loaded from other path.
I found it after replace all php infos from mamp/bin/php/ directory without results.
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/php(VERSION).ini
I have the same problem with MAMP (non pro), MAM is stopped
the current php version I am using is php7.2.20, I have changed everywhere in
/Applications/MAMP/bin/php/php7.2.20 and /Applications/MAMP/conf/php7.2.20
post_max_size = 128M
upload_max_filesize = 128M
I restart MAMP and I get php7.2.20
post_max_size = 8M
upload_max_filesize = 32M

Change MAMP PRO Path to Configuration File

I am running MAMP PRO 2.1.1 on a MAC using OS 10.7.4 (Lion). How do I change the path to the configuration (php.ini) file so that it is the same as the path to the installed Configuration file?
The path to the php.ini used will be based on the version of PHP you have selected in MAMP. For example, with PHP 5.3.4 that would normally be:
/Applications/MAMP/conf/php5.4.3/php.ini
Assuming you haven't changed the defaults, you should be also be able to visit the MAMP info page:
http://localhost:8888/MAMP/
Select the "phpInfo" tab and look for the "Loaded Configuration File" setting.