Problem with PHP5 and Apache

I have installed on my laptop WampServer. I looked at the httpd.conf configuration and I've seen such AllowOverride All while on my freeBSD server put AllowOverride None. I looked at the php configuration is exactly like I did in my freeBSD httpd.conf (AddTypy aplication, and loadmodule php DirectoryIndex index.php)
I still do not understand why php does not work.
 
It doesn't appear you have configured httpd.conf

I would suggest that you take a look at http://www.freebsdmadeeasy.com/tutorials/web-server/install-php-5-for-web-hosting.php


I found this to be of an extreme help to me when I first did my server

It has step by step directions on the installation

1. The code you mentioned

Code:
AddType text / html.shtml
DefaultType text / plain

has nothing to do with enabling php5

2. Maybe you webserver works on your intranet but it does not resolve on the internet
 
jasonhirsh said:
I would suggest that you take a look at http://www.freebsdmadeeasy.com/tutorials/web-server/install-php-5-for-web-hosting.php


I found this to be of an extreme help to me when I first did my server

It has step by step directions on the installation

1. The code you mentioned

Code:
AddType text / html.shtml
DefaultType text / plain

has nothing to do with enabling php5

2. Maybe you webserver works on your intranet but it does not resolve on the internet


As always thank you very much.
I'll tell you that this manual you tell me is the first I've followed and nothing, it will not php5.
At this moment I am reinstalling everything again and will come back to follow the manual that you tell me.

Another thing, I searched through the official website of php and I and found this:

When I upgrade to apache 2.2, this:

Code:
AddType application/x-httpd-php .php5 
AddType application/x-httpd-php .php42 
AddType application/x-httpd-php .php4 
AddType application/x-httpd-php .php3 
AddType application/x-httpd-php .php 
AddType application/x-httpd-php .phtm 
AddType application/x-httpd-php .phtml 
AddType application/x-httpd-php .asp

...does not worked for me, so I did this:

Code:
<FilesMatch "\.(php*|phtm|phtml|asp|aspx)$"> 
SetHandler application/x-httpd-php 
</FilesMatch>

Another interesting point with Apache 2.2 is following.
Let suppose we installed PHP as module. But for some directory, we need to use PHP as CGI (probably because of custom configuration). This can be done using:

Code:
<FilesMatch "\.(php*|phtm|phtml|asp|aspx)$"> 
SetHandler none 
</FilesMatch> 

AddType application/x-httpd-php-custom .php 
Action  application/x-httpd-php-custom  /cgi-bin/php-huge

Note type must be different than "application/x-httpd-php" and also you need to deactivate the handler on sertain extention. You can do mixed configuration:

Code:
<FilesMatch "\.(php)$"> 
SetHandler none 
</FilesMatch> 

AddType application/x-httpd-php-custom .php 
Action  application/x-httpd-php-custom  /cgi-bin/php-huge

in such case files like *.php5 and so on will be parsed via module, but *.php will go to php-huge executable.
 
jasonhirsh dear friend:
I will not tell you all my life, but I'll tell you that my main profession is Captain of the Spanish Merchant Navy, I've been captain for 28 years, so I have almost always been away from home, for those circumstances I have not seen it grow to my two daughters, my wife says she does not want angry navigate more so for this I have trained in this world of computing during 4 years. Currently not navigate, I am dedicated to repair and assemble computers and corporate networks as well as web design and multimedia both dynamic and static pages.
I have two friends working in the astrophysical observatory in La Palma, one works in the Royal Greenwich Observatory and the other in the Nordic Telescope, the last doctor who has me in 3 months get a place in office but wants to learn to ride with freeBSD server to give me the job is stable and well paid.
For all these reasons it is vital to my learning to ride a minimum server with

freeBSD + apache + php + mysql + phpmyadmin + pure-ftpd + phpsysinfo

I have mounted freeBSD 8.0 and apache, mysql I am amounting now, when I finished I'll say say you here in this forum. I invite you to come into my server and tell me what I'm doing wrong.
My private email is armando12347@yahoo.com, send me email and I send you user and pass and su pass.

You don't know what as you would appreciate for this help because as I said before is vital for me.

A big hug from the Canary Islands.
 
Hi,

