r/PHPhelp • u/zzach_is_not_old • Nov 07 '25
php installing
I tried installing php, I put the commands listed on the download page, i'm using Mac OS, I I'm not using any tutorials, at first nothing happened, then it just blasted a bunch of php in the terminal. I don't know the point of it. I think it is a guide, has this happened to anyone else, what do I do next
2
Upvotes
1
u/Johto2001 Nov 07 '25
"On the front page" of what? You need to provide more information for people to help you.
What OS are you on? From where did you download PHP? What tutorial are you following?
1
u/MateusAzevedo Nov 07 '25
Read rule #1!
Which OS you're using? Front page from where? Which site? Which command?
1
u/lapubell Nov 07 '25
PHP isn't js. If you're putting code on the "front page", you might be trying to run the code in the browser, which isn't how server side technologies work.
Give us more context and we'll help you out.
1
u/equilni Nov 09 '25
Mac user.
Which selections did you do? This isn't clarified in the comments.
If Homebrew, you will get a ton of text in the terminal before you can do
brew installthe PHP version you want. It may pause, telling you what it will do and you may need to enter to allow it to continue (haven't done this in a while, but is noted on Homebrew's front page).If you don't have an error before the terminal prompt, you can now
brew installthe PHP version you want or justbrew install phpfor the latest - per the Homebrew docs.Once you get back to a terminal prompt, type
php -v(php version), and you should get something like:1
u/shadow-battle-crab Nov 11 '25
go to mac terminal. Type: php -v
if it doesn't do anything then php isn't properly installed. go install homebrew (google it) and once homebrew is installed type:
brew install php
Then try php -v again.
If it works, go to the directory you want to write php codes in in the terminal. Make a file called index.php. In it put:
<?php echo("Hello world!"); Then run: php index.php This should say "Hello World!". This demonstrates how you can run php scripts from command line. Now run: php -S localhost:8000 Then go to the web browser and visit: [http://localhost:8000/index.php](http://localhost:8000/index.php) You should see "Hello World!" here too. This shows how you can run php scripts designed for the web. This should give you a good starting spot.
1
u/Commercial_Echo923 Nov 11 '25 edited Nov 11 '25
What you have done is actually installed php but it may not have been what youve expected. If youve also setup php to be in your path you can now just run the php command in the terminal and it will execute a php script but what you may actually look for is a webserver that can run php and serves webpages (html or other content) to a domain visited by the browser. You can try MAMP (Mac Apache MySQL PHP), XAMPP (was originally made for windows but they seem to support macos now too) or use something like docker to run the server locally inside a container.
From my personal experience I can just recommend XAMPP. Its easy to setup if you have no clue and will get you started with everything you need to learn.