שינמוך גרסת PHP

הסבר כיצד משנים את גרסת ה-PHP מ-5.3 אל 5.2 בלינוקס אובונטו.

בגרסת 5.3 ומעלה של PHP יש המון דברים טובים, אבל יש עדיין לא מעט תוכנות שדורשות רק php 5.2.x – כמו למשל דרופל 6 הפופולרית או תוכנות וסקריפטים אחרים שמשתבשים עם php 5.3 ומעלה.

מהסיבות האלו לפעמים אנו צריכים לשנמך את גרסת ה-PHP. איך עושים את זה? אם יש לכם שרת פיתוח מבוסס אובונטו, זה פשוט וקל. באופן עקרוני אנו משנים את המקור שממנו נלקחת גרסת ה-PHP ושאר הספריות שלה לubuntu karmic ואז 'משדרגים' את גרסת ה-PHP.

על מנת לבדוק איזו גרסת PHP מותקנת לנו, כל מה שעלינו לעשות זה להקליד php -v בקונסולה, ואז תוצג בפנינו גרסת ה-PHP שמותקנת על השרת.

ראשית אנו ניצור קובץ שבו יוגדרו העדפות ההעתקה שלנו:


sudo nano /etc/apt/sources.list.d/karmic.list

נעתיק את הטקסט הבא אל הקובץ:


# deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release amd64 (20100429)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu karmic partner
# deb-src http://archive.canonical.com/ubuntu karmic partner

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse

אחרי כן נשמור ונסגור. ניצור את הקובץ הבא:


/etc/apt/preferences.d/php

ונכניס לתוכו את התוכן הזה:


Package: php5
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991

Package: php5-common
Pin: release a=karmic
Pin-Priority: 991

Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991


Package: php5-pear
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xsl
Pin: release a=karmic
Pin-Priority: 991


Package: php-pear
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991

Package: php5-memcache
Pin: release a=karmic
Pin-Priority: 991

Package: php5-pgsql
Pin: release a=karmic
Pin-Priority: 991

Package: php-apc
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xmlrpc
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imagick
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imap
Pin: release a=karmic
Pin-Priority: 991

Package: libmagickcore2
Pin: release a=karmic
Pin-Priority: 991

Package: libgraphviz4
Pin: release a=karmic
Pin-Priority: 991

Package: imagemagick
Pin: release a=karmic
Pin-Priority: 991

Package: libmagickwand2
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xdebug
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dev
Pin: release a=karmic
Pin-Priority: 991

השלב הקשה מאחורינו! עכשיו כל מה שנותר לעשות זה


sudo apt-get update

ואז התקנה מחדש של חבילות ה-PHP הרלוונטיות:


sudo apt-get install php5 php5-dev php5-curl php5-gd php5-xdebug php-pear php5-cli php5-common libapache2-mod-php5 php5-mysql php5-mcrypt php5-imagick php5-imap libmagickcore2 libgraphviz4

כל מה שנותר הוא לבצע ריסטרט ל-Apache:


sudo /etc/init.d/apache2 reload

ואז לבדוק ולראות שהגרסה עודכנה ל PHP 5.2.

פוסטים נוספים שכדאי לקרוא

פיתוח ב-JavaScript

Axios interceptors

תכנון נכון של קריאות AJAX באפליקציה ריאקטית וניהול השגיאות או ההצלחות עם פיצ׳ר נחמד של axios

פתרונות ומאמרים על פיתוח אינטרנט

רינדור של קליינט סייד עם SSR

הסבר קצר על SSR מול רינדור קלאסי ולא. לא תמיד זה טוב להשתמש בו. אין כדור כסף שיכול לפתור הכל.

פתרונות ומאמרים על פיתוח אינטרנט

נגישות טכנית – פודקאסט ומבוא

פרק בפודקאסטעל נגישות בעברית שצולל לכלים האוטומטיים ולפן המאד מאד טכני של הנגישות.

תמונה מצוירת של רובוט שמנקה HTML
יסודות בתכנות

סניטציה – למה זה חשוב

הסבר על טכניקה פשוטה וידועה מאד שאנו מפעילים על מידע לפני שאנחנו מציגים אותו ב-HTML באפליקציה או באתר.

גלילה לראש העמוד