Im guessing you are using something like translate.google.com and its causing a bit of confusion. This is an English language forum, but I speak spanish so if you don't understand my post(s) then let me know.
Also if you are not only new to FreeBSD, but also new to the "vi" editor then you need to learn the basics of "vi" first. For example this guide might help:

http://www.eng.hawaii.edu/Tutor/vi.html


Now, assuming you know how to use "vi" and search for and change text, you need to look in your httpd.conf and change the section that looks like this:

Code:
DocumentRoot "/usr/local/www/apache22/data"

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
     AllowOverride None
     Order deny,allow
     Deny from all
</Directory>

to

Code:
DocumentRoot "/usr/local/www/apache22/data"

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>

thanks Andy.
 
Andy, many thanks for your attention, this is the first.
I looked at the manual installation of apache and php on freeBSD made easy, according to your advice. I have done your recomendation in httpd.conf

Code:
DocumentRoot "/ usr/local/www/apache22/data"

# First, we configure the "default" to be a very Restrictive September of
# Features.
#
<Directory />
     AllowOverride All
     Order allow, deny
     Allow from all
</ Directory>

but I think that something was missing because no work

http://manyblue.homeunix.com(for html)

http://manyblue.homeunix.com/test.php (not open)

I mounted apache according to the FreeBSD made easy manual,but I did not made this

Code:
# mv /usr/local/www/apache22/usr/local/www/
# sarep "/usr/local/www/apache22" "/usr/local/www" httpd.conf

It has something to do with what happens?

There are more lines in httpd.conf with AllowOverride None ???

Andy, Thankyou ...................................
 
PD:
In case you do not know, I remember you that my httpd.conf is all defaults except the changes made according with the manual of php in freeBSD made easy.
 
As the post is becoming too long, Andy, I'll follow your advice at the foot your references. Manuals: apache, php, mysql from FreeBSD made easy.
If you think I'm wrong, tell me and if I have any questions I ask you OK. So stay this post for idiots like me.
Only tell you something, I know a litle about freeBSD because from tame ago I was a server with FreeBSD 6.0, a friend help me and I was operated perfectly, but without php my friend could not. I use the editor ee for convenience but I can use vi without problems.

I install freeBSD 8.0 with the ports tree, during the instalation, I choose the option with ssh,DHCP and I created my user to the group wheel.

The following is to put at my server one static ip

Code:
# vi /etc/rc.conf

I search the line

Code:
# ifconfig_em0="DHCP"

and I made

Code:
# ifconf_emo="inet 192.168.1.xxx netmask 250.250.250.0"
# defaultrouter="192.168.1.1"

quit the editor vi and save changes

The following is to set ssh for the remote access and I made

Code:
# vi /etc/hosts.allow

