Solved

VI PHP Files only HTML

Posted on 2012-03-09
6
276 Views
Last Modified: 2012-08-14
I'm trying to create some new files in VI on a linux platform.  No matter how I create the file (touch file.php or vi ) the file will be an html file with no php???
vi-screenshot.jpg
0
Comment
Question by:kevbob650
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 37704842
When you request the file, the server passes the contents of the file to the PHP parser.  The PHP parser returns a response.  If everything works out OK, the server set a content type of text/html.  In your browser, you will see whatever was put out by the script.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 37705074
I will assume you are using Apache as your webserver.

There are two ways to get Apache to execute PHP to create dynamic web page.  One way, original way, is to have the PHP files in a directory that is defined as a CGI directory.  In this setup you have a PHP script that dynamically generates the whole webpage, that is all HTML code.

The second way, used more often today, is to have the PHP module installed and then you can then have PHP code in-line of a html file and the files can reside anywhere.  In this setup the PHP code just generates small parts of the html code.

Which method are you using?
0
 

Author Comment

by:kevbob650
ID: 37706057
Well I have 30+ php files working just fine but when I go to create a new file, I get nothing. I should be able to do a simple echo to test the page but nothing is returned. when I view the file I see an html header but not my echo. All my php code resides in an /opt/web/html/ directory. Again, all of my existing files work fine but creating a new file doesn't work. this is all happending on a new server after a painful server move. Can you tell I'm not a linux guy!
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 57

Accepted Solution

by:
giltjr earned 500 total points
ID: 37706063
Do you have shell access?  Can you do a ls -l of the files in that directory?

Check to see if the file permissions are the same.

Could be that the default permissions are different between the old and new box.
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 37706445
Also, make sure you have configured the PHP error log, and configured PHP to show startup errors.  It sounds like PHP may be having an issue accessing the file.  Perhaps you have a global open_basedir directive set?
0
 

Author Closing Comment

by:kevbob650
ID: 37713043
yeah, it was those pesky permissions - thanks
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question