How to use mamp for php
I already installed MAMP in my macbook pro. I want to run a php. what can i do? asked Feb 17, 2010 at 18:44
2 If you have done everything right, open your browser and type this:
to see if it opens successfully and then you can open your sites. Also check out the mamp's documentation on how to configure it and run php scripts. answered Feb 17, 2010 at 18:47
SarfrazSarfraz 371k74 gold badges529 silver badges574 bronze badges Drop the PHP file into the HTDOCs folder in MAMP, for example let's call it hello_world.php and now you can run it by going to: http://localhost/hello_world.php answered Feb 17, 2010 at 19:33
TravisOTravisO 9,2804 gold badges34 silver badges44 bronze badges Depending on the port settings of MAMP (Preferences -> Ports) you have to call answered May 19, 2010 at 14:07
Dirk EineckeDirk Einecke 2,3451 gold badge15 silver badges10 bronze badges In MacOSX there is a default Apache + PHP server, but if you develop using MAMP, you need to use MAMP version’s of php instead the OSX one. 1° step : Verify which PHP is used by your Terminal $ which php /usr/bin/php With this commands you verify which PHP is your Terminal using.
you can see, the MAMP’s folders don’t are showed. We have to add them to $PATH. 2° step : Add MAMP to $PATH variable Now we have to modify the “$path” variable by modifying the file ” ~/.bash_profile ” located in root user folder. sudo vi ~/.bash_profile Since you call vi in
sudo mode you’ll have to type your system password. Now write in the file the new “$path” variable that terminal has to use ( if you don’t know MAMP’s php version , open MAMP navigate to “Preferences -> PHP” and see the selected versions ). PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.1.12/bin:$PATH Save the file, press “esc” to quit edit mode, then type :wp ( or press “shift” and letter “z” for two times ). 3° step: Load “.bash_file” and check It’s tiem to load new “.bash_profile” fiel: $ source ~/.bash_profile and check if all went good by typing one more time $ which php This time the response must be : ” /Applications/MAMP/bin/php/php7.1.12/bin/php ” First StepsAfter successful installation you can start your local servers. Start MAMP and click the “Start” button in the toolbar. If necessary, you will be asked for your administrator password. The button shows the server status by its color:
The web server (Apache or Nginx) starts by default on port 8888, the database server (MySQL) on port 8889. When calling your web page in a web browser, you must enter the web server port at the end of the URL, e.g.: http://localhost:8888 Toolbar
Main area
Can I run PHP in MAMP?You can easily install the Apache web server (A), MySQL (M) and PHP (P) on your laptop or home PC. The three come bundled together, referred to as either the WAMP, MAMP or LAMP according to whether you are installing them on Windows (W), a Mac (M), or Linux (L).
How do I run a PHP file in Htdoc?Now, to run a PHP script:. Go to “C:\xampp\htdocs” and inside it, create a folder. ... . Inside the demo folder, create a new text file and name it “index. ... . Now, to see the script output, open the XAMPP control panel and start Apache to host the local webserver, where our script will be running.. Where is PHP in MAMP?If you're using MAMP Pro then, it easier to find the php. ini file. All you need to do is have MAMP Pro open, then click File > Edit Template > PHP and choose the version of PHP you are running (either php 5.2. 17 or php 5.3.
|