and I search the line ALL : ALL : allow must be without coment (no #)

quit the editor vi and save changes

Code:
# vi /etc/ssh/sshd_config

and I search the line (Listen: 0.0.0.0) must be without coment (no #)

quit the editor vi and save changes

Code:
vi /etc/group

and I search the line (wheel:root) and at the and write (wheel:root,user) for to add my user to the wheel group and then to have privileges of super user.

the following is to install

Code:
# cd /usr/ports/ports-mgmt/portmaster
# make install clean clean-depend

after, I update the ports tree

Code:
# cd /usr/ports
# portsnap fetch extract
# portsnap fetch update

APACHE 2.2.17_1

Code:
# cd /usr/ports/www/apache22
# make install clean clean-depend

all options for default

I install the dependences: PERL with the default options, Options for m4 the default options, Options for libiconv the default options, Options for apr-ipv6-devrandom-gdbm-db42the default options, Option for Phyton 26 the the default options.

the following

Code:
# vi /etc/rc.conf

add the line

Code:
apache22_enable="YES"

quit the editor and save changes

Code:
vi /boot/loader.conf

add the line

Code:
accf_http_load="YES"

quit the editor and save changes

the following

Code:
# vi /usr/local/etc/apache22/httpd.conf

The following lines without coments (no #)

Code:
ServerRoot "/usr/local/"
DocumentRoot "/usr/local/www/apache22/data/"

should appear

Code:
LoadModule unique_id_module libexec/apache22/mod_unique_id-so

I change

Code:
ServerName manyblue.homeunix.com:80
ServerAdmin xxxxx@xxxxx.com

I search the lines

Code:
DocumentRoot "/usr/local/www/apache22/data"

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
     AllowOverride None  
     Order allow,deny
     Allow from all
</Directory>

and I made

Code:
DocumentRoot "/usr/local/www/apache22/data"

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
     AllowOverride All
     Order allow,deny
     Allow from all
</Directory>

quit the editor vi and save changes

.............ANDY................

know, the manual of freeBSD made easy say me

Currently in Apache 2.2.x the default directory is /usr/local/www/apache22 instead of
the old default. This should be changed to the standard directory of
/usr/local/www/data in every spot. You can move the folder like this if you do not
have a previous version of apache installed that has created the directory already.

Code:
# mv /usr/local/www/apache22 /usr/local/www/

You can replace it easily with sarep from the ports with this command

Code:
# sarep "/usr/local/www/apache22" "/usr/local/www" httpd.conf

This is enough to get the server going so that you can check that it will run, so do
that now.

Must I do it ????????????

my standar directory is

Code:
/usr/local/www/apache22/data/


To follow, I hope for your analysis, forgive my stupidity or ignorance.
I think that currently the lack of language should not be a barrier to be able to communicate.

ANDY, as always thank you very much for your attention and lost time.
 
Ok, so following on from your last post it just remains to install PHP. Very importantly you must ensure that you include the option to build the apache module when compiling PHP.

Code:
cd /usr/ports/lang/php5
make clean
make config  (here you need to select the apache module option which is off by default)
make deinstall  (in case you have a previous installation)
make install

Following that you still need to make the update to the httpd.conf to enable php file types:

Code:
AddType application/x-httpd-php .php .php3 .phtml

I have this directly under the "LoadModule" for php5.

That should be it. Don´t forget you need to restart apache for the above change to take effect,

thanks Andy.
 
I anderstand Andy, but it is not weel. I followed the manual but it was impossible to do this:

Code:
# mv /usr/local/www/apache22 /usr/local/www/
# sarep "/usr/local/www/apache22" "/usr/local/www" httpd.conf

I explain you;

I went to

Code:
# cd /usr/ports/textproc/sarep
# make install clean clean-depend
# mv /usr/local/www/apache22 /usr/local/www

To here it is well, but when I do

Code:
# sarep "/usr/local/www/apache22" "/usr/local/www" httpd.conf

FreeBsd say me it is impossible because sarep it is not a command.
I think that this is my probleme, at the and. I tell you more

Code:
# cd /usr/local/etc/apache22/
# ls
# Includes       extras          magic
   envvars.d     httpd.conf     mime.types

# cd /usr/local/www/apache22/
# ls 
# cgi-bin    data    error    icons

I am doing the change for the set in

Code:
# /usr/local/etc/apache22/httpd.conf

I think that I must do

Code:
# cp /usr/local/etc/apache22  /usr/local/www/apache22

to copy the files inside of /usr/local/etc/apache22 to /usr/local/www/apache22

and at the and

Code:
# cd /usr/local/www/apache22/
# ls
# Includes       extras          magic
   envvars.d     httpd.conf     mime.types
   cgi-bin          data            error              icons

I am not sure of this but I think the probleme is here.

Tell me something ??????? I can´t to follow with php5

And one ask; must I did the configuration for php5 in

Code:
# vi /usr/local/www/apache22/httpd.conf
??????????????

ANDY, as always thank you very much for your attention and lost time.
 
Hi,

If you have found a problem with permissions then great. I'm not sure exactly what permission issue you have found though! The only requirement for html or any other content you want to be visible via apache is that it is readable by the user account that the apache daemons run as, which by default on FreeBSD is www. The easiest way to achieve this is to just "chown www myfile" any file or directory you require. By default files will be readable by the owner so you shouldn't need to mess with chmod.

So does you php test page now work?

thanks Andy.
 
AndyUKG said:
Hi,

If you have found a problem with permissions then great. I'm not sure exactly what permission issue you have found though! The only requirement for html or any other content you want to be visible via apache is that it is readable by the user account that the apache daemons run as, which by default on FreeBSD is www. The easiest way to achieve this is to just "chown www myfile" any file or directory you require. By default files will be readable by the owner so you shouldn't need to mess with chmod.

So does you php test page now work?

thanks Andy.

I do not know exactly, but somewhere else toll me yes because the people out of the server should be able to read,run but not write. I'm on it.

Code:
# Chmod -R 777 data

or

Code:
# Chmod -R 777 index.html


Only ever give thanks for your input and concern.
When I have the solution I will post them here by way of curiosity.

You are welcome to come anytime canary more specifically to La Palma, you know my email, write me and we agreed if you want.

Greetings
 
so the first thing to do is make sure PHP is actually installed and working on the box... then make sure you invoke PHP correctly from within an Apache-PHP page...

at the command line:

Code:
[root] </usr/ports--> php -v
PHP 5.3.3 with Suhosin-Patch (cli) (built: Dec  1 2010 20:24:26)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root] </usr/ports-->

A second test at the command line is this:

Code:
[root] </usr/ports--> php -info

You should get lot's of static back which that'll tell you PHP is installed and working [or not] and how it is configured.

the other thing: from your code snippet: you said you did this in a test file:

Code:
<? Php phpinfo ();?>

that won't work... it should be like this:

Code:
<?php phpinfo (); ?>

note the "<?php" with no spacing...

finally: Did you restart Apache after modifying the httpd.conf file ?

Code:
[root] </--> apachectl graceful
 
1)

Code:
# cd /usr/ports
# php -v
PHP 5.3.3 with Suhosin-Patch (CLI)n(built: 2 2010 19:40:48)
Copyright (c) 1997-2009 The PHP Group
Zen Engine v2.3.0, Copyright (C) 1998-2010 Zen Tachnologies

2)

