Koozali.org: home of the SME Server

Enabling Apache & PHP

Offline GU42gold

  • *
  • 7
  • +0/-0
Enabling Apache & PHP
« on: March 30, 2010, 03:54:16 AM »
Hi,

Newbie to all things Linux (Last exposure was about 10yrs ago with IPCop, and I've run Apache/PHP under Windows) My new job includes looking after an SME server (with another for backup). My main problem at the moment is:

The Boss received some updates for the company website which are in PHP, but all of the files on the server are HTML. The programmer who made the changes is adamant that he copied the originals from our server and are PHP and SME supports Apache/PHP out of the box (so to speak). I am unable to locate ANY PHP files on our server, nor can I identify the PHPmyAdmin or Apache administrator panels.

Is Apache/PHP enabled at installation of SME 7.x or does the webpage programmer have the wrong information. Is the a quick reference guide online that I can view.

I've installed SME on a spare PC at home so I can break it rather than a live production server at work

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Enabling Apache & PHP
« Reply #1 on: March 30, 2010, 12:45:36 PM »
The Boss received some updates for the company website which are in PHP, but all of the files on the server are HTML. The programmer who made the changes is adamant that he copied the originals from our server and are PHP and SME supports Apache/PHP out of the box (so to speak). I am unable to locate ANY PHP files on our server, nor can I identify the PHPmyAdmin or Apache administrator panels.

PHPMyAdmin is not installed by default, it is available as a contrib see: http://wiki.contribs.org/PHPMyAdmin more over PHPMyAdmin is for mysql frontend.

Quote
Is Apache/PHP enabled at installation of SME 7.x or does the webpage programmer have the wrong information. Is the a quick reference guide online that I can view.

Yes Apache, PHP 4.x  are installed by default and running.

Also check out this part of the Admin manual: http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter14
« Last Edit: March 30, 2010, 12:51:38 PM by byte »
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline Frank VB

  • ****
  • 127
  • +0/-0
Re: Enabling Apache & PHP
« Reply #2 on: March 30, 2010, 01:00:36 PM »
Your HTML website files will be in an ibay, most likely the "primary" ibay. And that's where the PHP files should be located. You should thoroughly read through the manual especially the chapter regarding ibays: http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter14

Make sure that your ibay is configured with the "execution of dynamic content" setting set to "enabled" otherwise PHP scripts will not be executed. Also ask the programmer which PHP version he uses: PHP4 of PHP5. In the latter case you may need to install a contrib for PHP5.

Offline GU42gold

  • *
  • 7
  • +0/-0
Re: Enabling Apache & PHP
« Reply #3 on: March 30, 2010, 01:24:00 PM »
Thanks Byte & Frank,

From what you pair have said there'll be two serious things happening in the coming days.

1. A Serious chat with the website developer as our server contains no PHP files what so ever
2. A serious learning curve for me so I can get up to speed with SME

Thanks for your help

Offline Frank VB

  • ****
  • 127
  • +0/-0
Re: Enabling Apache & PHP
« Reply #4 on: March 30, 2010, 01:46:26 PM »
You can check whether the primary ibay is enabled for PHP scripts by writing a short PHP test script:

Code: [Select]
<html>
<head>
<title>PHP Test</title>
</head>
<body>

<?php phpinfo(); ?>

</body>
</html>


Save this file as "debug.php" and upload it with software such as WinSCP to the primary ibay's "html" folder. Launch your browser and execute the script by entering the URL: http://www.yourdomain.com/debug.php (or whatever your domain name is). As a result, a page should be displayed which contains everything you need to know about your PHP installation (... but were afraid to ask).


Offline GU42gold

  • *
  • 7
  • +0/-0
Re: Enabling Apache & PHP
« Reply #5 on: March 30, 2010, 01:52:10 PM »
Thanks Frank

I'll give it a go tomorrow when I get to the office

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Enabling Apache & PHP
« Reply #6 on: March 30, 2010, 04:53:19 PM »
As a result, a page should be displayed which contains everything you need to know about your PHP installation (... but were afraid to ask).
Wouldn't this been a lot easier a file with the .php extension in your Primary html folder with the following content:

Code: [Select]
<?php phpinfo(); ?>
Which could than be accessed like http://server-name/filename.php?
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Frank VB

  • ****
  • 127
  • +0/-0
Re: Enabling Apache & PHP
« Reply #7 on: March 30, 2010, 05:07:05 PM »
Wouldn't this been a lot easier a file with the .php extension in your Primary html folder with the following content:

Code: [Select]
<?php phpinfo(); ?>
Which could than be accessed like http://server-name/filename.php?
Are you saying that the HTML tags are not absolutely necessary for the script to work? Yes, you're right, the HTML tags may be omitted. I used this code because it was the first phpinfo code snippet I googled and I quickly copied and pasted it in my answer. Let's say it was a free "how to embed the phpinfo function in a PHP file with HTML code" lesson for OP.


Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Enabling Apache & PHP
« Reply #8 on: March 30, 2010, 05:24:34 PM »
Let's say it was a free "how to embed the phpinfo function in a PHP file with HTML code" lesson for OP.
:-)
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline GU42gold

  • *
  • 7
  • +0/-0
