LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2012, 12:44 AM   #1
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Rep: Reputation: Disabled
Question Installed php, httpd, but php does not work too well


So, I am running centOS6,

httpd, mySQL and php are already installed.
Http pages loading just fine, but php page just shows a code.

Code:
# php -v
PHP 5.3.11 (cli) (built: Apr 27 2012 17:11:01)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Code:
# yum list installed |grep php
php.x86_64            5.3.11-1.el6.remi @remi
php-cli.x86_64        5.3.11-1.el6.remi @remi
php-common.x86_64     5.3.11-1.el6.remi @remi
php-devel.x86_64      5.3.11-1.el6.remi @remi
php-gd.x86_64         5.3.11-1.el6.remi @remi
php-mbstring.x86_64   5.3.11-1.el6.remi @remi
php-mcrypt.x86_64     5.3.11-1.el6.remi @remi
php-mysql.x86_64      5.3.11-1.el6.remi @remi
php-pdo.x86_64        5.3.11-1.el6.remi @remi
php-pear.noarch       1:1.9.4-7.el6.remi
php-pecl-apc.x86_64   3.1.10-1.el6.remi @remi
php-pecl-igbinary.x86_64
php-pecl-memcache.x86_64
php-pecl-memcached.x86_64
php-pecl-mongo.x86_64 1.2.10-1.el6.remi @remi
php-pgsql.x86_64      5.3.11-1.el6.remi @remi
php-php-gettext.noarch
php-sqlite.x86_64     5.3.11-1.el6.remi @remi
php-xml.x86_64        5.3.11-1.el6.remi @remi
phpMyAdmin.noarch     3.5.0-1.el6       @epel
Code:
]# yum list installed |grep mysql
compat-mysql51.x86_64 5.1.54-1.el6.remi @remi
mysql.x86_64          5.5.23-1.el6.remi @remi
mysql-libs.x86_64     5.5.23-1.el6.remi @remi
mysql-server.x86_64   5.5.23-1.el6.remi @remi
php-mysql.x86_64      5.3.11-1.el6.remi @remi
Code:
# yum list installed |grep httpd
httpd.x86_64          2.2.15-15.el6.centos.1
httpd-tools.x86_64    2.2.15-15.el6.centos.1
 
Old 05-03-2012, 01:48 AM   #2
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
Check if the following exist in the httpd.conf
in the module section:
LoadModule php5_module modules/libphp5.so
(this module must be loaded at the near bottom from this section)
Code:
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>


<IfModule mime_module>
....
...
AddHandler application/x-httpd-php .php
.....
</IfModule>

<IfModule php5_module>
Include conf/extra/php5_module.conf
</IfModule>
code in extra/php5_module.conf
Code:
# Required modules: dir_module, php5_module

<IfModule dir_module>
	<IfModule php5_module>
		DirectoryIndex index.php index.html
		<FilesMatch "\.php$">
			SetHandler application/x-httpd-php
		</FilesMatch>
		<FilesMatch "\.phps$">
			SetHandler application/x-httpd-php-source
		</FilesMatch>
	</IfModule>
</IfModule>
 
1 members found this post helpful.
Old 05-03-2012, 02:13 AM   #3
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
where is that extra?

Code:
# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Syntax error on line 574 of /etc/httpd/conf/httpd.conf:
Invalid command '....', perhaps misspelled or defined by a module not included in the server configuration
                                                           [FAILED]
Maybe I don't have such modules?

Last edited by WoAnerges; 05-03-2012 at 02:15 AM.
 
Old 05-03-2012, 02:38 AM   #4
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
it should be here:
/etc/httpd/conf/extra/php5_module.conf

this guide is step by step for centos6
take a look at http://www.howtoforge.com/installing...entos-6.2-lamp
 
1 members found this post helpful.
Old 05-03-2012, 03:32 AM   #5
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
I don't even have extras dir in httpd's conf dir. What do I do?
 
Old 05-03-2012, 11:00 AM   #6
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
help
 
Old 05-04-2012, 03:08 AM   #7
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
Some distro's don't do extra folders but to keep stuff easy to maintain and not to make one bulky httpd.conf, things like vhost php5 dav and ssl configs can be kept in an extra folder then included in the main httpd.conf
You can create that extra folder in /etc/httpd/conf/extra and there you create the php5_module.conf

Code:
# Required modules: dir_module, php5_module

<IfModule dir_module>
	<IfModule php5_module>
		DirectoryIndex index.php index.html
		<FilesMatch "\.php$">
			SetHandler application/x-httpd-php
		</FilesMatch>
		<FilesMatch "\.phps$">
			SetHandler application/x-httpd-php-source
		</FilesMatch>
	</IfModule>
</IfModule>
Now you include this extra/php5_module.conf with this code at the near bottom of your httpd.conf
Code:
<IfModule php5_module>
Include conf/extra/php5_module.conf
</IfModule>
The php module must be loaden after the dir_module in the section that starts with "LoadModule ..."

Code:
...
....
LoadModule dir_module modules/mod_dir.so
LoadModule php5_module modules/libphp5.so
....
...
Don't forget the : AddHandler application/x-httpd-php .php in the mime module section and add index.php before index.hmtl in this section
Code:
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

you can test the config with
Code:
apachectl -t
this should return "Syntax OK"
and
Code:
apachectl -t -D DUMP_MODULES |grep php
Syntax OK
 php5_module (shared)
this shows that the php module loads at startup

Last edited by Babertje; 05-04-2012 at 03:11 AM.
 
1 members found this post helpful.
Old 05-04-2012, 05:11 AM   #8
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
Screw centOS. I am gonna use Debian. centOS crashed randomly two times in one day today. All because their packaging is too old.
 
Old 05-04-2012, 05:44 AM   #9
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
Quote:
Originally Posted by WoAnerges View Post
Screw centOS. I am gonna use Debian. centOS crashed randomly two times in one day today. All because their packaging is too old.
Bleeding edge, fast, clean and a very good package system, try Archlinux they also have a very good Wiki.
However don't discard this thread as it is a good lead to setup apache lamp!
 
Old 05-04-2012, 05:53 AM   #10
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
not even phpinfo() worked at your end ?
 
Old 05-04-2012, 05:53 AM   #11
WoAnerges
Member
 
Registered: Apr 2012
Posts: 50

Original Poster
Rep: Reputation: Disabled
nothing. didn't work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open edit Php file problem (PhP apache installed) waerfwe Programming 3 06-30-2011 09:29 AM
Why doesn't apache (httpd) recognize and run with the new version of PHP I installed? jpuretz@tk20.com Linux - Server 5 06-10-2008 03:45 AM
Configure PHP source to HTTPD installed from YUM ittec Linux - Software 2 03-03-2008 03:31 AM
installed php and apache yet my php pages dont load ?? jessica_lilly Linux - Software 1 11-13-2007 01:57 AM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration