Install php

Install php

sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
So I decided to setup a simple web server so I can test out some php scripts. I did:
bash code
apt-get install php-pear

bash code
apt-get install php5-dev

But, the php files still download instead of display.
 
 
 
2010 Sep 23 at 16:37 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
 
 
 
2010 Sep 23 at 16:53 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
You should really stop drinking.
 
 
 
2010 Sep 23 at 17:43 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
That's creepy, how did you know? I mean, I had *one* glass of wine, sue me.

Anyway, apt-get install downloads and installs the packages. You can then use the files, not sure how it goes with PHP but you might be able to include files in projects or invoke an interpreter somewhere.
 
 
 
2010 Sep 24 at 03:37 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Can you/somebody tell me how to make it so that php files are shown instead of downloaded?

httpd.conf code
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


Weird thing though, bash said that httpd wasn't a recognized service...
 
 
 
2010 Sep 24 at 13:51 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
sprinkles said:
shown

Not sure what you mean by that. However, there should be samples available in a directory, which can probably be ascertained by reading a man page or package details.
 
 
 
2010 Sep 24 at 14:32 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
 
 
 
2010 Sep 24 at 22:06 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
For the record, you should only need to...

code
apt-get install apache2 php5 libapache2-mod-php5


...to get PHP and Apache and have them play nice together.

And you shouldn't have to do anything at all if you chose "LAMP server" (or something similar) when you installed the OS.
 
 
 
2010 Sep 24 at 23:53 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
New problem...
mysql doesn't like php...
Its telling me I have to enable mysql functions in php or I have to enable php functions in mysql...
code
vBulletin 4.0.7 requires that the MySQL functions in PHP be available. Please ask your host to enable this.

 
 
 
2010 Sep 25 at 01:17 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
Try installing php5-mysql
 
 
 
2010 Sep 25 at 01:36 PDT — Ed. 2010 Sep 25 at 01:36 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Does that install mysql and php?
 
 
 
2010 Sep 25 at 02:21 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
It installs the mysql functions for php.

But as a result it will probably install mysql and php too if you don't already have them. Because otherwise it would be useless.
 
 
 
2010 Sep 25 at 02:29 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
php code

<?php
function escape_string($string)
{
if (
$this->functions['escape_string'] == $this->functions['real_escape_string'])
{
return
$this->functions['escape_string']($string, $this->connection_master);
}
else
{
return
$this->functions['escape_string']($string);
}
}
?>


What does this code do?
I was getting errors so I changed:
php code

<?php
return $this->functions['escape_string']($string);
?>


to
php code

<?php
return $this->functions['real_escape_string']($string);
?>

 
 
 
2010 Sep 25 at 02:32 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
It depends on the definitions of
$this->functions['escape_string']
and
$this->functions['real_escape_string']

Normally you would use the builtin functions mysql_escape_string and mysql_real_escape_string to make strings SQL safe and prevent SQL injection attacks on your server.
 
 
 
2010 Sep 25 at 02:42 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Bumped for RB.
 
 
 
2010 Oct 12 at 19:13 PDT
Page [1]