Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

hinom

Instalação PHP no Red Hat Linux 9

Recommended Posts

Step 1 - Verifique por bibliotecas pré-instaladas

 

Antes de compilar um biblioteca, verifique se o sistema possui algum pacote instalado

 

escopo

rpm -qa | grep -i [library]

exemplo

rpm -qa | grep -i libxml2

retornará uma lista contendo nomes de pacotes RPM instalados

copie a lista de nomes e remova-os

 

escopo

rpm -ev --nodeps [library name]

exemplo

rpm -ev --nodeps libxml2-2.5.4-3.rh9
rpm -ev --nodeps libxml2-python-2.5.4-3.rh9
rpm -ev --nodeps libxml2-devel-2.5.4-3.rh9

 

obs: os exemplos acima referem-se à biblioteca LibXML2

 

 

Step 2 - Instalação dos pacotes

 

LIBXML2 v2.6.16
	cd /usr/src/redhat/RPMS
	wget ftp://rpmfind.net/linux/dag/redhat/9/en/i386/dag/RPMS/libxml2-2.6.16-1.0.rh9.rf.i386.rpm
	rpm -Uvh libxml2-2.6.16-1.0.rh9.rf.i386.rpm

LIBXML2-DEVEL v2.6.16
	cd /usr/src/redhat/RPMS
	wget ftp://rpmfind.net/linux/dag/redhat/9/en/i386/dag/RPMS/libxml2-devel-2.6.16-1.0.rh9.rf.i386.rpm
	rpm -Uvh libxml2-devel-2.6.16-1.0.rh9.rf.i386.rpm

LIBXML2-Python v2.6.16
	cd /usr/src/redhat/RPMS
	wget ftp://rpmfind.net/linux/dag/redhat/9/en/i386/dag/RPMS/libxml2-python-2.6.16-1.0.rh9.rf.i386.rpm
	rpm -Uvh libxml2-python-2.6.16-1.0.rh9.rf.i386.rpm

LIB FREETYPE 2.3.7
	cd /usr/src/redhat/SOURCES
	wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.7.tar.gz
	tar -xzf freetype-2.3.7.tar.gz
	cd /usr/src/redhat/SOURCES/freetype-2.3.7
	./configure --with-pic CC= CFLAGS="-O2"
	make && make install

LIBJPEG 6b
	cd /usr/src/redhat/SOURCES
	wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
	tar -xzf jpegsrc.v6b.tar.gz
	cd /usr/src/redhat/SOURCES/jpeg-6b
	./configure --prefix=/usr --enable-static --enable-shared &&
	make && make install

LIBPNG 1.2.33
	cd /usr/src/redhat/SOURCES
	wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.33.tar.gz
	tar -xzf libpng-1.2.33.tar.gz
	cd /usr/src/redhat/SOURCES/libpng-1.2.33
	./configure
	make && make install

LIB ZLIB 1.2.3
	cd /usr/src/redhat/SOURCES
	wget http://jaist.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz
	tar -xzf zlib-1.2.3.tar.gz
	cd /usr/src/redhat/SOURCES/zlib-1.2.3
	./configure
	make && make install

	[BUG]
		http://bugs.php.net/bug.php?id=34338&edit=1

		PHP Notice:  getimagesize(): The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled in Command line code on line 1
		bool(false)
		
		solution
		./configure --disable-static --enable-shared



LIB ZZIPLIB 0.10.82
	cd /usr/src/redhat/RPMS
	wget http://nchc.dl.sourceforge.net/sourceforge/zziplib/zziplib-0.10.82-1mdk.src.rpm
	rpm -Uvh zziplib-0.10.82-1mdk.src.rpm

LIBGD 2.0.36RC1
	cd /usr/src/redhat/SOURCES
	wget http://www.libgd.org/releases/gd-2.0.36RC1.tar.gz
	tar -xzf gd-2.0.36RC1.tar.gz
	cd /usr/src/redhat/SOURCES/gd-2.0.36RC1
	./configure --with-jpeg-dir==/usr/lib/ --with-png-dir==/usr/local/lib/ --with-freetype-dir==/usr/local/lib/
	make && make install WITH_XPM=yes WITHOUT_X11=yes

LIB OPENSSH 0.9.8i

	rpm -qa | grep -i openssl
	rpm -ev --nodeps qloc-openssl-0.9.7a-5.9.x
	rpm -ev --nodeps pyOpenSSL-0.5.1-8

	cd /usr/src/redhat/SOURCES/
	wget http://www.openssl.org/source/openssl-0.9.8i.tar.gz
	tar -xzf openssl-0.9.8i.tar.gz
	cd /usr/src/redhat/SOURCES/openssl-0.9.8i
	./configure [se der erro, ignorar e fazer o make]
	make && make install

LIB IMAP 2001a-18
	cd /usr/src/redhat/RPMS
	wget ftp://rpmfind.net/linux/redhat/9/en/os/i386/RedHat/RPMS/imap-2001a-18.i386.rpm
	rpm -Uvh imap-2001a-18.i386.rpm
	wget ftp://rpmfind.net/linux/redhat/9/en/os/i386/RedHat/RPMS/imap-devel-2001a-18.i386.rpm
	rpm -Uvh imap-devel-2001a-18.i386.rpm

LIB CURL
	cd /usr/src/redhat/SOURCES/
	wget http://curl.haxx.se/download/curl-7.19.2.tar.gz
	tar -xzf curl-7.19.2.tar.gz
	cd /usr/src/redhat/SOURCES/curl-7.19.2
	./configure --with-ssl=/usr/local/ssl
	make && make install

