Jump to content
php.lv forumi

php- treninjam


Recommended Posts

  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

aizej uz php.net novelc php instalaaciju

aizej uz httpd.apache.org un novecl webservera instalaaciju

sinstalaa, sakonfiguree un njemies, kameer nelabi paliek.

 

aa bija kautkaadi tuulji, kas uzreiz uzinstaleejot vienu tuuli bez nekaadas instalaacijas aiziet, bet tas tikai uz windowsa. par linuxu neko taadu neesmu dzirdeejis.

Link to comment
Share on other sites

Pierakstiiju, kad pats dariiju un cerams, ka viss te kaartiibaa. Uzrakstiiju tik leimi, lai katram buutu katrs siikums skaidrs. Ceru, ka kaadam arii noderees... Nu vieniigi man luugums kaadam pro, lai pieraksta php un apache kompilaacijas parametrus smukaakus un pilnveertiigaakus!

 

 

Install Linux + Apache + MySQL + PHP = LAMP
----------------------------------------------
*INFO
Shiis komandas un instaleeshana buutu jaaveic tieshi taadaa seciibaa kaadaa tas ir uzrakstiits, lai piemeeram php vareetu konfigureet jau ar parametriem, kuros noraada uz mysql.
----------------------------------------------
*Pieraksts:

user - tavs lietotaaja vaards (arii direktoriju struktuuraa neaizmirstu "user" aizvietot ar savu lietotaaja vaardu)
# - komanda izpildaama kaa lietotaajam
$ - komanda izpildaam kaa "root" (su)
----------------------------------------------
*Source:

#mkdir - /home/user/apch_inst
PHP latest source - http://lv.php.net/get/php-5.0.3.tar.gz/from/a/mirror
Apache - http://httpd.apache.org/download.cgi
MySQL - http://dev.mysql.com/get/Downloads/MySQL-4...om/pick#mirrors
Save to dir - /home/user/apch_inst

----------------------------------------------
*DIR structure:

Install dir - /home/user/apch_inst

Destination dir:
MySQL - /usr/db/mysql
Apache - /usr/www/httpd
PHP - /usr/www/php
----------------------------------------------
*Users:

Applications -> System Settings -> Users and Groups
izveido lietotaaju "mysql", kuram nav vajadziibas veidot home dir

----------------------------------------------
*MySQL install:

