LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Show the page (https://www.linuxquestions.org/questions/linux-software-2/show-the-page-4175552797/)

Huamin 09-07-2015 12:10 AM

Show the page
 
Hi,
I have one php file, that is having this line

<img src="/home/huamin/Downloads/emu_wild_animal_bird.jpg" alt="picture description here">

inside. How to refer to this PHP file, for displaying the page, within one browser?

j-ray 09-07-2015 02:40 AM

So if you have a php file named image.php in the document root of your local server you can call ist

http://127.0.0.1/image.php
or
http://localhost/image.php


and the contents of image.php may look like this

Quote:

<?php

echo '<img src="/home/huamin/Downloads/emu_wild_animal_bird.jpg" alt="picture description here">';

?>

Huamin 09-07-2015 08:09 AM

I copy the .php file to /root, but then I've got this

https://dl.dropboxusercontent.com/u/40211031/tt292.png

hortageno 09-07-2015 08:30 AM

Quote:

Originally Posted by Huamin (Post 5417002)
I copy the .php file to /root, but then I've got this

https://dl.dropboxusercontent.com/u/40211031/tt292.png

"/root" is NOT the document root of your web server. It's most likely "/var/www" or "/var/www/html". Have a look in your web server config. You have a web server running on localhost, do you?

Huamin 09-07-2015 10:11 AM

The same php file now exists on both

/var/www/html/

and

/var/www/

but I still get the same problem, when going to both of these

http://localhost/info3.php
http://127.0.0.1/info3.php

hortageno 09-07-2015 10:47 AM

You don't have a webserver running on your PC or it is not started. Then you would need PHP too. The .php file needs to be in the configured document root and must be owned by the user who runs the webserver (usually www-run on RH based distributions). Also, the picture you're referring to in your php file needs to be accessible by the www-run.

You really should have asked that question in the Newbie Forum. You don't have problems with the software itself. Please solve the problems above and post error messages when you have problems with any of the steps.

What do you want to achieve anyway? If it's only to see that picture, there are easier ways to do this...

j-ray 09-07-2015 11:04 AM

which distribution of linux is running on that machine? We still have not found the document root of the server...

Could be in /srv/www or /srv/www/html

John VV 09-07-2015 01:37 PM

please READ and STUDY the Apache docs
http://httpd.apache.org/docs/2.4/
this is a bit COMPLICATED software

Huamin 09-08-2015 01:28 AM

Many thanks all.
I've done this

[root@CentOS65x64 html]# cp info3.php /srv/www
[root@CentOS65x64 html]# cp info3.php /srv/www/html
cp: accessing `/srv/www/html': Not a directory
[root@CentOS65x64 html]#

but I still have the problem to go to these

http://localhost/info3.php
http://127.0.0.1/info3.php


All times are GMT -5. The time now is 09:47 AM.