Re: Enabling Apache & PHP
« Reply #9 on: March 31, 2010, 12:06:15 AM »
 :( well I tried both scripts, and neither worked. received "HTTP 404 Not Found". So it appears that PHP support in our server has been turned off.

mmmmmmmm,,,,  This begs the question, where did the "original" php files that we are supposed to have on the server come from if we don't have PHP enabled (But thats not for you good folks to answer)

time for some study

Thanks

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Enabling Apache & PHP
« Reply #10 on: March 31, 2010, 07:38:13 AM »
:( well I tried both scripts, and neither worked. received "HTTP 404 Not Found". So it appears that PHP support in our server has been turned off.
No that could not give a 404 error, as the error already states the file you are requesting does not exist, you can not conclude from this that PHP is not enabled.

mmmmmmmm,,,,  This begs the question, where did the "original" php files that we are supposed to have on the server come from if we don't have PHP enabled (But thats not for you good folks to answer)
Look through the /etc/httpd/conf/httpd.conf file all shared locations are in there.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Frank VB

  • ****
  • 127
  • +0/-0
Re: Enabling Apache & PHP
« Reply #11 on: March 31, 2010, 09:20:37 AM »
Is it possible that your website is not hosted locally on your SME server but hosted externally? Try to execute the debug script with: http://a.b.c.d/debug.php (where a.b.c.d. is the internal IP address of your server, eg. http://192.168.1.1/debug.php).

Offline GU42gold

  • *
  • 7
  • +0/-0
Re: Enabling Apache & PHP
« Reply #12 on: April 01, 2010, 01:44:28 AM »
OK, the plot thickens.

(I did warn you I was a Linux Newbee)

Same error, file not found when I use the local IP address of the server. I used wsftp to copy the 2 debug files (I created one for each of the versions above) to ibays/Primary/html.

My next step is to jump into the abyss of command prompt territory and navigate to folder given by cactus and check contents. It appears that the contents of what I'm seeing under the ibays is not what is being used for the website. If this is the case, something is amiss as I was given to believe the ibay folder were used for all Website pages etc.

let the fun begin, a linux Luddite let loose with the command prompt  :grin:

Edit:::::
ok, found something interesting. If I open IE and enter our website with /index.php instead of blank, then our site is displayed. Also tried using our static ip address, same thing, site displayed. Just doesn't make sense.
« Last Edit: April 01, 2010, 05:14:25 AM by GU42gold »

Offline Frank VB

  • ****
  • 127
  • +0/-0
Re: Enabling Apache & PHP
« Reply #13 on: April 01, 2010, 10:10:10 AM »
If I open IE and enter our website with /index.php instead of blank, then our site is displayed. Also tried using our static ip address, same thing, site displayed. Just doesn't make sense.
Well, at least that means that PHP seems to be working on your site/server.

Is there a file "index.htm" and/or "index.html" in the /ibays/Primary/html file? If so, rename those files to something like "oldindex.htm" and "oldindex.html". Then try to display your website without the /index.php appended (so use  http://www.yourdomain.org instead of http://www.yourdomain.org/index.php). Can you see the site now? You might have to refresh your browser (Internet Explorer: press F5/Firefox: press CTRL+R).



« Last Edit: April 01, 2010, 10:33:32 AM by Frank VB »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Enabling Apache & PHP
« Reply #14 on: April 01, 2010, 06:09:59 PM »
Also try and have a look at the contents of the index.php script, perhaps that script is redirecting to the location where the source of your site is really found.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)