Компилиране и инсталиране на PHP 5.3 на Debian Lenny

Не е необходимо системата да бъде Debian Lenny просто тази в момента е такава(както и да е). Освен, че системата е на Debian Lenny, apache- 2.2 и mysql 5.1 . Преминавам по същество как да инсталираме php  5.3 🙂 :

Според моите изисквания отностно конфигурацията на PHP споделям следните options:

./configure –prefix=/usr –with-apxs2=/usr/sbin/apxs \
–with-mysql=/usr/local/mysql51/ \
–with-tidy=/usr \
–with-curl=/usr/bin \
–with-curlwrappers \
–with-openssl-dir=/usr \
–with-zlib-dir=/usr \
–with-xpm-dir=/usr \
–with-pdo-mysql=/usr \
–with-xsl=/usr \
–with-ldap \
–with-xmlrpc \
–with-iconv-dir=/usr \
–with-bz2=/usr \
–with-mcrypt=/usr \
–with-gd \
–with-jpeg-dir=/usr \
–with-png-dir=/usr \
–with-zlib-dir=/usr \
–with-freetype-dir=/usr \
–with-pear \
–with-imap \
–with-kerberos \
–with-imap-ssl \
–with-libedit \
-enable-exif \
-enable-mbstring \
-enable-calendar \
-enable-zip

При конфигурирането излязоха следните грешки, но хубавото, че това не са грешки, а зависимости които трябва да бъдат спазени. Следващото хубаво нещо е, че по- долу не само ще изброя зависимостите, а и как да бъдат изпълнени правилно:

Проблем: configure: error: xml2-config not found. Please check your libxml2 installation.
Решение: apt-get install libxml2-dev

Проблем: configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
Решение: apt-get install re2c

Проблем: configure: error: Please reinstall the BZip2 distribution
Решение: apt-get install libbz2-dev

Проблем: configure: error: Please reinstall the libcurl distribution – easy.h should be in <curl-dir>/include/curl/
Решение: Инсталиране на Curl от тук

Проблем: configure: error: libjpeg.(a|so) not found.
Решение: apt-get install libjpeg62-dev

Проблем: configure: error: libpng.(a|so) not found.
Решение: apt-get install libpng12-dev

Проблем: configure: error: libXpm.(a|so) not found.
Решение: apt-get install libxpm-dev

Проблем: configure: error: freetype.h not found.
Решение: apt-get install libfreetype6-dev

Проблем: configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
Решение: apt-get install libc-client-dev

Проблем: configure: error: Cannot find ldap.h
Решение: apt-get install libldap2-dev

Проблем: configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Решение: apt-get install libmcrypt-dev

Проблем: configure: error: edit library required by readline not found
Решение: apt-get install libedit-dev

Проблем: configure: error: SNMP sanity check failed. Please check config.log for more information.
Решение: apt-get install libsnmp-dev

Проблем: configure: error: Cannot find libtidy
Решение: apt-get install libtidy-dev

Проблем: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Решение: apt-get install libxslt1-dev

Проблем: checking for mcrypt support… yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Решение: apt-get install libmcrypt-dev

След това се изпълнява:

make && make install

Препоръчително е да изпълните преди „make install“ „make test“

Voila: Thank you for using PHP.

Необходимо е да активирате php5 модула в Apache 2.2 по- следния метод:

a2enmod php5
Enabling module php5.
Run ‘/etc/init.d/apache2 restart’ to activate new configuration!

/etc/init.d/apache2 restart

За малко да забравим да копираме php.ini в неговата директория 🙂

cp /tmp/php-5.3.0/php.ini-production /usr/lib/php.ini

Сега ще сетнем и подразбираща времева зона:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone =Europe/Sofia

Идеята е, че ако времевата зона на машината не е сетната правилно и от PHP извикате функция Date() ше ви изведе следната грешка:

Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/Sofia’ for ‘EEST/3.0/DST’ instead in /var/www/test1.php on line 2
2009-10-21

Рестартираме (не reload, а restart !) Apache2 за да влязат новите промени в действие.

Това е всичко. Вече имате последна стабилна версия на PHP 5.3

Други проблеми:

Проблем: Зареждате модула php и всичко се очаква да е наред, но Apache все още не php файловете не се изпълняват.
Решение: Трябва да се добави в конф. файл как да се употребяват *.php файловете /etc/apache2/httpd.conf :

<IfModule mime_module>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps

</IfModule>

Проблем: При php.ini с таговете определящи вашия php код.
Решение натиснете ТУК

PS: Много внимавайте при конфигурацията на PHP с използването на -enable , –with . Забележете, че „enable“ е с една чертичка отпред, а „with“ с две черти. Ако напишете „–enable“ (enable с две чертички) то това ще ви донесе неприятности в къщи 🙂

<IfModule mime_module>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
Категория:

Logged in as {{omniform_current_user_display_name}}. Edit your profile. Log out? Required fields are marked *

Your email address will not be published. Required fields are marked *

Comments are closed.

You must be logged in to post a comment.