PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Caudium> <Telepítés Unix rendszerre
Last updated: Sun, 25 Nov 2007

view this page in

Apache 2.0 Unix rendszereken

Ez a rész a PHP Apache 2.0-hoz történő telepítéséhez tartalmaz megjegyzéseket és javaslatokat Unix rendszerek esetén.

Warning

Nem ajánljuk az Apache2 threaded MPM-jének alkalmazását éles környezetben. Ehelyett a prefork MPM használata, vagy az Apache 1.3-as változatának használata javallott. Ha kíváncsi vagy a miértekre, olvasd el a kapcsolódó FAQ bejegyzést: Apache2 with a threaded MPM!

Erősen ajánljuk, hogy tanulmányozd az » Apache dokumentációt, hogy alapvelően megértsd az Apache 2.0 Server működését.

Note: PHP és Apache 2.0.x kompatibilitása A PHP alábbi verziói biztosan működnek az Apache 2.0.x legújabb verziójával:

A PHP ezen verziói kompatibilisek az Apache 2.0.40-ás és későbbi verzióival.
Az Apache 2.0 SAPI-támogatása a PHP 4.2.0-ás verziójával kezdődött. A PHP 4.2.3 az Apache 2.0.39-el működik, ne használj más Apache verziót vele. Az ajánlott konfiguráció: PHP 4.3.0 vagy frissebb, és az Apache2 legfrissebb verziója.
A PHP minden említett verziója továbbra is működik az Apache 1.3.x verziójával.

Töltsd le az » Apache 2.0 legűjabb verzióját és a PHP-nek egy megfelelő verzióját a fent említett helyekről. Ez a gyors útmutató csak az alapokat tartalmazza az Apache 2.0 és a PHP használatával kapcsolatban. További információért olvasd el az » Apache dokumentációt. A verziószámokat itt elhanyagoltuk, hogy bizonyosak legyünk abban, hogy az utasítások nem helytelenek. Az 'NN' helyébe a fájlok neveiből származó megfelelő értékeket kell majd behelyettesítened.

Example#1 Telepítési parancsok (Apache osztott modul verzió) PHP-hez

1.  gzip -d httpd-2_0_NN.tar.gz
2.  tar xvf httpd-2_0_NN.tar
3.  gunzip php-NN.tar.gz
4.  tar -xvf php-NN.tar
5.  cd httpd-2_0_NN
6.  ./configure --enable-so
7.  make
8.  make install

    Most az Apache 2.0.NN rendelkezésedre áll a /usr/local/apache2
    könyvtárban, modul betöltés támogatással, és a standard MPM 
    prefork-al. A telepítés teszteléséhez használd a normális 
    eljárást az Apache szerver elindítására, azaz:
    /usr/local/apache2/bin/apachectl start
    majd állítsd le, hogy folytathasd a PHP konfigurálásval:
    /usr/local/apache2/bin/apachectl stop.

9.  cd ../php-NN

10. Itt konfigurálnod kell a PHP-t. Itt kell testreszabnod a PHP-t
    különféle opciókkal, mint pl. milyen kiterjesztések legyenek 
    bekapcsolva. Hajts végre egy ./configure --help parancsot, hogy
    megkapd a használható opciók listáját. Példánkban egy egyszerű
    konfigurációt készítünk Apache 2 és MySQL támogatással.
    Az apxs űtvonala különbözhet, valójában előfordulhat, hogy a
    bináris neve apxs2.
    
      ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql

11. make
12. make install

    Ha a configure opciókat telepítés után szeretnéd megváltoztatni,
    csak az utolsó három parancsot kell újra kiadnod. Az új modul
    betöltéséhez, csak újra kell indítanod az Apache-t. Az Apache
    újrafordítása nem szükséges.
  
    Figyelj arra, hogy alapesetben a 'make install' a PEAR-t, 
    különböző PHP eszközöket, mint pl. phpize, a PHP CLI-t és egyebeket
    is telepít.

13. A php.ini állomány beállítása:

      cp php.ini-dist /usr/local/lib/php.ini

    PHP opciók beállításához szerkeszd az .ini fájlt. Ha szeretnéd a 
    php.ini-t máshova tenni, a 10. lépésben használd a 
    --with-config-file-path=/ut/vonal
    
    Ha a php.ini-recommended fájlt választod, ne felejtsd el elolvasni
    a változtatások listáját, mivel az befolyásolhatja a PHP működését.

14. Módosítsd a httpd.conf állommányt úgy, hogy a PHP modult töltse be.
    A LoadModule jobb oldalán szereplő útvonal a rendszereden lévő
    PHP modul útvonala kell legyen. A fenti make install parancs már
    el kellett végezze ezt helyetted, de jobb ha megbizonyosodsz róla.
        
    PHP 4 esetén:
            
      LoadModule php4_module libexec/libphp4.so

    PHP 5 esetén:
                      
      LoadModule php5_module libexec/libphp5.so
 
