Visualizzazione post con etichetta php4 apache. Mostra tutti i post
Visualizzazione post con etichetta php4 apache. Mostra tutti i post

giovedì 7 febbraio 2008

[PHP.INI] register globals

In alcuni casi c'e' necessita' di settare la variabile register_globals di php, facendo delle ricerche in internet ho trovato alcune soluzioni ma solo questa che postero' mi ha risolto il problema.

Requisiti: SERVER LINUX
Web Server: APACHE

creare un file .htaccess
#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
#Options -Indexes

# Follow symbolic links in this directory.
#Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
#DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0


# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0


# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0


# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1


# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupal

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


creare successivamente un php.ini

register_globals = 0

martedì 5 febbraio 2008

Php 4.4.7 su Apache 2.2.8 su Windows XP Prof.

Ho perso 3 ore a trovare questa soluzione.
Il problema è che php 4.4.7 non è compatibile con Apache 2.2 e per farlo funzionare bisogna applicare una patch.
I passi da seguire sono i seguenti:

1. Installare Apache 2.2.8

2. Installare Php 4.4.7 in C:\Php-4.4.7

3. Aggiungere al path di sistema il percorso C:\Php-4.4.7

4. Copiare C:\Php-4.4.7\php.ini-dist in C:\Php-4.4.7\php.ini

5. Modificare il php.ini nei seguenti punti (a me serve anche che funzioni per IIS):
doc_root = "C:\Inetpub\wwwroot"
extension_dir = "C:\php-4.4.7\extensions"
cgi.force_redirect = 0
extension=php_mbstring.dll
extension=php_gd2.dll
session.save_path = "C:\windows\temp"

6. Modificare il file C:\Programmi\Apache Software Foundation\Apache2.2\conf\httpd.conf aggiungendo alla fine queste righe:
PHPIniDir C:/php-4.4.7/
LoadModule php4_module C:/php-4.4.7/sapi/php4apache2.dll
AddType application/x-httpd-php .php

7. Scaricare dal sito http://www.apachelounge.com/download/ il file php4apache2.dll-php4.4.x.zip

8. Aprire il file zip php4apache2.dll-php4.4.x.zip ed estrarre il file httpd.exe.manifest nella cartella C:\Programmi\Apache Software Foundation\Apache2.2\bin

9. Sempre dal file php4apache2.dll-php4.4.x.zip estrarre il file php4apache2.dll nella cartella C:/php-4.4.7/sapi/ dando conferma alla richiesta di sovrascrittura.

10. Nel mio caso non c'era bisogno ma può essere che a questo punto vi manchi solamente di installare il "Visual C++ 2005 SP1 Redistributable Package".
11. Riavviate apache e tutto dovrebbe funzionare

Buon lavoro