Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP not working with apache
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Thu Sep 09, 2010 8:41 pm    Post subject: PHP not working with apache Reply with quote

I am unable to make it work. Php files just show code, pure code :(

I have the apache2 flag enabled:

Quote:
dev-lang/php-5.2.14 was built with the following:
USE="apache2 berkdb bzip2 cli crypt ctype exif filter gd gdbm hash iconv ipv6 json ldap (multilib) mysqli ncurses nls pcre posix readline reflection session simplexml spell spl ssl tokenizer truetype unicode xml xmlreader xmlwriter zlib (-adabas) -bcmath (-birdstep) -calendar -cdb -cgi -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase (-dbmaker) -debug -discard-path -doc -embed (-empress) (-empress-bcs) (-esoob) (-fdftk) (-firebird) -flatfile -force-cgi-redirect (-frontbase) -ftp -gd-external -gmp -imap -inifile -interbase -iodbc -kerberos -kolab -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysql -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -postgres -qdbm -recode -sapdb -sharedext -sharedmem -snmp -soap -sockets (-solid) -sqlite -suhosin (-sybase-ct) -sysvipc -threads -tidy -wddx -xmlrpc -xpm -xsl -yaz -zip"
CFLAGS="-march=native -O2 -pipe -D_GNU_SOURCE"


And apache:
Quote:
www-servers/apache-2.2.16 was built with the following:
USE="ldap (multilib) ssl -debug -doc (-selinux) -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--no-as-needed"


I've never had this problem. I am desperated already because I need it! :(

Thanks by the way :)
_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Thu Sep 09, 2010 8:57 pm    Post subject: Reply with quote

Did you add "-D PHP5" to APACHE2_OPTS in /etc/conf.d/apache2?
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
Yuu
Apprentice
Apprentice


Joined: 23 Dec 2008
Posts: 223
Location: France

PostPosted: Thu Sep 09, 2010 9:00 pm    Post subject: Reply with quote

Hi,

maybe I'm wrong but : did you add the php handler for .php files ?

In your /etc/apache2/modules.d/70_mod_php5.conf, you should have something like :
Code:
IfDefine PHP5>
        # Load the module first
        <IfModule !mod_php5.c>
                LoadModule php5_module    modules/libphp5.so
        </IfModule>

        # Set it to handle the files
        <IfModule mod_mime.c>
                AddHandler application/x-httpd-php .php .php5 .phtml
                AddHandler application/x-httpd-php-source .phps
        </IfModule>

        DirectoryIndex index.php index.phtml
</IfDefine>


Another question : do you have a "-D PHP5" on the APACHE2_OPTS variable, in your /etc/conf.d/apache2 ?


Good luck.
_________________
Main laptop : T8300 cpu | 200 GB hard drive | 2 GB of ram | 8600M GT | Gentoo x86_64
Server : Celeron 220 cpu | 250 GB hard drive | 2 GB of ram | SiS 662 VGA | Gentoo x86_64
Back to top
View user's profile Send private message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Thu Sep 09, 2010 9:09 pm    Post subject: Reply with quote

Yeah I have both:

/etc/conf.d/apache2
Quote:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"


/etc/apache2/modules.d/70_mod_php5.conf
Quote:
<IfDefine PHP5>
# Load the module first
<IfModule !mod_php5.c>
LoadModule php5_module modules/libphp5.so
</IfModule>

# Set it to handle the files
<IfModule mod_mime.c>
AddHandler application/x-httpd-php .php .php5 .phtml
AddHandler application/x-httpd-php-source .phps
</IfModule>

DirectoryIndex index.php index.phtml
</IfDefine>

_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Fri Sep 10, 2010 6:06 am    Post subject: Reply with quote