15. Meg kell mondani az Apache-nak, hogy bizonyos kiterjesztéssel
    rendelkező fájlokat a PHP-vel szerint értelmezzen. Például
    mondjuk meg az Apache-nak, hogy a .php fájlokat PHP-vel 
    interpretálja. Több kiterjesztést úgy adhatsz meg, hogy
    egyszerűen szóközzel választod el őket. Példaképpen itt még
    a .phtml-t adjuk meg.

      AddType application/x-httpd-php .php .phtml

    Elég népszerű, hogy a .phps kiterjesztést úgy állítják be, hogy
    a színezett PHP-t mutassa, ez így érhető el:
    
      AddType application/x-httpd-php-source .phps

16. Használd a normális eljárást az Apache szerver elindítására, azaz:
   
      /usr/local/apache2/bin/apachectl start
   

A fenti lépések végrehajtása után, rendelkezel egy futó Apache 2.0-al, amely támogatja a PHP-t SAPI modulként. Természetesen sokkal több konfigurációs opció létezik mind az Apache-hoz, mind a PHP-hez. További információért használd a ./configure --help parancsot a megfelelő forrásfában. Ha szeretnél egy többszálú Apache 2.0 verziót fordítani, felül kell írnod a standard MPM-Module prefork-ot worker-el vagy perchild-al. Ehhez, a 6. sorban szereplő configure-hoz add hozzá a --with-mpm=worker vagy a --with-mpm=perchild opciót. Bizonyosodj meg a következményekről és arról, hogy tudod mit csinálsz. További információért olvasd el az Apache dokumentáció » MPM-Modules című részét.

Note: Ha szeretnél tartalom-egyeztetést (content negotiation) alkalmazni, olvasd el a kapcsolódó FAQ-t.

Note: Ahhoz, hogy többszálú Apache verziót tudj készíteni, az operációs rendszered kell támogassa a szálakat. Ez a PHP-nak a kisérleti jellegű Zend Thread Safety (ZTS)-vel való fordítására is vonatkozik. Emiatt nem lesz használható minden kiterjesztés. Ajánlott az Apache-nak a standard prefork MPM-modullal való fordítása.



Caudium> <Telepítés Unix rendszerre
Last updated: Sun, 25 Nov 2007
 
add a note add a note User Contributed Notes
Apache 2.0 Unix rendszereken
METOC
24-Aug-2008 04:03
Had the same problem with Apache 2.2.9 and PHP 5.2.6 on Solaris 9.. The "Make Clean" fix worked for me as well.
nabil at world dot com
23-May-2008 07:27
I couldn't start Apache2 after installing PHP5 in archlinux, I got this error :

Cannot load /.../libphp5.so into server: /.../libphp5.so: undefined symbol: _efree

The solution was "make clean" on the PHP5 source directory, then ./configure, make & make install again.
packard_bell_nec at hotmail dot com
27-Oct-2007 04:08
If you install PHP as an Apache module, you can consider the following. Instead of adding:
application/x-httpd-php    php
application/x-httpd-php-source    phps
into Apache mime.types, you can add:
AddType application/x-httpd-php    .php
AddType application/x-httpd-php-source    .phps
into Apache httpd.conf, OR you can add:
AddHandler application/x-httpd-php    .php
AddHandler application/x-httpd-php-source    .phps
into Apache httpd.conf. The last one is the preferred way of configuration, but it does not work in previous Apache versions.
stoopbrain
21-Oct-2006 02:30
Following on from Chris' comment (22-Sept-2006), my RHEL4 PHP4 rpm added a php.conf file at:
/etc/httpd/conf.d/php.conf

