So I want to learn PHP, and I've installed it with "sudo apt-get install php5" on my Ubuntu 14.04 machine. I see it also installed Apache.
Now I've created my program, and I've saved it to a php file.
<?php echo '<p>Hello World</p>'; ?>
I know that I need to use something like http://localhost/myfile.php
, but where do I put the file, so Apache will see it?
If your server supports PHP, then you do not need to do anything. Just create your . php files, put them in your web directory and the server will automatically parse them for you. There is no need to compile anything nor do you need to install any extra tools.
Pick a name for it lets use hello.php
for this example.
On Ubuntu the folder is /var/www/html
, NOT /var/www
. You will need root access for that. So you save the file as /var/www/html/hello.php
.
Open up a web browser and enter the following address:
localhost/hello.php
And BAM. There's you page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With