CakeFest 2024: The Official CakePHP Conference

Debian GNU/Linux Kurulum Bilgileri

Bu bölüm Unix sistemlerde PHP'nin » Debian GNU/Linux kurulumu hakkında bilgiler ve ipuçları içerir.

Uyarı

Üçüncü partilerdeki resmi olmayan derlemeler burada desteklenmemektedir. » İndirme alanımızdaki en son paketi alıp aynı hatanın devam ettiğini görmedikçe Debian ekibine herhangi bir yazılım hatası raporlanmamalıdır.

PHP'nin Unix üzerinde derlenmesi ile ilgili talimatlar Debian için de geçerli olsa da bu kılavuz sayfasında ayrıca, hem apt hem de aptitude komutlarının kullanımı gibi diğer seçeneklere özgü bilgilere de yer verilmiştir. Bu kılavuz sayfasında bu iki komut kimi zaman diğerinin yerine kullanılmıştır.

APT kullanımı

Öncelikle dikkat edeceğiniz şey, Apache2 ile tümleştirmek için libapache-mod-php ve PEAR ile tümleştirmek için php-pear gibi PHP ile ilgili diğer paketlerinde gerekli olabileceğidir.

İkinci olarak, bir paketi kurmadan önce paket listesini güncellemeniz yerinde bir hareket olacaktır. Bu işlem genellikle apt update komutu çalıştırılarık yapılır.

Örnek 1 - Apache2 ile kurulum örneği

# apt install php5-common libapache2-mod-php5 php5-cli

APT, Apache2 için hazırlanmış PHP modülünü ve bu modülü etkinleştirmek için bağımlı olduğu diğer paketleri otomatik olarak kuracaktır. Yapılan değişikliğin geçerli olması için Apache2 yeniden başlatılmalıdır. Örnek:

Artık herşey yerli yerine oturduğuna göre aşağıdaki örneği izleyerek Apache ve PHP'yi kurabilirsiniz:

Örnek 2 - PHP kurulduktan sonra Apache2'nin dirdirilip yeniden başlatılması

# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start

Yapılandırma üzerinde daha iyi denetim

Bir önceki bölümde PHP sadece çekirdek modüllerle kurulmuştu. Çok geçmeden MySQL, cURL, GD ve benzeri modülleri etkinleştirme ihtiyacı duyabilirsiniz. Bunları da apt komutuyla kurabilirsiniz.

Örnek 3 - Ek PHP paketleri listesinin alınma yöntemleri

# apt-cache search php
# apt search php | grep -i mysql
# aptitude search php

Bu örnek komutların çıktısından da görebileceğiniz gibi, php-cgi, php-cli ve php-dev gibi özel paketlerde dahil olmak üzere kurabileceğiniz çok sayıda PHP modülü vardır. Listeyi dikkatlice inceleyip ihtiyacınız olanları seçtikten sonra apt veya aptitude ile bunları kurabilirsiniz. Debian bunlar içinde bağımlılık denetimleri yapacağından, örneğin MySQL ve cURL kurmak istediğinizde bunların bağımlı olduğu paketleri de kurmayı teklif edecektir:

Örnek 4 - MySQL ve cURL PHP modüllerinin kurulumu

# apt install php5-mysql php5-curl

APT otomatik olarak farklı php.ini (/etc/php/7.4/apache2/php.ini, /etc/php/7.4/conf.d/pdo.ini ve benzeri) dosyalarına uygun satırları ve eklentinin türüne bağlı olarak extension=foo.so benzeri girdileri ekleyecektir. Bu değişikliklerin de etkili olabilmesi için Apache2'nin yeniden başlatılması gerekir.

