LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-19-2012, 01:19 PM   #1
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Rep: Reputation: 2
php with apache


I tried to set up httpd to work with php module, so i've followed the rules from http://connie.slackware.com/~mrgobli...ware-lamp2.php and then i created the index.php file containing the phpinfo() function, and when i accessed it from the browser it just lists it and not interprets it through php module. I can't find the problem. Anyone can help? Thanks.
 
Old 07-19-2012, 01:26 PM   #2
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
What distro are you using here? Do you have php installed? You should be able to run the below command to get your php version.

Code:
/usr/bin/php -v
apachectl -t -D DUMP_MODULES
 
1 members found this post helpful.
Old 07-19-2012, 01:30 PM   #3
NoStressHQ
Member
 
Registered: Apr 2010
Location: Geneva - Switzerland ( Bordeaux - France / Montreal - QC - Canada)
Distribution: Slackware 14.2 - 32/64bit
Posts: 609

Rep: Reputation: 221Reputation: 221Reputation: 221
edit and read /etc/httpd/httpd.conf...

You should find a line to uncomment to enable php, but it worth having a view of the whole file, so take time to read it.

Cheers.
 
Old 07-19-2012, 01:32 PM   #4
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
It really depends upon the module being used here NoStressHQ. Apache can parse PHP in several methods, the apachectl command will show us what apache currently has loaded for modules to help better point the OP in the right direction.


I think you're a couple steps ahead in telling them to go into the httpd.conf and start removing comments. mitusf let's get the output of what you currently have running before we start changing anything.
 
Old 07-19-2012, 02:10 PM   #5
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
@NoStressHQ: yes, i've uncommented the php line in /etc/httpd/httpd.conf, like the web page that i've indicated requests.

Here is the output of the commands that Kustom42 indicated:


root@darkstar:~# /usr/bin/php -v
PHP 5.3.14 (cli) (built: Jul 4 2012 20:12:22)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

root@darkstar:~# apachectl -t -D DUMP_MODULES
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
authn_dbd_module (shared)
authn_default_module (shared)
authn_alias_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_dbm_module (shared)
authz_owner_module (shared)
authnz_ldap_module (shared)
authz_default_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
file_cache_module (shared)
cache_module (shared)
disk_cache_module (shared)
mem_cache_module (shared)
dbd_module (shared)
dumpio_module (shared)
reqtimeout_module (shared)
ext_filter_module (shared)
include_module (shared)
filter_module (shared)
substitute_module (shared)
deflate_module (shared)
ldap_module (shared)
log_config_module (shared)
log_forensic_module (shared)
logio_module (shared)
env_module (shared)
mime_magic_module (shared)
cern_meta_module (shared)
expires_module (shared)
headers_module (shared)
ident_module (shared)
usertrack_module (shared)
unique_id_module (shared)
setenvif_module (shared)
version_module (shared)
proxy_module (shared)
proxy_connect_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_scgi_module (shared)
proxy_ajp_module (shared)
proxy_balancer_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
asis_module (shared)
info_module (shared)
cgi_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
imagemap_module (shared)
actions_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
php5_module (shared)
Syntax OK


Thanks for your answers.
 
Old 07-19-2012, 02:36 PM   #6
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Ok, so it looks like your PHP is loaded correctly into Apache.

Let's look at your virtual host records and the options passed to it.

So by default your virtual host records should be in your /etc/httpd/httpd.conf or a similar config file. If you are using a control panel like plesk or cpanel this will be different.

The first thing to look at is the ExecCGI option as this can have some effect on the way PHP is processed.


So, since you are the one who setup the virtual host for the domains you should know where they are contained.


Can you please locate the virtual host record for the domain in question and let us know what you are passing to your "Options" directive.

If you are not sure what this is you can post the entire syntax of your virtual host.

If you are not sure where your virtual host record is at you can use the following command:

Code:
apachectl -t -D DUMP_VHOSTS
This will tell you what file and what line number it is contained in.
 