Any other idea :( :?

Thanks!
_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Fri Sep 10, 2010 6:23 am    Post subject: Reply with quote

70_mod_php.conf gets included via this in /etc/apache2/httpd.conf

Code:


Include /etc/apache2/modules.d/*.conf



check and make sure that include is present?

it...should be. I assume it's not something silly like not having restarted apache since building php?
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Fri Sep 10, 2010 2:09 pm    Post subject: Reply with quote

That is also in the proper file :(
Quote:
# Supplemental configuration
#
# Most of the configuration files in the /etc/apache2/modules.d/ directory can
# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features
# or to modify the default configuration of the server.
#
# To know which flag to add to APACHE2_OPTS, look at the first line of the
# the file, which will usually be an <IfDefine OPTION> where OPTION is the
# flag to use.
Include /etc/apache2/modules.d/*.conf


I agree, I am sure there is some stupid option/module I am missing :(
_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Fri Sep 10, 2010 2:15 pm    Post subject: Reply with quote

Starting to clutch at straws here but do your php files end with one of these extensions?

Code:
.php .php5 .phtml


If they do is there anything obvious in your Apache error log?
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Fri Sep 10, 2010 2:24 pm    Post subject: Reply with quote

Yep, the files I test have the .php ending. All of them.

And the log looks correct :(
_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
AllenJB
Veteran
Veteran


Joined: 02 Sep 2005
Posts: 1285
Location: Ashford, Kent

PostPosted: Fri Sep 10, 2010 5:01 pm    Post subject: Reply with quote

You might want to check the output of the following commands:
Code:

/etc/init.d/apache2 configdump
/etc/init.d/apache2 modules


That should tell you what the configuration is, according to Apache, and whether it actually has the php module loaded.
_________________
http://gentoo-wiki.com :: http://lug.org.uk :: http://www.linux.org/groups/ :: User Blogs
Back to top
View user's profile Send private message
HitMaker
Apprentice
Apprentice


Joined: 15 May 2008
Posts: 175
Location: Helsinki

PostPosted: Fri Sep 10, 2010 9:50 pm    Post subject: Reply with quote

/etc/init.d/apache2 modules:
Quote:
Luis-Desktop ~ # /etc/init.d/apache2 modules
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_alias_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authn_default_module (shared)
authn_file_module (shared)
authz_dbm_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_owner_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
ext_filter_module (shared)
filter_module (shared)
headers_module (shared)
include_module (shared)
info_module (shared)
log_config_module (shared)
logio_module (shared)
mime_module (shared)
mime_magic_module (shared)
negotiation_module (shared)
rewrite_module (shared)
setenvif_module (shared)
speling_module (shared)
ssl_module (shared)
unique_id_module (shared)
usertrack_module (shared)
vhost_alias_module (shared)
php5_module (shared)
Syntax OK


I'd started thinking I am stupid or something like that :(

But then I try out a custom php instead of the Joomla instalation... and it works.

EDIT: Sorry for this post, it has been a busy week at work and when I was at home I wasn't thinking clear enough :(

I didn't have the redirect enabled. I just enabled and now is working everything like it should be :)
_________________
E8200 - 4GB - P5E-VM - 8800GTS & Dell SP2309W - 750GB Seagate SATA2 7200.11 -Antec P180Mini & Enermax Modu82+ 525W - Gentoo
MacBook Pro 3.1 - Snow Leopard
Samsung NC10
Back to top
View user's profile Send private message
Krugy
n00b
n00b


Joined: 11 Nov 2004
Posts: 5
Location: Kotka

PostPosted: Wed Oct 13, 2010 6:41 am    Post subject: Reply with quote

I'm having troubles with php too, i always make the same mistake by updating apache, mysql and php without searching for any problems / configuration changes, this leaves me crying out loud and figuring out some configuration problems which usually have been pretty easy to solve.

This time things have changed...

Now i'm at this situtation where apache starts and lists apache2 as process at 'ps aux|grep apache', but it seems it's a zombie process, it will not open any pages from the server, and there is no pid file.

I'm now trying to get apache and php to work with pretty much default configuration after reinstall.

Quote:
Apache2 flags:

[ebuild R ] www-servers/apache-2.2.16 USE="ssl -debug -doc -ldap (-selinux) -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker" 0 kB


Quote:
PHP flags:

[ebuild R ] dev-lang/php-5.2.14 USE="apache2 berkdb bzip2 cli crypt ctype filter gd gdbm hash iconv json ncurses nls pcre pic posix readline reflection session simplexml snmp spl ssl tokenizer truetype unicode xml xmlreader xmlrpc xmlwriter zip zlib -adabas -bcmath -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -embed -empress -empress-bcs -esoob -exif -fdftk -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -gmp -imap -inifile -interbase -iodbc -ipv6 -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -postgres -qdbm -recode -sapdb -sharedext -sharedmem -soap -sockets -solid -spell -sqlite -suhosin -sybase-ct -sysvipc -threads -tidy -wddx -xpm -xsl -yaz" 0 kB


Quote:
/etc/conf.d/apache2:

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"


When i start apache it shows running in the processes but does nothing. When i remove the -D PHP5 from APACHE2_OPTS, the server works fine.

'apache2ctl configdump' or 'modules' will not work with php enabled, error_log has nothing in it.

Any advice?
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Wed Oct 13, 2010 11:50 am    Post subject: Reply with quote

try and re-emerge php?
Back to top
View user's profile Send private message
Krugy
n00b
n00b


Joined: 11 Nov 2004
Posts: 5
Location: Kotka

PostPosted: Wed Oct 13, 2010 11:54 am    Post subject: Reply with quote

richard.scott wrote:
try and re-emerge php?


I've done this for around 10 times already, for apache, mysql and php, now i've removed mysql just to get this working.

I did try to update PHP to latest (5.3.3-r1) version earlier, the compile failed, does this have something to do with the problem?

Since that, i have removed php and re-emerged 5.2.14 version but no avail.
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Wed Oct 13, 2010 12:20 pm    Post subject: Reply with quote

what does "php -v" show?
Back to top
View user's profile Send private message
Krugy
n00b
n00b


Joined: 11 Nov 2004
Posts: 5
Location: Kotka

PostPosted: Wed Oct 13, 2010 12:22 pm    Post subject: Reply with quote

richard.scott wrote:
what does "php -v" show?


Segmentation fault
Back to top
View user's profile Send private message
richard.scott
Veteran
Veteran


Joined: 19 May 2003
Posts: 1497
Location: Oxfordshire, UK

PostPosted: Wed Oct 13, 2010 12:23 pm    Post subject: Reply with quote

try re-emerging glibc and php one after the other... it may help.
Back to top
View user's profile Send private message
kpsyran
n00b
n00b


Joined: 09 Mar 2005
Posts: 7

PostPosted: Fri Oct 15, 2010 6:27 pm    Post subject: Reply with quote

I too am having this issue on my test server, Apache wouldn't start once I emerged php 5.3.3-r1. I removed the "-D PHP5" command, and apache will run properly without supporting php.
I tried to go back to 5.2.14, but continue to have the same issue with a segmentation fault any time I run "php -v" on the server.

I have tried re-emerging glibc as well. Php will compile without any errors.

I did the following:
Quote:
revdep-rebuild -i --library libssl.so.0.9.8
revdep-rebuild -i --library libcrypto.so.0.9.8


And now my php and apache are working properly :)[/quote]
Back to top
View user's profile Send private message
John5788
Advocate
Advocate


Joined: 06 Apr 2004
Posts: 2140
Location: 127.0.0.1

PostPosted: Thu Oct 21, 2010 7:02 am    Post subject: Reply with quote

i had the same problem with php-5.3.3-r1. I masked it and went back to 5.2.14
_________________
John5788
Back to top
View user's profile Send private message
hazza
n00b
n00b


Joined: 30 Dec 2002
Posts: 68
Location: Burton on Trent

PostPosted: Thu Oct 21, 2010 2:31 pm    Post subject: Reply with quote

For me it was an issue with some sites working, others not. Traced it to a directive in /etc/php/apache2-php5/php.ini:
Code:
short_open_tag = Off
Changing it to
Code:
short_open_tag = On
fixed the issue, however I'm undertaking a change to move all PHP tags to the long-style tag as the comments imply this will soon be depreciated.

Cheers,
Harry
Back to top
View user's profile Send private message
Lu Tze
n00b
n00b


Joined: 21 Nov 2005
Posts: 22
Location: Tugadogalong

PostPosted: Fri Oct 22, 2010 9:20 am    Post subject: Make libphp5.so executable Reply with quote

I had the same issue here after upgrading to php-5.3.3-r1. I eventually found out (after re-emerging php) that for some reason libphp5.so is not executable.

Code:

root#> chmod a+x /usr/lib/apache2/modules/libphp5.so


fixed the issue, now everything works beautifully. Perhaps it is worth filing a bug report? The issue is somewhat difficult to track down simply because it is so trivial.

Hope that helps.
_________________
"My brother sent me a postcard the other day with this big satellite photo of the entire Earth on it. On the back it said: "Wish you were here"" - Steven Wright
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1164
Location: Tri-Cities, WA USA

PostPosted: Fri Nov 12, 2010 2:43 pm    Post subject: Reply with quote

cach0rr0 wrote:
70_mod_php.conf gets included via this in /etc/apache2/httpd.conf

Code:


Include /etc/apache2/modules.d/*.conf



check and make sure that include is present?

it...should be. I assume it's not something silly like not having restarted apache since building php?


The 70_mod_php.conf module is not loading at /etc/apache2/modules.d/ when I emerge apache and php
I used the use flags from apache and php from emerge -pv and I get apache to work but not php.
I put the use flags in package.use and I wonder if my syntax is correct.
When I emerge I don't get any atom errors.
My package.use file is located at: http://pastebin.com/8rDDzSrk
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
Snaketails
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jul 2003
Posts: 78
Location: Boronia.Vic.Oz.Au

PostPosted: Sat Nov 13, 2010 1:41 pm    Post subject: Reply with quote

After trying *all* of the above, without any luck on anything, doing a php or php -v both gave seg faults, I did the following,

Quote:

emerge -e php


somewhere after the 200 of 275 (and before the 258'th one) php finally began working again :)

Quote:

~ # php
Segmentation fault
~ # php -v
Segmentation fault
~ # php -v
PHP 5.3.3-pl1-gentoo (cli) (built: Nov 13 2010 13:21:05)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Back to top
View user's profile Send private message
cwc
Veteran
Veteran


Joined: 20 Mar 2006
Posts: 1164
Location: Tri-Cities, WA USA

PostPosted: Mon Nov 15, 2010 5:20 am    Post subject: Reply with quote

I also did an emerge -e php and now I'm running PHP Version 5.3.3-pl1-gentoo
Plus I made sure the conf files were configured. all is good.

httpd.conf
LoadModule php5_module modules/libphp5.so

# /etc/conf.d/apache2: config file for /etc/init.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5"

thanks for all the tips. nice thread!
_________________
Without diversity there can be no evolution:)
Back to top
View user's profile Send private message
Naam
n00b
n00b


Joined: 05 Feb 2011
Posts: 14

PostPosted: Thu May 19, 2011 1:38 pm    Post subject: Thanks Reply with quote

tomk wrote:
Did you add "-D PHP5" to APACHE2_OPTS in /etc/conf.d/apache2?


Thanks, this work for me !
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum