Где MAMP поддерживает свой php.ini?
Я недавно получил mac, я не привык к разработке на Mac вообще.
У меня MAMP Pro 1.9.6.1. Я сделал поиск на php.ini и получил следующее:
$ locate php.ini /Applications/MAMP/conf/php5.2/php.ini /Applications/MAMP/conf/php5.3/php.ini /Library/Application Support/appsolute/MAMP PRO/conf/php.ini /private/etc/php.ini.default
Я изменил имя всех из них. Перезапущенный MAMP. Он загружен без заминки (я знаю странное право?). Я использую PHP версии 5.2.
Все эти файлы теперь имеют разные имена (выполняются один за другим для процесса исключения). Поэтому я считаю, что перезагрузка Mac. То же самое, MAMP не загружал проблем, хотя все файлы php.ini перемещались. На лампе это не будет даже загружаться. Но есть еще один файл php.ini который мне не хватает (вполне возможно, я не знаю, как updatedb ), MAMP действительно умный и просто тянет во всех них (менее вероятно), или он его не использует.
Примечание: Если это не поможет, проверьте ниже ответ Рикардо Мартинса.
Создайте скрипт PHP с его из своего браузера и найдите значение Loaded Configuration File . Это говорит вам, какой PHP-файл php.ini используется в контексте веб-сервера.
Я не уверен, что в MAMP (non-PRO) одно и то же, но MAMP переопределяет модифицированный php.ini каждый раз, когда он запускается.
В моем случае мне нужно было использовать меню MAMP, чтобы изменить php.ini file ( File -> Edit Template -> PHP -> PHP 5.xx -> php.ini ).
Файл, который вы должны редактировать, находится в MAMP Pro и каждый раз использует файл php.ini .
- Начать MAMP PRO
- Редактировать File > Edit Templates > PHP 5.3.2 php.ini
- Перезапустить MAMP Pro
Ваши изменения должны придерживаться.
Чтобы быть яснее (поскольку я прочитал этот поток, но не посмотрел на это решение, также, если он был здесь!), У меня такая же проблема и я нашел причину: я модифицировал неправильный php.ini!
Да, в MAMP есть 2 файла php.ini:
- Применения / MAMP / CONF / php5.5.10 / php.ini
- Применения / MAMP / bin / PHP / php5.5.10 / CONF / php.ini
Правильный файл php.ini является вторым: Applications / MAMP / bin / php / php5.5.10 / conf / php.ini
Чтобы доказать это, создайте .php-файл (назовите его, как вам нравится, например «info.php») и введите в него простой phpinfo ()
Откройте его в своем браузере и найдите «Загруженный файл конфигурации»: mine «/Applications/MAMP/bin/php/php5.5.10/conf/php.ini»
Ошибка была здесь; я редактировал приложения / MAMP / conf / php5.5.10 / php.ini, но это неправильный файл для изменения! Infact, правый файл php.ini – тот, который находится в каталоге bin.
Позаботьтесь о такой маленькой разнице, которая вызвала у меня буквально полтора часа головных болей!
Просто запустите следующую команду с вашего терминала, она покажет вам ваш загруженный конфигурационный файл , который я когда-либо нашел.
Измените /Applications/MAMP/conf/php5.2/php.ini, если вы используете 5.2 версию php. Если вы используете версию 5.3 php, отредактируйте файл /Applications/MAMP/conf/php5.3/php.ini.
Если вы используете OSX Lion или OSX Mountain Lion, я рекомендую вам использовать установку apache и php по умолчанию.
У меня только не-pro-версия MAMP, но только потому, что она загружается, это не означает, что файл PHP находится / без ошибок.
Я переименовал файлы php.ini и MAMP, но Apache возвратил несколько ошибок.
Что вы пытаетесь изменить в файле php.ini ?
Это зависит от того, какую версию PHP использует ваш MAMP. Вы можете найти его на: /Applications/MAMP/conf/apache/httpd.conf ищет сконфигурированный hp5_module .
После этого, как кто-то сказал раньше, вы должны пойти в папку bin . Там вы найдете папку conf с php.in внутри.
Я проверил все ответы и, конечно, я использовал phpinfo (), чтобы проверить точное местоположение php.ini. Я не вижу параметр «Файл» в строке меню на моем mac. Я изменил файлы php.ini и php.ini.temp в этой папке. Нет.
Пока я не понял, что забыл раскомментировать измененную строку always_populate_raw_post_data.
Вероятно, самый быстрый способ доступа к PHP.ini для загружаемой в настоящее время версии PHP в MAMP PRO (v.4.2.1):
- Открыть MAMP Pro
- Нажмите «PHP» в разделе «Языки» на боковой панели
- Нажмите на стрелку рядом с раскрывающимся списком, который позволяет выбрать «Версия по умолчанию» для PHP.
MAMP Support Forums
Hi-
I’m a newb to MAMP and i have installed it successfully on a Mac M1 running Big Sur.
I am attempting to load table data exported from a client site into MySQL installed on my local machine. The problem is that the import into my local database fails with the following error:
>>
«No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.»
Of course, i followed the FAQ and discovered that there’s at least 3 parameters to tweak here, the ones that i have tweaked in my php.ini file are as follows:
post_max_size = 256M
memory_limit = 512M
upload_max_filesize = 128M
(as i understand it, these have to have different sizes, with memory_limit being the largest)
The php.ini file that i have modified is in my /Applications/MAMP/bin/php/php7.4.12/conf directory.
I have then used the MAMP console to stop and restart the servers.
I then go to http://localhost:8888/MAMP/?language=English in my browser and go to the phpinfo section. I find the following info there:
PHP version: 7.4.12
post_max_size = 256M
memory_limit = 512M
***upload_max_filesize = 2M ***
The part immediately above is what i don’t understand. I’ve only changed one php.ini file using the above values. I don’t see how TWO out of the THREE values that i changed are reflected in the environment. True to form, when i go back into phpAdmin and into MySQL as above and try the import again, the max file size is listed on the import screen as «(Max: 2,048KiB)».
I have NO idea why 2 of the three values that i’ve changed have their changes reflected in the environment, but the third is unchanged. I’m wondering if the source of it might be somewhere else that the upload_max_filesize variable? Can anybody help me thru the conundrum?
How to enable and setup php.ini on a Mac with OSX 10.8 + (MAMP Part 4)
Welcome to part 4 of the MAMP tutorial. In this post we will go over setting up php.ini on your Mac’s localhost.
What green means: any lines that you need to replace in this tutorial will be in green.
1. Enable the php.ini file:
1. Using Terminal, copy the existing php.ini.default and rename it to php.ini
sudo cp /etc/php.ini.default /etc/php.ini
2. Open php.ini in nano in your terminal for editing
2. Enable php short tags:
A php script with short tags will not run on your server unless php short tags are enabled.
1. Hold ctrl + w to do a string search. Type “short_open_tag” to find the line. (You may need to search a couple times)
3. Disable detect_unicode:
detect_unicode is a deprecated feature and will be disabled in the future. But for now we need to disable it so it doesn’t cause us problems.
1. Go to the very end of the php.ini file (still open in nano) and add the following line to the end of the file. It doesn’t exist yet.
4. Set the timezone:
1. Hold ctrl + w to do a string search. Type “date.timezone” to find it.
UTC tells the server to use your local timezone.
Save the file and exit. and congrats. You are done!
Share this:
Related
By Jonathan Whiting
I enjoy sharing what I am learning and hopefully it’s of interest and help to you. I live in Canada with my wife. Follow me on Twitter.
44 replies on “How to enable and setup php.ini on a Mac with OSX 10.8 + (MAMP Part 4)”
Thanks for the tutorial Jonathan 🙂
Thank Jonathan, all your work is amazing.
I want to upload large files using my phpMyAdmin… but it wont accept large files. Is there a way to edit the php.ini file that the phpMyAdmin is using to accept large files?
post_max_size=20M
upload_max_filesize=20M
max_execution_time = 300
I tried to change these in the /etc/php.ini but they were denied.
Hi Matt, Just to confirm did you restart apache after the update?
Yes thank you,
That was my issue. It needed a restart!
Awesome, I’ve done that before. Updated my settings, scratched my head and then remembered it needed to be restarted.
Thank you Jonathan. You saved my day. Much love from Jakarta! xoxo
Hi Tia, happy it worked out for you!
thank you from Japan for your running posts! very helpful.
Hi from Canada, I’m happy it helped you
Very nicely done. Very informative.
Wow. That was pretty straightforward. Very nicely done. Whew!
Thank you so much for making this available.
It would be nice if you could of explained better. Many users are new to commands and you don’t even tell us how to save this file. Now I’m left with a mess Thanks
Hi Steven, thanks for your feedback. I will try to make future tutorials easier to follow. Let me know if there was any specific commands that you would like explained?
Also I forgot to write that I followed these tuts on my 10.9 OSX worked great to easy!
Thank you Jonathan your tuts are faultless! you saved me time & a head ache as I’m a student in web development and very new to this world of programming. Cheers 🙂
I’ve followed your instructions and when I try to log into I get ” #1045 Cannot log in to the MySQL server”
the config.inc.php file is located here: “/Users/jim/Sites/phpMyAdmin”
the contents of the config.inc.php are:
ANY help or guidance you can provide is appreciated
You may need to change your host credentials from “localhost” to “127.0.0.1”
Let me know if that helped?
Thank you for this great series of articles. It has been very helpful. I think MAMP is a nice solution for beginners but after a while, they’ll look for this kind of native solutions.
Hi Kubilay, glad you found it useful and I couldn’t agree more. Mamp.info is a great solution to get started, but there are PHP packages that are required for some projects that don’t integrate nicely with it. Having a clean localhost setup is the way to go.
Ah this is THE tutorial that I didn’t have any trouble following it.
Many Thanks!
Glad you found it helpful
Great tutorial – much appreciated!
Very helpful, thanks a lot…I could finish my task.
Hello, I am going crazy with my mac because I am newbie with this system and I have discovered to differentes php.ini. One in my localhost with MAMP and other with my “internal” server. I am programming with Symfony and I need to write console command that they don’t work and my web application yes. How can i configure to set the same php.ini? Thanks in advance
I am sorry, but I don’t not understand your question? The php.ini setup will handle your mac’s server. There should only be one file running your mac’s Apache server.
Thanks for this tutorial. After hours searching internet and doing all weird I was able to setup the configuration. Can you please put up permissions tutorial on Sites folder. for eg joomla installation creates the configuration file through web and ask for deletion of the installation folder also. I wanted to know what would be ideal permission set in Sites folder.
Jonathan, I am running PHP version 5.3.15 and when I run phpinfo() on MAC OS X 10.8.4, it shows that my display_errors is OFF for both local and Master values. How do I change these values to ON? Any assistance would be greatly appreciated. I am new to the MAC world…I know how to change the php.ini file in windows but I am running MAC.
HI Edward, I wrote a quick tutorial to show you how to do this. It’s very easy. http://machiine.com/2013/how-to-turn-display_errors-to-on-in-php-ini-file/
Ok, I just did all this, many thanks…! However I don’t know why I did all these little things. Perhaps you could update the tutorials some time with comments (color orange or so) to each step on why we are doing things and learn from this…
Thanks, glad it helped. I try to make these tutorials easy to follow, those explanations make sense to add.
Jonathan, Followed your instruction and thanks for your assistance. One quick question, since I converted from Windows to Mac. In Windows, we are told to change the “SMTP = localhost” to our outgoing mail server and to change “sendmail_from = [email protected] ” to your email address. I noticed that in your instructions, you don’t mention this. Do I need to change those two lines to test mail applications on my local computer? Any assistance would be greatly appreciated. Thanks, Edward
It’s pretty straightforward to enable it. Just need to update a few config files. I will write a post with some instructions.
It’s not as straightforward as I first thought. As of 10.8 there are a bunch of changes that Apple made. I am documenting my progress and will post how I got it working, hopefully by tomorrow.
I am unable to loacte the default php.ini for php 5.3.15 that comes with mac to enable display errors and as I configured MAMP I could not configure php 5.4.10 or greater that comes with MAMP please help me
Hi Prabhu, the default php.ini file should be located at the following path. /etc/php.ini.default