1 members found this post helpful.
Old 07-19-2012, 03:13 PM   #7
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
root@darkstar:/etc/httpd/extra# apachectl -t -D DUMP_VHOSTS
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
VirtualHost configuration:
Syntax OK

That's all it says, i've noticed a Virtual hosts entry in /etc/httpd/httpd.conf, like this:

# Virtual hosts
#Include /etc/httpd/extra/httpd-vhosts.conf

So, this being commented, i don't know about other entry.

Last edited by mitusf; 07-19-2012 at 03:18 PM.
 
Old 07-19-2012, 03:19 PM   #8
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
You do not have a virtual host setup. How are you accessing the site in your browser. Are you using an IP or a dns name?
 
Old 07-19-2012, 03:26 PM   #9
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
I'm accessing it either with 127.0.0.1, localhost, or hostname.domain
 
Old 07-19-2012, 03:29 PM   #10
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
The hostname and domain name are just for local use, not registered through dns, just mentioned in /etc/hosts, you know...

Last edited by mitusf; 07-19-2012 at 03:31 PM.
 
Old 07-19-2012, 03:39 PM   #11
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
OK, well you need to setup a namevirtualhost record and setup a default virtual host.

Check out:
http://www.thegeekstuff.com/2011/07/...-virtual-host/
http://httpd.apache.org/docs/2.2/vhosts/examples.html
http://httpd.apache.org/docs/2.2/vhosts/name-based.html

If you have any questions let us know. When you setup your virtual host, under the "Options" directive set "+ExecCGI".
 
1 members found this post helpful.
Old 07-19-2012, 04:05 PM   #12
NoStressHQ
Member
 
Registered: Apr 2010
Location: Geneva - Switzerland ( Bordeaux - France / Montreal - QC - Canada)
Distribution: Slackware 14.2 - 32/64bit
Posts: 609

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by Kustom42 View Post
It really depends upon the module being used here NoStressHQ.
Alright... Sorry for the misleading ...

Cheers.
 
Old 07-19-2012, 04:21 PM   #13
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
ok, i created a virtualhost like this, in /etc/httpd/extra/httpd-vhosts.conf (also uncommented the corresponding line in httpd.conf):


<VirtualHost *:80>
ServerAdmin webmaster@hostname.domain
DocumentRoot "/var/www/htdocs"
ServerName hostname.domain
ServerAlias www.hostname.domain
ErrorLog "/var/log/httpd/hostname.domain.ro-error_log"
CustomLog "/var/log/httpd/hostname.domain-access_log" common
</VirtualHost>

and when i tried to access the index.php file, i only get a

Forbidden
You don't have permission to access /index.php on this server.

Also, i didn't see any Option directive under VH, should i create one with "+ExecCGI" value?
 
Old 07-19-2012, 04:34 PM   #14
Kustom42
Senior Member
 
Registered: Mar 2012
Distribution: Red Hat
Posts: 1,604

Rep: Reputation: 415Reputation: 415Reputation: 415Reputation: 415Reputation: 415
Yes, just add the line:

Options +ExecCGI


What are the permissions on the folder: /var/www/htdocs?
 
1 members found this post helpful.
Old 07-19-2012, 04:43 PM   #15
mitusf
Member
 
Registered: Nov 2011
Location: Bucharest, Romania
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 2
ok, the perms are 755. I've added the Options line to VirtualHost but has no effect, i still get the same forbidden message.
 
  


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
php/shell script to install mysql,apache and php automatically stranger_6_7 Linux - General 2 08-11-2009 02:07 AM
Please help with Apache Web Server / Apache Tomcat / PHP / Java / PHP-Java Bridge jpmad4it Linux - Server 2 01-05-2009 06:07 AM
Centos 5.2 running Apache 2 and PHP 4 cannot display info.php codenjanod Linux - Server 2 08-19-2008 02:00 AM
php apache or php cgi - php learner rblampain Linux - Security 3 12-17-2004 11:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:26 PM.

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