I am new to php programming and i have installed it on Ubuntu server, the server is a LAMP server. As i was doing my introductory lecture, i created first.php file but i understand it cannot be compiled and run like c or java. I would want to know what i must do to see that my program is working. The Ubuntu server that i am working on does not have GUI installed so i would want to know if i can still use it successfully.
as you mentioned you dont have a GUI you can try out CLI browsers. many browsers are there among them I always choose lynx and you can install it by using
make sure that you have placed your
then check with your .php file.
I mean I have tested it like this
there 127.0.0.1 indicates the local server.
then it will display output as
for example if you have written a .php script then you execute it as
Then I am placing it in the /var/www/ directory with some name. in my case it is po.php . then you cane execute it as
and output will be
hope that helps you too understand how to execute a php script.
In fairness to the other answers, PHP is most commonly hosted on a webserver and run through
That will run and output the PHP file to the terminal. If you've got a ton of HTML in the php file or it relies on various
PHP does not need compilation.
The default site is under /var/www
Put your test file there and get access with browser http://example.com/first.php
Also if you want to test directly in console you just write