Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP not running --> "Save to disk"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Sun Jun 02, 2002 4:59 am    Post subject: PHP not running --> "Save to disk" Reply with quote

Hi,

I have installed Apache, PHP and MySQL. I red through most of the solutions mentioned on this forum. I have problem to run a php file.

I made one file php_test.php containing "<? phpinfo() ?>" but instead of running the phpinfo one dialog box appears asking to "Save to disk". I have seen this problem before when using other Linux distros, but I forgot how to solve it by adding some comments to apache.conf..... or Gentoo requires something else?

Markku
Back to top
View user's profile Send private message
ves
n00b
n00b


Joined: 17 Apr 2002
Posts: 30

PostPosted: Sun Jun 02, 2002 7:19 am    Post subject: Reply with quote

just add

AddType application/x-httpd-php .php

to httpd.conf, and restart apache. That should take care of it. Oh and make sure the apache module is loaded...run a ./httpd -l to see all loaded modules. If PHP is compiled as a DSO, you'll have to have a LoadModule entry to load up the PHP DSO.
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Sun Jun 02, 2002 10:27 am    Post subject: Reply with quote

I don't have httpd.conf but /etc/apache/conf/apache.conf

In apache.conf I have the line
AddType application/x-httpd-php .php

When trying to run "httpd -l" the command is missing. What I did I copied it from my Red Hat partition...... ofcource this is not the way how its done.

When running httpd -l again, some libraries where missing..... again I copied from Red Hat hoping I could solve the "Save to disk" problem but it did not work.

rasat root # httpd -l
httpd: error while loading shared libraries: libdb-3.3.so: cannot open shared object file: No such file or directory
rasat root # httpd -l
httpd: error while loading shared libraries: libmm.so.11: cannot open shared object file: No such file or directory

After copying the libraries here is the result:

rasat root # httpd -l
Compiled-in modules:
http_core.c
mod_so.c
suexec: enabled; valid wrapper /usr/sbin/suexec
rasat root #

"Save to disk" is still appearing. It seems something is missing.

Markku
Back to top
View user's profile Send private message
Clay
n00b
n00b


Joined: 22 May 2002
Posts: 23

PostPosted: Mon Jun 03, 2002 1:07 pm    Post subject: Reply with quote

Do you have "-D PHP4" in your APACHE_OPTS in /etc/conf.d/apache ?
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Mon Jun 03, 2002 3:04 pm    Post subject: Reply with quote

Yes, I do have.

APACHE_OPTS="-D SSL -D PHP4"

If I don't get php to work with gentoo ebuild package, I will go for tar ball for apache, php and mysql. I know its not a nice solution when gentoo's emerge -u world will not be upgrading them in the future. Or maybe I should try first to reinstall. Is there any hint what I should do when reinstalling?

Markku
Back to top
View user's profile Send private message
Trumpcard
n00b
n00b


Joined: 27 May 2002
Posts: 36

PostPosted: Mon Jun 03, 2002 4:48 pm    Post subject: Reply with quote

I like what they are trying to do with the Apache/PHP configuration, but I like building with the Apache Toolbox alot better.

Go to www.apachetoolbox.com and download his latest package. Very handy, and he includes alot of the cool Apache addins and modules. Ive had alot of success with his work.
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Wed Jun 12, 2002 6:14 am    Post subject: Reply with quote

Hi,

I tried Apachetoolbox but all download sites have changed. Anyway, I am still interested to get apache + php + mysql to run with ebuild packages. I think I got everyhing correctly by adding USE="mysql php apache" and once installed run:

# ebuild /var/db/pkg/dev-lang/php-4.2.1-r1/php-4.2.1-r1.ebuild config

The "save/open" dialog box is still appearing but I found a comment on internet:

"The reason the Apache is prompting you to save/open a php file is because haven't configured Apache to send a .php file to the PHP engine."

I seached for the php file but I only found it in my Red Hat partition /usr/bin/php

Any suggestion?

Markku
Back to top
View user's profile Send private message
acidreign
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 122
Location: Brisbane, Australia

PostPosted: Wed Jun 12, 2002 6:30 am    Post subject: After modifying the httpd.conf/apache.conf Reply with quote

You MUST restart apache,

Do not copy binaries from other distrobutions, this is not only a security risk, but also the libraries that it is linked to, you will need to copy.. hence undoing the purpose of it..

In short it all just gets messy.

Add the line as mentioned above, restart apache.. all will be well.
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Wed Jun 12, 2002 9:14 am    Post subject: Reply with quote

> Add the line as mentioned above, restart apache.. all will be well.

To restart apache is not the problem. I do it always after any change in apache.conf. What line did you refer to? Lines mentioned on this topic I have.

Markku
Back to top
View user's profile Send private message
ves
n00b
n00b


Joined: 17 Apr 2002
Posts: 30

PostPosted: Thu Jun 13, 2002 9:09 pm    Post subject: Reply with quote

i dont' know how gentoo or redhat sets things up, but you should have an httpd.conf. That's the standard apache conf file.
Back to top
View user's profile Send private message
Damasz
Tux's lil' helper
Tux's lil' helper


Joined: 24 Apr 2002
Posts: 91
Location: Groningen, the Netherlands

PostPosted: Fri Jun 14, 2002 8:04 am    Post subject: Reply with quote

On gentoo the binary is called "apache" and the configuration file is "apache.conf". You can stop and start the program with either the apache script in /etc/init.d or with the /usr/sbin/apachectl program.

Do you have a LoadModule line for php4 in your apache.conf file?
What do your apache logfiles say? Are there any errors?
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Fri Jun 14, 2002 5:04 pm    Post subject: Reply with quote