$mkdir /usr/db/mysql
$chown -R mysql:mysql /usr/db/mysql
$chown -R user:user /usr/db/mysql
#cd /home/user/apch_inst
#tar xvzf mysql-4.1.9.tar.gz
#cd /mysql-4.1.9/
#./configure --prefix=/usr/db/mysql
#make
#su -c "make install"
#/usr/db/mysql/bin/mysql_install_db
#/usr/db/mysql/bin/mysqld_safe --user=mysql
#/usr/db/mysql/bin/mysqladmin -u root password new-password
#/usr/db/mysql/bin/mysqladmin -u root -h localhost.localdomain password new-password
#cp support-files/my-medium.cnf /etc/my.cnf
#nano /etc/my.cnf
Example:
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
net_buffer_length = 2K
thread_stack = 64K
skip-networking
server-id = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 8M
sort_buffer_size = 8M
[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M/usr/db/mysql/bin/mysql
[mysqlhotcopy]
interactive-timeout

TEST:
#/usr/db/mysql/bin/mysql

-----------------------------------------------------------
*Apache:

#mkdir /usr/www/httpd
#chown -R user:user /usr/www/
#cd /home/user/apch_inst
#tar xvzf httpd-2.0.52.tar.gz
#cd httpd-2.0.52
#./configure --prefix=/usr/www/httpd/ --enable-ssl --disable-info --disable-cgi --enable-speling --enable-so
#make
#su -c "make install"

Servera konfiguraacijas faila modifikaacija:
#nano /usr/local/apache2/conf/httpd.conf

DocumentRoot "/usr/www/sites"

<Directory "/usr/www/sites">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Liegt pieeju .htaccess:

<Files ~ "^.ht">
Order allow,deny
Deny from all
</Files>

<VirtualHost IP:80> (jeb domain name ja ir regjistreets DNS)
ServerAdmin [email protected]
DocumentRoot /usr/www/sites
ServerName ljapata
ErrorLog logs/lljapata_log
CustomLog logs/ljapata_log common
</VirtualHost>


#mkdir /usr/www/sites
#chown -R user:nobody /usr/www/sites
#chmod -R 777 /usr/www/sites
#nano /usr/www/sites/index.html
tur dereetu ierakstiit apmeeram taa:
<html>
<title>sveiks</title>
<body>
YEAH, tavs Apache serveris straadaa smile.gif
</body>
</html>

Start server:
#/usr/www/httpd/bin/apachectl start

Stop server:
#/usr/www/httpd/bin/apachectl stop
-----------------------------------------------------
*PHP:

Novilkt:
libxml - http://xmlsoft.org/sources/
Save to dir /home/user/apch_inst
#cd /home/user/apch_inst
#tar xvzf xvzf libxml2-2.6.11.tar.gz
#cd /home/user/apch_inst/libxml2-2.6.11
#./configure --enable-ipv6=no --with-debug
#make
#su -c "make install"

php5
#cd /usr/www/
#mkdir /php/
#chown -R user:user /usr/www/php
#cd /home/user/apch_inst/
#tar xvzf php-5.0.3.tar.gz
#cd cd php-5.0.3
#./configure --prefix=/usr/www/php --with-apxs2=/usr/www/httpd/bin/apxs --with-config-file-path=/usr/www/httpd/php --enable-force-cgi-redirects --disable-cgi --with-zlib --with-gettext --disable-ipv6 --disable-versioning --with-openssl --enable-dio --with-mysql=/usr/db/mysql/
#make
#su -c "make install"
#mkdir /usr/www/httpd/php/
#cp -p php.ini-recommended /usr/www/httpd/php/php.ini

nano /usr/www/http/conf/httpd.conf
pievienot:
-------------------------------------
# Use for PHP 5.x:
AddHandler php5-script php
AddType text/html php
DirectoryIndex index.html index.php
AddType application/x-httpd-php-source phps

----------------------------------------------------------------------------------------------
Veidojis: Kristabs

Edited by Kristabs
Link to comment
Share on other sites

<?

mysql_connect("localhost", "root", "");

mysql_select_db("test");

if(mysql_ping()){

echo "Datu baaze straadaa",

} else {

echo "Datu baaze nestraadaa",

}

mysql_close();

?> 

Ja parādas Datu baaze straadaa tad apsveicu. Apache + PHP + MySQL Strādā!!!

 

 

kur tam ir japaraadaas?

Link to comment
Share on other sites

<?

mysql_connect("localhost", "root", "");

mysql_select_db("test");

if(mysql_ping()){

echo "Datu baaze straadaa",

} else {

echo "Datu baaze nestraadaa",

}

mysql_close();

?> 

Ja parādas Datu baaze straadaa tad apsveicu. Apache + PHP + MySQL Strādā!!!

 

 

kur tam ir japaraadaas?

13737[/snapback]

 

 

tam jaaparaadas browseriii. ja nekas neparaadas, tad tai failaa pashaa saakumaa iemet rindinju:

error_reporting(E_ALL);

Link to comment
Share on other sites

Vienalga nesanak, taatad failam index.php kursh atrodas ditrektorija htdocs ir jaizskatas shadi:

<?
error_reporting(E_ALL);
mysql_connect("localhost", "root", "");
mysql_select_db("test");
if(mysql_ping()){
echo "Datu baaze straadaa",
} else {
echo "Datu baaze nestraadaa",
}
mysql_close();
?>

?

atverot ar IE man piedava downloadot to failu, atverot ar Operu man parada sho pashu kodu...

Link to comment
Share on other sites

...

atverot ar IE man piedava downloadot to failu, atverot ar Operu man parada sho pashu kodu...

13784[/snapback]

Tas nozīmē, ka savā httpd.conf failā neesi pielicis sekojošas rindiņas:

AddType application/x-httpd-php .php

LoadModule php4_module "c:/php/php4apache.dll"

AddModule mod_php4.c (šī rindiņa tikai, apache ir 1.x versijas)

 

Protams, attiecīgi piekoriģē versijas numruu php (4/5) un apache (1/2).

Link to comment
Share on other sites

AddType application/x-httpd-php .php
LoadModule php4_module "c:/php/php4apache.dll"
AddModule mod_php4.c (šī rindiņa tikai, apache ir 1.x versijas)

 

tas vienalga kur es to ielieku? vai kkur speciali man shitas kods ir janovieto? es izmegjinaju visadu, bet tapat neiet! aa ... un taja htdocs vajag but tikai vienam index.php?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...