You are not logged in.

#1 2008-10-27 13:04:34

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 282

[SOLVED] Apache, php5 not working together.

Hi everyone.

I have installed apache and php from the repository, but I am unable to get php to work for my websites. Everything seems to be in order. I added that to the apache`s config file:

LoadModule php5_module modules/libphp5.so

And here is the loaded module I started the server:

[~] apachectl -M
...
php5_module (shared)
Syntax OK

Apache web server is up and running, but still, when I open the page in web browser, I got the php code as output. The code is:

<?php
echo "Here we are";
?>

When I run the code using php from terminal, everything is in order. Where the hack can be the problem. It is something very simple and stupid, I am sure, but I cannot find it.

Regards.

Last edited by Gruntz (2008-10-27 15:19:25)

Offline

#2 2008-10-27 15:19:11

Gruntz
Member
From: Haskovo, Bulgaria
Registered: 2007-08-31
Posts: 282

Re: [SOLVED] Apache, php5 not working together.

Hi, I solved the problem. You have to add:

Include conf/extra/php5_module.conf

to the httpd.conf fail in order to get it to work. It is written on the screen when you install php, but at first time, I did not noticed it.

Regards.

Offline

#3 2009-04-13 01:08:31

darthaxul
Member
Registered: 2008-09-24
Posts: 156

Re: [SOLVED] Apache, php5 not working together.

I appear to have a similar problem can anyone advise...

Apr 12 16:47:29 crematoria httpd: PHP Warning:  Unknown: open_basedir restriction in effect. File(/media/serverFiles/index.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in Unknown on line 0
Apr 12 16:47:29 crematoria httpd: PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Apr 12 16:47:29 crematoria httpd: PHP Fatal error:  Unknown: Failed opening required '/media/serverFiles/index.php' (include_path='.:/usr/share/pear') in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Warning:  Unknown: open_basedir restriction in effect. File(/media/serverFiles/index.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Fatal error:  Unknown: Failed opening required '/media/serverFiles/index.php' (include_path='.:/usr/share/pear') in Unknown on line 0

---EDIT---
As i initially suspected, php.ini can restrict what dirs can be accessed, but i fixed it

Last edited by darthaxul (2009-04-13 01:43:50)

Offline

#4 2009-09-28 15:57:46

banana989
Member
Registered: 2004-06-03
Posts: 60

Re: [SOLVED] Apache, php5 not working together.

What is the solution to the open_basedir problem ?

Offline

#5 2009-11-20 20:08:59

csj
Member
From: Taipei, Taiwan
Registered: 2009-11-02
Posts: 7

Re: [SOLVED] Apache, php5 not working together.

darthaxul wrote:

I appear to have a similar problem can anyone advise...

Apr 12 16:47:29 crematoria httpd: PHP Warning:  Unknown: open_basedir restriction in effect. File(/media/serverFiles/index.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in Unknown on line 0
Apr 12 16:47:29 crematoria httpd: PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Apr 12 16:47:29 crematoria httpd: PHP Fatal error:  Unknown: Failed opening required '/media/serverFiles/index.php' (include_path='.:/usr/share/pear') in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Warning:  Unknown: open_basedir restriction in effect. File(/media/serverFiles/index.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Apr 12 16:47:32 crematoria httpd: PHP Fatal error:  Unknown: Failed opening required '/media/serverFiles/index.php' (include_path='.:/usr/share/pear') in Unknown on line 0

---EDIT---
As i initially suspected, php.ini can restrict what dirs can be accessed, but i fixed it

1. about open_basedir error, you need to add document root path to php.ini
vim /etc/php/php.ini
open_basedir = Add your document root path in here.

2. about pear issue, I dont know what pear is, but I install it to solve this isse:
pacman -S php-pear
/etc/rc.d/httpd restart

Hope this helps smile

Offline

#6 2011-10-28 07:38:55

moog
Member
Registered: 2011-09-20
Posts: 31

Re: [SOLVED] Apache, php5 not working together.

hello, faced with the problem at the opening http://10.10.54.209/zabbix , in the log indicates an error error.log

PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0, referer: http://10.10.54.209/
PHP Fatal error:  Unknown: Failed opening required '/srv/http/zabbix/index.php' (include_path='.:/usr/share/pear') in Unknown on line 0, referer: http://10.10.54.209/

pacman -Q | egrep zabbix
zabbix-agent 1.8.8-1
zabbix-server 1.8.8-1

ls -ld /srv/http/zabbix/
drwxr-xr-x 10 root root 4096 окт.  26 17:39 /srv/http/zabbix/

Offline

#7 2013-10-14 10:53:45

jabalv
Member
Registered: 2013-10-14
Posts: 1

Re: [SOLVED] Apache, php5 not working together.

Uncomment extension=bcmath.so in php.ini

Offline

#8 2013-10-14 14:52:33

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 16,688

Re: [SOLVED] Apache, php5 not working together.

jabalv,

Welcome to Arch Linux.  And thank you for the suggestion.   Be aware that that this thread is just shy of three years since the last post; I hope they are not still fighting the issue smile
I'll leave the thread open as I believe your post is relevant.  Just be aware of our policy

Thanks


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB