Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: GU42gold on March 30, 2010, 03:54:16 AM

Title: Enabling Apache & PHP
Post by: GU42gold 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
Title: Re: Enabling Apache & PHP
Post by: byte 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
Title: Re: Enabling Apache & PHP
Post by: Frank VB 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.
Title: Re: Enabling Apache & PHP
Post by: GU42gold 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
Title: Re: Enabling Apache & PHP
Post by: Frank VB 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).

Title: Re: Enabling Apache & PHP
Post by: GU42gold on March 30, 2010, 01:52:10 PM
Thanks Frank

I'll give it a go tomorrow when I get to the office
Title: Re: Enabling Apache & PHP
Post by: cactus 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?
Title: Re: Enabling Apache & PHP
Post by: Frank VB 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.

Title: Re: Enabling Apache & PHP
Post by: cactus 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.
:-)
Title: Re: Enabling Apache & PHP
Post by: GU42gold 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
Title: Re: Enabling Apache & PHP
Post by: cactus 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.
Title: Re: Enabling Apache & PHP
Post by: Frank VB 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).
Title: Re: Enabling Apache & PHP
Post by: GU42gold 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.
Title: Re: Enabling Apache & PHP
Post by: Frank VB 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).



Title: Re: Enabling Apache & PHP
Post by: cactus 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.
Title: Re: Enabling Apache & PHP
Post by: mmccarn on April 03, 2010, 02:40:12 PM
...I used wsftp...
SME ibays contain three folders by default:
/home/e-smith/files/ibays/<ibayname>/files
/home/e-smith/files/ibays/<ibayname>/cgi-bin
/home/e-smith/files/ibays/<ibayname>/html

FTP and Samba access the .../files folder - which is (by design) not available from the web.

Apache uses the files in .../html (and sometimes .../cgi-bin).

If you have only examined your system using "wsftp", you would not be able to see the html or php files in the .../html folder.

You need to download, install, and figure out how to use WinSCP (http://winscp.net/eng/download.php), which uses ssh to connect to your SME server, but then gives you a file manager interface to allow you to easily copy files from windows to the .../html folder (or any other folder) on your SME.

Title: Re: Enabling Apache & PHP
Post by: GU42gold on April 09, 2010, 03:47:04 PM
I'd like to thank everyone who had input to my problem. I have literally stumbled across the cause of my initial dilemma.

From reading various pieces of documentation, I made what I thought was the logical assumption that our website would be stored in the "Primary" i-bay. As aervisor once said to me "Assume" made up by an A##, U & me. It turns out the the PHP files I'd been looking for were actually in another i-bay called "newweb".

Now I can set my sights on setting up OpenSISCE on my home server (which requires PHP5), time for lots of reading

Thanks again to everyone
Barry