This was referenced in the httpd.conf by it's Include directive:
Include conf.d/*.conf
chris@gerlt -dot- net
22-Sep-2006 06:33
Install issues on Redhat, specifically RHEL4 with php4 already installed: 

I discovered that there was an issue caused by redhat loading php4 in another file seperate from the httpd.conf file!  This took me hours to discover.  Make sure you know if the apache config file (httpd.conf) is loading configurations from a directory (or another file(s)) as well.  If so, look in there for any php module loading which could conflict with the new module you are compiling/installing.
susie91
27-Aug-2006 08:34
for slackware 10.2 users with apache2, mysql5, and trying to install php5:

when following the directions above, after this step:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql

i kept getting this error:
"Unable to find MySql header files...."

the only way i could get php5 with mysql support was to compile MySql5 from source, and not use the binary as the mysql site recommends.

then i was able to ./configure successfully, but for some reason php was configured to compile the CGI version.

so, had to use this ./configure line:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql  --disable-cgi

alternatively, you could install php4 which does bundle the MySql client files.
jaya
05-Jul-2006 11:41
PHP 5.1.4 INSTALLATION on Solaris 9 (Sparc)

Solaris9 Packages Installed:

Verify required package installation:
root# pkginfo SUNWbtool SUNWsprot SUNWtoo SUNWhea SUNWarc \
SUNWlibm SUNWlibms SUNWdfbh SUNWxglh SUNWcg6h

Uninstall Default Apache Packages:
root# /etc/init.d/apache stop
root# pkginfo |grep Apache
root# pkgrm SUNWaclg SUNWapchd SUNWapchr SUNWapchu

Create installation Directory:
root# mkdir /phpdata/

Download Required Packages from Sunfreeware:

Install libiconv-1.8 and gcc3.3.2 packages
root# pkgadd -d ./libiconv-1.8-sol9-sparc-local
root# pkgadd -d ./gcc-3.3.2-sol9-sparc-local

set LD_LIBRARY_PATH, CC and PATH variables
root# LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/sparcv9/:\
/usr/lib:/usr/openwin/lib:/opt/local/lib:/usr/local/ssl/lib:\
/usr/local/apr/lib:/opt/mysql/mysql/lib
root# CC=gcc
root# PATH=$PATH:/usr/ucb:/usr/local/bin/
root# export LD_LIBRARY_PATH CC PATH
 
Install apr-1.2.2 and aprutil-1.2.2 packages

root# gzcat apr-1.2.2.tar.gz |tar xvf -
root# cd apr-1.2.2
root# ./configure
root# make
root# make install
root# cd ..

root# gzcat aprutil-1.2.2.tar.gz |tar xvf -
root# cd apr-util-1.2.2/
root# ./configure --with-apr=/usr/local/apr/
root# make
root# make install

Install gawk-3.1.4, expat-1.95.5, db-4.2.52.NC,
gdbm-1.8.3, libgcc-3.3 and libxml2-2.6.16 packages
root# cd ..
root# pkgadd -d ./gawk-3.1.4-sol9-sparc-local
root# pkgadd -d ./expat-1.95.5-sol9-sparc-local
root# pkgadd -d ./db-4.2.52.NC-sol9-sparc-local
root# pkgadd -d ./gdbm-1.8.3-sol9-sparc-local
root# pkgadd -d ./libgcc-3.3-sol9-sparc-local
root# pkgadd -d ./libxml2-2.6.16-sol9-sparc-local

Install GNU make package
root# gzcat make-3.81.tar.gz |tar xvf -
root# cd make-3.81
root# ./configure
root# make
root# make install
root# cd ..

Install mysql-standard-5.0.22 package
Search for user mysql
root# grep mysql /etc/passwd
root# grep mysql /etc/group

If not found create user and group mysql
root# groupadd mysql
root# useradd -G mysql mysql
root# pkgadd -d ./mysql-standard-5.0.22-solaris9-sparc.pkg.gz

Install openssl-0.9.7g package
root# gzcat openssl-0.9.7g.tar.gz |tar xvf -
root# cd openssl-0.9.7g
root# ./config shared
root# make
root# make install
root# cd ..

Install Apache2 package
root# gzcat httpd-2.2.0.tar.gz |tar xvf -
root# cd httpd-2.2.0
root# ./configure --enable-so
root# /usr/local/bin/make
root# /usr/local/bin/make install
root# cd ..

Install php-5.1.4 package
root# gzcat php-5.1.4.tar.gz |tar xvf -
root# cd php-5.1.4
root# ./configure --with-apxs2=/usr/local/apache2/bin/apxs\
--with-ldap --with-mysql=/opt/mysql/mysql/
root# /usr/local/bin/make
root# /usr/local/bin/make install
root# cp php.ini-dist /usr/local/lib/php.ini

Edit httpd.conf to load the PHP module
and to parse certain extensions as PHP
root# vi /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml

Start Apache
root# /usr/local/apache2/bin/apachectl start
 
Add environmental variables below HTTPD
root# vi /usr/local/apache2/bin/apachectl
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/sparcv9/:
/usr/lib:/usr/openwin/lib:/opt/local/lib:/usr/local/ssl/lib:
/usr/local/apr/lib:/opt/mysql/mysql/lib
PATH=/bin:/sbin:/usr/ccs/bin:/usr/sbin:/usr/openwin/bin:\
/usr/ucb:/usr/local/bin/
export LD_LIBRARY_PATH PATH

Create Apache Startup Script
pillepop2003 at yahoo dot de
19-Apr-2006 09:18
For unix (especially opensuse 10.0) you can find bison and flex here:

ftp.gnu.org/non-gnu/flex
ftp.gnu.org/pub/gnu/bison

Peace ;-)
felixcca at yahoo dot ca
29-Mar-2006 06:13
I've (painfully) discovered that installing PHP5 with "make install" under SuSe 9.2 is NOT a good idea.
http://www.aditus.nu/jpgraph/apache2suse.php
This page explains how to install it without breaking everything that's php-related in the Apache2 configuration. Its first purpose, though, is to show how to have php 4 and 5 to cohabit properly.
frank@ethisoft
28-Sep-2005 02:30
Using Apache2 & PHP5 work perfectly fine & safe together.
- all core modules are safe in Zend Engine 2
- third-party-libraries should be avoided
- semaphores and shared memory enables you to ensure yourself that your application/website is thread-safe also with non-thread-safe PHP modules!
happyboy at php dot org
03-Aug-2005 04:30
FILE TRUNCATED!!

during the make process should u receive an error declaring ext/ctype/ctype.lo (or another file) is truncated then you need to 'make clean' prior to a healthy 'make' and 'make install.'

looking into your ext/ directory you may find the offensive file to be 1 byte long.
mihai dot sandu at gtstelecom dot ro
28-Feb-2005 05:22
For the SuSE9.2 install of PHP5.
First:
If building on a x64 platform, please set LDFLAGS="-L/usr/lib64" before configure.
As for install, it suffices to go to /etc/apache2 and:
ln -s sysconfig.d/loadmodule.conf httpd2-prefork.conf
and then make install
neil
10-Feb-2005 02:21
To install mysql and mysqli with PHP5 do the following:

after doing:

./configure --with-mysql=/path/to/mysql_config --with-mysqli=/path/to/mysql_config

do this:

"
    if you want to use both the old mysql and the new mysqli interface, load the Makefile into your editor and search for the line beginning with EXTRA_LIBS; it includes -lmysqlclient twice; remove the second instance
"

then you can:

make
make install

.....
Pleasse note: you must have mysql-dev installed (RPM or source) or you will not have the mysql_config file at all.  The standard, server, and client installations of MySQL do not include it.  I read somewhere that the mysql and mysqli paths must be identical.

Quoted from Michael Kofler at the following link:
http://www.kofler.cc/forum/forumthread.php?rootID=3571
Dan Scott (dan dot scott at acm dot org)
19-Jan-2005 08:36
Building PHP 5.x with Apache2 on SuSE Professional 9.1/9.2

SuSE uses a rather fragmented set of Apache configuration files stored in /etc/apache2/. When you configure PHP 5.x with:

$ ./configure --with-apxs2=/usr/sbin/apxs2
$ make

everything builds just fine; but when you issue:
$ su -c "make install"

the unconventional Apache conf file layout confuses the install-sapi section of the Makefile and the process halts with the following error:

apxs:Error: Config file /etc/apache2/httpd2-prefork.conf not found.
make: *** [install-sapi] Error 1

At this point only the PHP SAPI library has been copied into place; the rest of the files (like PEAR scripts, PHP-CLI, etc) have not been installed. But never fear! You can overcome this problem with the following steps:

1. Edit Makefile and change the following line to remove "install-sapi":
install_targets = install-sapi install-cli install-pear install-build install-headers install-programs

2. Issue the make install command again:
$ su -c "make install"

3. Add the PHP module & type instructions to the Apache configuration. As root, create a new file, /etc/apache2/conf.d/php5.conf that contains the following lines:

LoadModule php5_module /usr/lib/apache2/libphp5.so
AddType application/x-httpd-php php

--- And that's it. Everything else is just as the documentation suggests it should be.
praveen dot k at masconit dot com
15-Nov-2004 01:38
Hi too had same problem with multiview like when i execute http://huey/admin/test.php it used to compile but when i use http://huey/admin/test it wouldnt recognise it as php file... i worked it out with the addhandler method and AddType in different line and setting multiview for directive

"multiviews Options Indexes FollowSymLinks MultiViews"

the directives u can set it to root directory so now when u type pn test it will search in precendence for test.php, test.html if any .....

its working for me with apache2.0.47 and php 4.3.9 on solaris

praveen
nospam-1 at spam dot matt dot blissett dot me dot uk
30-Sep-2004 03:52
If you're trying to get PHP and Multiviews to work properly, try this page:
http://tranchant.plus.com/notes/multiviews

(In brief, a request for the URL http://example.net/thing, where there are possible matches thing.php and thing.pdf, returns a 406 with many browsers because of the application/x-httpd-php MIME type set above. The link above gives a better method for using php, instead using these directives:
AddHandler php5-script php [or php-script for php4]
AddType text/html php
For more info see the link.)

Caudium> <Telepítés Unix rendszerre
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites