LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-07-2015, 12:10 AM   #1
Huamin
Member
 
Registered: May 2011
Posts: 562

Rep: Reputation: 12
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?
 
Old 09-07-2015, 02:40 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
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">';

?>
 
Old 09-07-2015, 08:09 AM   #3
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
I copy the .php file to /root, but then I've got this

https://dl.dropboxusercontent.com/u/40211031/tt292.png
 
Old 09-07-2015, 08:30 AM   #4
hortageno
Member
 
Registered: Aug 2015
Distribution: Ubuntu 22.04 LTS
Posts: 240

Rep: Reputation: 67
Quote:
Originally Posted by Huamin View Post
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?
 
Old 09-07-2015, 10:11 AM   #5
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
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
 
Old 09-07-2015, 10:47 AM   #6
hortageno
Member
 
Registered: Aug 2015
Distribution: Ubuntu 22.04 LTS
Posts: 240

Rep: Reputation: 67
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...
 
Old 09-07-2015, 11:04 AM   #7
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
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
 
Old 09-07-2015, 01:37 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,623

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
please READ and STUDY the Apache docs
http://httpd.apache.org/docs/2.4/
this is a bit COMPLICATED software
 
Old 09-08-2015, 01:28 AM   #9
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache can't show my test page on CentOS 7. hack3rcon Linux - Server 3 08-30-2015 06:20 AM
[SOLVED] apache 2 test page show? fairladyz Linux - Server 7 01-20-2013 07:34 PM
show html page when connection is unavailable fandar Linux - Networking 3 01-08-2013 09:22 AM
[SOLVED] Want to show fetched data in page. PradeepRahul Programming 3 01-03-2012 02:28 AM
Man page does'nt show up. Kernel 2.6.9, Slackware 10.0 Adan Linux - Software 4 12-22-2004 01:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration