Help deciphering a website with a PHP home page!

I’ve been tasked to revise my company’s web site. They had it made by a 3rd party who no longer exists. I am familiar with editing HTML pages in Dreamweaver, but not PHP. So, the home pages of the site has a menu with lots of links “about us” “testimonials” “international” “multimedia” etc. Each of these pages I can edit in dreamweaver no problem, they are html files named “about_us.html”, “testimonials.html” etc.

The problem is the home page. the home page looks exactly the same as the other pages, same layout, header, menu, just a different body of text in the center. But, for some reason it seems to be a php. I think it’s “index.php”
when viewing the site on the home page, and looking at page source, its all html. But where is this html kept so I can edit it? There is no home.html file, or index.html. Why is the home page PHP, and does it need to be? thanks for any help.

I’m not a PHP expert, but I work with ASP which is similar in many respects, so here’s what I have to contribute:

You can definitely have a .php file that ‘doesn’t need to be’, that has only ordinary HTML. The PHP engine will take that, scan for PHP-specific commands, find none, and output the file. It’s possible that someone replaced a more PHP-active page with a simple HTML one and didn’t want to correct links pointing to it, for example.

PHP opening and closing tags can follow any of the following main formats:

<? code… ?>
<?php code… ?>
<% code… %>
<script language=“php”>code…</script>

Where the code… is a placeholder for actual PHP code

So I’d advise looking in index.php for those, and if you can’t find any, then it doesn’t need to be PHP. (You can find an index.php file. right?)

If there’s code tags, then you’ll need to figure out what those do, they may for example be pulling HTML from a mysql database or something like that.

PHP is a server-side scripting language. That means that it’s code that the server runs. When there is a page request to the server for a PHP page, the server runs the code. Part of what the code does is generates HTML on the fly. That HTML is what the server returns back to the browser.

It sounds like you are bringing up the page on your web browser then trying to “view source.” That just shows you the HTML generated by the server after running the PHP. You can’t see PHP code from your browser, you have to see the source on the web server.

As to why it’s PHP instead of static HTML, I can’t tell you that without seeing the PHP.

I have a done a fair amount of PHP programming and am a software development manager, but have not written commercial production PHP code. If you can get access to the actual PHP source I might be able to get you started.

PHP is a server-side script, not a client-side script. What this means is, a PHP program on the server is taking all the PHP from index.php as input, and spitting out (in this case) HTML to people who send an HTTP request for that file.

How that HTML is output is defined by the source of index.php, which you can edit the same way you’d edit any other file on the server. You asked why it’s a PHP file, and I don’t have enough information to answer that question. There might be some server-side processing that needs to be done on that particular page before it gets sent to the user. I can’t know without looking at the file.

The good news is, there might only be a little PHP in that file and the rest would be all vanilla HTML. If you edit the file on the server (or FTP the source file to your computer and edit it there), you might be able to see what’s going on well enough to do what edits you need to do. (Back that file up before you make any changes!) So your next step should be to look at that file and see if you can do that.

The PHP is probably doing something dynamic for your website. If can figure out what that is and it isn’t needed anymore, then, by all means, replace it with HTML.

I downloaded a PHP Editor- the index.php file starts off with code:
<?php //0035e
if(!extension_loaded(‘ionCube Loader’)){__oc=strtolower(substr(php_uname(),0,3));_ln=’/ioncube/ioncube_loader’.__oc.'_'.substr(phpversion(),0,3).((__oc==‘win’)?’.dll’:’.so’);__oid=__id=realpath(ini_get(‘extension_dir’));__here=dirname(__FILE__);if(strlen(__id)>1&&__id[1]==':'){__id=str_replace(’\’,’/’,substr(__id,2));__here=str_replace(’\’,’/’,substr(__here,2));}__rd=str_repeat(’/…’,substr_count(__id,'/')).__here.’/’;__i=strlen(__rd);while(__i--){if(__rd[__i]=='/'){__lp=substr(__rd,0,__i).__ln;if(file_exists(__oid.__lp)){__ln=__lp;break;}}}@dl(__ln);}else{die(‘The file ‘.FILE." is corrupted.
");}if(function_exists(’_il_exec’)){return _il_exec();}echo(‘Site error: the file <b>’.FILE.’</b> requires the ionCube PHP Loader ‘.basename($__ln).’ to be installed by the site administrator.’);exit(199);

But then its just about 1 page of garbly goo. I guess thats the meat of the file that even the PHP editor can’t decipher?

It looks like this:
FdyOdexWKV4h8zzLXjJhj6dv7Cj/Df2lo3aFOddzRxPDudsjzqgrND0nqcXT5e+GS7R1WbGMmgQC (This is about 1/5th of it)

So somewhere in that, it is giving instructions to autogenerate HTML. Including the paragraph of text on the home page talking about the company, that I need to edit. How do I get into there to see and change the text that this is somehow generating?

Im really tempted to just copy the auto generated page source paste it into dreamweaver and save it as index.html. I wonder if that would work

What you need to do is find the actual file that is sitting on the server and use an FTP program to copy it over to your hard drive. A php file is just a text file, and can be opened up in notepad. Once you have it opened up in notepad, you should see something more readable.

IonCube is an encoder. Whoever your contractor was didn’t want you messing about with the code. You are going to have to rewrite it. (Unless they left the password with you.)

For the most part, yes.