Code:
# cd /usr/ports
# php -info

http://www.abogadosodaly14.com/phpinfo.avi

Note: To view the video waiting for downloads are about 13 MB

3) NO

Code:
# echo "<?php phpinfo (); ?>" >> /usr/local/www/apache22/data/test.php

4) No

Code:
# reboot



I think my probleme is

Code:
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

Why ???

Code:
cd /usr/local/etc/ 
# ls
devd
man.d
pam.d
php
php.conf
php.ini-development
php.ini-production
rc.d
xml2Conf.sh
xlstConf.sh
apache22

What must I do

Code:
# cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

I wait for your reply

Thank
 
Since no one tells me anything, I will tell you just I need the apache configuration (httpd.conf) for the php5 module, the load php5 module it is only that I need the rest. This was my real problem, php5 works but only reads the php file does not execute it.

I've cast a thousand ways, says the official website of php for apache (php and apache) and nothing, made easy php and apache and nothing , etc and nothing ............

If you want to help me OK, if don´t want to help I will understand it and you can close the post.

Thank you very much for attention.

PD: I have apache 2.2.17_1 and php 5.1
 
Lets start again, ignoring the guides you have been using (it really should be very easy).

Firstly can you confirm this file exists?

/usr/local/libexec/apache22/libphp5.so

thanks Andy.
 
I went inside his server and fixed his problem...it seems to be a httpd.conf configuration...I sent him mine first, and he said his were ok...but after I replaced with mine, it magically worked....

I am assuming that he is now happy :)
 
Too hapy

thank thank thank Mr. Zachary Huang

but there is much difference between what was Zachary and manuals I've read
 
I have reinstalled and all is OK

Beesatmsu:

Thank to you. I´m so happy!

And now for:

1) puredb + pure-ftpd 2) phpsysinfo 3) phpmyadmin 4) DarwinStreamingServer + mpeg4 5) MLDonkey 6) Virtual Server for the moment.

Kind regards from Canary
 
beesatmsu said:
I went inside his server and fixed his problem...it seems to be a httpd.conf configuration...I sent him mine first, and he said his were ok...but after I replaced with mine, it magically worked....

I am assuming that he is now happy :)

Hii beesatmsu,

I'll be grateful if you can please send a copy of the httpd.conf file you sent to manyblue. I am also working on a FreeBSD server but the [cmd=]# echo "<?php phpinfo (); ?>" >> /usr/local/www/apache22/data/test.php[/cmd] code is not giving any output in the browser, it is just blank without any error message being displayed in the browser.

Look forward to reading from you or any other person that wants to help out.

Thank you.
 
Back
Top