Compartilhar este post


Link para o post
Compartilhar em outros sites

Step 3 - Remover os pacotes PHP RPM pré-instalados

 

exibe lista de pacotes contendo a palavra "php"

rpm -qa | grep -i php

removendo pacotes encontrados

rpm -ev --nodeps php-4.2.2-17
	rpm -ev --nodeps php-ldap-4.2.2-17
	rpm -ev --nodeps php-odbc-4.2.2-17
	rpm -ev --nodeps php-imap-4.2.2-17
	rpm -ev --nodeps php-pgsql-4.2.2-17
	rpm -ev --nodeps qloc-php-4.2.2-17.2.9.x

 

 

Step 4 - Compilar os sources PHP

 

cd /usr/src/redhat/SOURCES
	wget http://jp.php.net/get/php-5.2.6.tar.gz/from/this/mirror
	tar -xzf php-5.2.6.tar.gz
	cd /usr/src/redhat/SOURCES/php-5.2.6
	./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/var/lib/mysql --with-mysqli=shared --enable-mbstring --with-mime-magic --enable-sockets --enable-soap --enable-ftp --with-zlib --with-gettext --with-openssl=/usr/local/ssl --with-imap --with-imap-ssl=/usr/local/ssl/lib --with-kerberos --with-curl=/usr/local/lib --with-curlwrappers --with-gd --with-jpeg-dir==/usr/lib/ --with-png-dir==/usr/local/lib/ --with-freetype-dir==/usr/local/lib/
	make && make install
	make test [optional]

 

Step 5 - Diretórios temporários

Pasta para arquivos temporário de upload

mkdir /tmp/phpuploaddata
	chmod 0777 /tmp/phpuploaddata

Pasta para arquivos temporário de variáveis de sessão

mkdir /tmp/phpsessiondata
	chmod 0777 /tmp/phpsessiondata

 

 

Step 6 - PHP extension_dir

Exibe diretório do extension_dir do PHP ( importante para informar no php.ini )

pear config-show | grep ext_dir

Compartilhar este post


Link para o post
Compartilhar em outros sites

Step 7 - Apache httpd.conf

 

 

ServerRoot "/usr/local/apache"
Listen 80

ServerAdmin webmaster@foo.bar
ServerName 123.456.789.00
#DocumentRoot "/usr/local/apache/htdocs"
DocumentRoot "/www"

ErrorDocument 404 /404/
AccessFileName .htaccess

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
	User daemon
	Group daemon
</IfModule>
</IfModule>

<Directory />
	#Options Indexes FollowSymLinks
	Options None
	AllowOverride None
	Order deny,allow
	Deny from all
</Directory>


#<Directory "/usr/local/apache/htdocs">
<Directory "/www">
	#Options Indexes FollowSymLinks
	Options None
	AllowOverride None
	Order allow,deny
	Allow from all
</Directory>

<IfModule dir_module>
	DirectoryIndex index.html
</IfModule>

<FilesMatch "^\.ht">
	Order allow,deny
	Deny from all
	Satisfy All
</FilesMatch>

ErrorLog "logs/error_log"

# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn

#LoadModule log_config_module modules/mod_log_config.so
<IfModule log_config_module>

	LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
	LogFormat "%h %l %u %t \"%r\" %>s %b" common

	<IfModule logio_module>
	  # You need to enable mod_logio.c to use %I and %O
	  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
	</IfModule>

	CustomLog "logs/access_log" common

</IfModule>

<IfModule alias_module>
	ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"
</IfModule>

<Directory "/usr/local/apache/cgi-bin">
	AllowOverride None
	Options None
	Order allow,deny
	Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>

	TypesConfig conf/mime.types

	AddType application/x-compress .Z
	AddType application/x-gzip .gz .tgz

</IfModule>

#EnableMMAP off
#EnableSendfile off

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


# Virtual hosts

NameVirtualHost www.foo.bar

Include /www/site1.foobar/httpd/host.conf

Compartilhar este post


Link para o post
Compartilhar em outros sites

Step 8 - Exemplo de configuração para "/www/site1.foobar/httpd/host.conf"

 

<VirtualHost www.site1.foo.bar>

	ServerAdmin info@site1.foo.bar
	DocumentRoot "/www/site1.foo.bar/public_html"
	ServerName www.site1.foo.bar
	ServerAlias site1.foo.bar

	AccessFileName .htaccess

	ErrorDocument 401 "/401/"
	ErrorDocument 403 "/403/"
	ErrorDocument 404 "/404/"

	LoadModule php5_module		modules/libphp5.so
	AddType application/x-httpd-php .php
	AddType application/x-httpd-php-source .phps

	LogLevel warn
	ErrorLog "/www/site1.foo.bar/httpd/log_error"
	#CustomLog "/www/site1.foo.bar/httpd/log_acces" common

	<Directory "/www/site1.foo.bar/public_html">
		Options Indexes
		AllowOverride AuthConfig
		Order allow,deny
		Allow from all

		DirectoryIndex index.php index.html

		php_admin_value open_basedir ".:/www/site1.foo.bar/private_folder/"
		php_admin_value include_path ".:/www/site1.foo.bar/private_folder/:/usr/local/lib/php/"
		php_admin_value expose_php Off
	</Directory>

</VirtualHost>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.