It creates confusion when replies are not related to Gentoo's apache+php+mysql. Myself, I also cleaned up all Red Hat files and libraries. And re-installed all three packages.

Apache and mysql works fine as usual but..... php askes for "save/open".

I am here describing what I did with php and apache

1) # emerge php
(apache, mysql and php were all installed automatically with the line USE="apache mysql php" in /etc/make.conf).
2) # ebuild /var/db/pkg/dev-lang/php-4.2.1-r1/php-4.2.1-r1.ebuild config
3) I enabled line APACHE_OPTS="-D SSL -D PHP4" in /etc/conf.d/apache
4) I added AddType application/x-httpd-php .php in /etc/Apache/conf/apache.conf

The following lines with php where automatically added to apache.conf

*****************************
<IfDefine PHP4>
LoadModule php4_module extramodules/libphp4.so
</IfDefine>

<IfDefine PHP4>
AddModule mod_php4.c
</IfDefine>

Include conf/addon-modules/mod_php.conf

*****************************
5) # apachectl start

/var/log/apache/error_log

[Fri Jun 14 23:55:37 2002] [notice] Apache/1.3.24 (Unix) configured -- resuming normal operations
[Fri Jun 14 23:55:37 2002] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Jun 14 23:55:37 2002] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Fri Jun 14 23:56:33 2002] [error] [client 127.0.0.1] File does not exist: /home/httpd/htdocs/favicon.ico

Did I miss anything or is the log error a problem?
By the way, did anyone succeed to get Gentoo's apache+php to work or did everone use tarballs?

Markku
Back to top
View user's profile Send private message
ViceClown
n00b
n00b


Joined: 10 May 2002
Posts: 54
Location: Philadelphia, PA, USA

PostPosted: Sat Jun 15, 2002 1:22 pm    Post subject: Reply with quote

Here's how I got it to work just this morning. Maybe I should submit a howto on this :-)

First added 'mysql' and 'php' to the make.conf file so that php would have mysql support compiled into it. You don't have to compile things in this order but this is how I did it...

emerge mysql
Everything went in fine and I added mysql to the rc startup script.

emerge apache
Again, compiled and merged fine, no problem.

emerge php
Compiled fine. Created a /etc/apache/extramodules directory with libphp4.so in it. It also created /etc/apache/conf/addon-modules directory with mod_php.conf in it. That file contained all the mimetype settings.

So... I edited /etc/apache/conf/apache.conf as such:

In the LoadModule section I added at the end:
'LoadModule php4_module extramodules/libphp4.so'

In the AddModule section I added at the end:
'AddModule mod_php4.c'

Then at the end of the apache.conf file I added:
'Include /conf/addon-modules/mod_php.conf'
That took care of the mime settings.

After that just do a 'apachectl configtest' to see if your syntax and stuff is ok. If it says ok just do 'apachectl restart' I did everything above in that order and everything works like a charm. Try that out.
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Sun Jun 16, 2002 6:04 pm    Post subject: Reply with quote

Thanks for the step-by-step instruction. This was great. I got it to work.

Only difference what I did when "apachectl configtest" gave an error not finding the mod_php.conf, I edited the line.

Include /etc/apache/conf/addon-modules/mod_php.conf

Markku
Back to top
View user's profile Send private message
dju
n00b
n00b


Joined: 04 Jun 2002
Posts: 9
Location: france

PostPosted: Sun Jun 16, 2002 6:44 pm    Post subject: Reply with quote

just run this after emerge php mysql apache

ebuild /usr/portage/dev-lang/php/php-4.2.1-r1.ebuild config

and restart apache
/etc/init.d/apache stop
/etc/init.d/apache start

[/code]
_________________
---
dju
Linux counter !
Back to top
View user's profile Send private message
rasat
n00b
n00b


Joined: 30 May 2002
Posts: 74

PostPosted: Tue Jun 18, 2002 4:12 am    Post subject: Reply with quote

> ebuild /var/db/pkg/dev-lang/php-4.2.1-r1/php-4.2.1-r1.ebuild config

I did not run the command. Only followed the instructions of ViceClown to be sure to get php to work. To complete his instructions I have here described all the steps for a new apache/php/mysql user.

APACHE+MYSQL+PHP INSTRUCTIONS

1) Add 'mysql' and 'php' to the /etc/make.conf file (USE="mysql php")
Run in terminal....
2) emerge mysql
3) /usr/bin/mysql_install_db (to create database file in /var/lib/mysql)
4) emerge apache
5) emerge php

Check the /etc/apache/extramodules directory with libphp4.so in it.
Also check the /etc/apache/conf/addon-modules directory with mod_php.conf in it.

6) Check file /etc/hosts has hostname (this is my file):
127.0.0.1 localhost, rasat

7) Edit file /etc/apache/conf/apache.conf as such......
a) Enable ServerName localhost
b) In the LoadModule section add at the end:
LoadModule php4_module extramodules/libphp4.so
c) In the AddModule section add at the end:
AddModule mod_php4.c
d) At the end of the apache.conf file add:
Include /conf/addon-modules/mod_php.conf

Run in terminal....
8.) apachectl configtest (to see if your syntax is ok)
If it says mod_php.conf not found edit the line at the end in apache.conf:
Include /etc/apache/conf/addon-modules/mod_php.conf

9) apachectl restart
10) To boot startup mysql and apache, at the end of file /etc/conf.d/local.start add:
apachectl start
/etc/init.d/mysql start

Markku
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
Page 1 of 1

 
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