Bilinen sorunlar

  • Bir betiğin sonucu yerine betiğin PHP kaynak kodlarını görüyorsanız, Debian muhtemelen /etc/apache2/apache2.conf dosyasına (veya benzeri bir dosyaya) PHP ile ilgili satırları eklememiştir. Bu konu ile ilgili ayrıntılar için Debian kılavuzuna bakınız.
  • Eğer bir eklenti tanımlı gibi gözüktüğü halde işlevlerini kullanamıyorsanız ilgili ini dosyasının yüklendiğinden ve Apache2'nin yeniden başlatıldığından emin olmalısınız.
  • Debian üzerinde paket kurmak için kullanılabilecek iki temel komut vardır: apt ve aptitude. Bu iki komut arasındaki farklar için dağıtımınızla gelen belgelere bakınız.
add a note

User Contributed Notes 6 notes

up
67
thumbs at apache dot org
10 years ago
To refresh this document, perhaps it would be worth mentioning more modern methods to serve php content under apache httpd.

Specifically, the preferred method is now fastcgi, using either of those recipes:

(mod_fastcgi, httpd 2.2)
http://wiki.apache.org/httpd/php-fastcgi

(mod_fcgid, httpd 2.2)
http://wiki.apache.org/httpd/php-fcgid

(mod_proxy_fcgi, httpd 2.4)
http://wiki.apache.org/httpd/PHP-FPM

While the legacy mod_php approach is still applicable for some older installations, the fastcgi method is much faster, and require much less RAM to operate, based on similar traffic patterns.

Thank you!
up
41
kearney dot taaffe at gmail dot com
6 years ago
Compiling PHP on Ubuntu boxes.

If you would like to compile PHP from source as opposed to relying on package maintainers, here's a list of packages, and commands you can run

STEP 1:
sudo apt-get install autoconf build-essential curl libtool \
libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7 \
libreadline-dev libzip-dev libzip4 nginx openssl \
pkg-config zlib1g-dev

So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries to live

mkdir -p ~/bin/php7-latest/

STEP 2:
# download the latest PHP tarball, decompress it, then cd to the new directory.

STEP 3:
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))

./configure --prefix=$HOME/bin/php-latest \
--enable-mysqlnd \
--with-pdo-mysql \
--with-pdo-mysql=mysqlnd \
--with-pdo-pgsql=/usr/bin/pg_config \
--enable-bcmath \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--enable-mbstring \
--enable-phpdbg \
--enable-shmop \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-zip \
--with-libzip=/usr/lib/x86_64-linux-gnu \
--with-zlib \
--with-curl \
--with-pear \
--with-openssl \
--enable-pcntl \
--with-readline

STEP 4:
compile the binaries by typing: make

If no errors, install by typing: make install

STEP 5:
Copy the PHP.ini file to the install directory

cp php.ini-development ~/bin/php-latest/lib/

STEP 6:

cd ~/bin/php-latest/etc;
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf

STEP 7:
create symbolic links for your for your binary files

cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm

STEP 8: link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version

# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

STEP 9: Start PHP-FPM

sudo ~/bin/php7/sbin/php-fpm
up
-17
marin at sagovac dot com
10 years ago
To install LAMP stack on Ubuntu (+Server) from 10.04 you need first install taskel and then lamp-server for example:

Install taskel, follow terminal guides:
sudo apt-get install tasksel

Install LAMP stack package from Ubuntu repository:
sudo tasksel install lamp-server
up
-22
John Fisher
17 years ago
With Apache2 and Php4 under Debian Sarge there is an extra configuration file : /etc/apache2/sites-available/default
This file is not clearly documented, at least not for noobs, in Apache docs.

It overrides the conf file in the way you expect the /etc/apache2/conf.d/apache2-doc to do according to the README.

Add ExecCGI to it to get rid of "Options ExecCGI is off in this directory" errors.
up
-25
juraj at jurajsplayground dot com
14 years ago
On Ubuntu (since 7.04), rather do:
sudo tasksel install lamp-server

Details:
https://help.ubuntu.com/community/ApacheMySQLPHP
up
-40
tranzbit at yahoo dot com
14 years ago
On Ubuntu:

sudo apt-get install apache2 php5 mysql-client-5.0 mysql-server-5.0 phpmyadmin libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql

then restart the computer/start mysql manually
From:
http://ubuntuforums.org/showthread.php?t=186492
To Top