Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 11362  / 2 Years ago, thu, september 15, 2022, 10:49:23

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.


More From » php

 Answers
1

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



sudo apt-get install lynx-cur


make sure that you have placed your first.php file in the proper location.



then check with your .php file.



I mean I have tested it like this



jai@frank-Jai:~$ lynx 127.0.01
Looking up '127.0.01' first


there 127.0.0.1 indicates the local server.



then it will display output as enter image description here



for example if you have written a .php script then you execute it as



php script:



root@frank-Jai:~# cat /var/www/ho.php 
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html>
root@frank-Jai:~#


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



lynx 127.0.0.1/ho.php


and output will be



enter image description here



hope that helps you too understand how to execute a php script.


[#30016] Saturday, September 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
needstar

Total Points: 268
Total Questions: 108
Total Answers: 117

Location: Seychelles
Member since Mon, Jun 28, 2021
3 Years ago
;