.:: اجراي php بر روي windows ::. براي آنهايي كه تا حالا موفق نشده اند!

shahrokh_xp

Active Member
با سلام خدمت php كاران.
اولاْ اين عيد و تبريك ميگم و براي عيد هم مي خواستم اينجا برنامه اي معرفي كنم براي آنهايي كه تا حالا موفق به اجراي php بر روي localhost خود نشده بودند.
لطفاْ اين مراحل رو اجرا كنيد :

(1) ابتدا نياز به apache و PHP 4.3.4 دارين كه براي نصب apache و PHP با ماژول هاي ssl . webdav , perl5 بهترين برنامه اي كه الآن خودم هم دارم استفاده مي كنم رو بهتون معرفي ميكنم. اسم اين برنامه NuSphere TechPlatform v3.2 for Windows است كه در پايين يه توضيح مختصري در اين رابطه داده مي شود.
Either are a beginner or an expert in developing sites and applications based on the most popular open source components, you have found the right solution. The NuSphere Technology Platform is an integrated distribution of the most recent versions of Apache web server, PHP, and Perl along with other necessary development and administrating tools. Don't waste hours bringing the components together... We've done this for you.

The new version of TechPlatform is a multicomponent package, which contains TechPlatform Core and PHP Debugger. TechPlatform Core includes the recent versions of Apache, Perl, and PHP with all up-to-date security fixes.

TechPlatform components are:

Apache 1.3.29 web server with:

mod_perl 1.29
mod_ssl 2.8.16
mod_dav 1.0.3
OpenSSL 0.9.7c
PHP 4.3.4 scripting language
Perl 5.8.0 scripting language
PHP Debugger v2.16.3


The installation has now become more structured and flexible, with a number of additional choices and options:

Choose the Apache components to be installed: mod_perl, mod_ssl, mod_dav install Apache either as NT service or as a console application
Install Admin Site on separated Virtual Host or in the directory
Protect your Admin Site with password
Set various options for User Area or Admin Site (if you selected to install it on a separated Virtual Host):
specify any Apache port and check if it's unique
select if you want to protect access to User Area using SSL
select if you want to protect access to User Area using WebDAV (SSL or Non SSL options are available)
More About Techplatform Components

Apache web server
Apache is the world's most popular open-source web server software. According to the October 2003 Netcraft Web Server Survey, more than 64% of the web sites on the Internet use Apache. Thus, Apache has become the de facto internet standard for the web server.

mod_perl
According to http://perl.apache.org mod_perl is a "marriage of Apache and Perl". In short, it brings together these two powerful and mature web technologies. Here just a few things that you can do using mod_perl:

have the existing CGI scripts run much faster
easily create custom modules that become part of Apache, e.g. content handlers can be written in a couple lines of code and integrated with existing modules designed for use with mod_perl
access and control all phases of the request cycle
configure Apache with Perl; e.g, configure everything from virtual hosts to authentication settings using Perl right in the httpd.conf file
install third-party modules for enhancing your application functionality with sessions, passwords and database integration.

mod_ssl
mod_ssl is a very popular Apache module that provides strong cryptography for the Apache webserver via the Secure Sockets Layer and Transport Layer Security protocols with the the help of the Open Source SSL/TLS toolkit OpenSSL, which is based on SSLeay.

mod_dav
mod_dav is an Apache module that adds WebDAV capabilities to the Apache web server. It allows to control information remotely and collaboratively, using interoperable tools that employ metadata and version control.
mod_dav with Apache acts as a Class 1 and Class 2 WebDAV server. This means it can manipulate resources (files), resource properties, and create/remove locks on those resources to allow for exclusive control.

OpenSSL
OpenSSL is an open-source implementation of the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. Also, OpenSSL is the name now used for the SSL library originally known as SSLeay. Among other uses, OpenSSL is used by Apache web server for https support and by MySQL to provide secure database access.

PHP
PHP is an open source, server-side, HTML embedded scripting language for creating dynamic Web pages. According to Netcraft surveys, it has been the most popular scripting language on the Internet since March of 2002. In January 2004, there were more than 14 million domains using PHP. The current stable version of PHP is v4.3.4.

Perl
Perl stands for Practical Extraction and Report Language. Perl is a robust programming language designed for processing textual information. It is commonly used for writing CGI scripts used by most servers to process data received from a client browser because of its strong text processing abilities. Perl is interpretive, which makes it easy to test and build simple programs.

((( لينك فايل براي دريافت : ftp://209.61.187.152/nusphere/ev/TechPlatform-3.2-Win32.exe )))) ((( حجم فايل : 27.5 مگابايت )))

(2) حالا بايد ديتابيس MySQL نصب كنيد كه آدرس آخرين ورژن آن يعني 4.0.18 MySQL به شرح زير است :

++آدرس مستقيم :
http://www.mysql.com/get/Downloads/...8-win.zip/from/http://mysql.247available.com/

++آدرس انتخاب mirror هاي مختلف از كشور هاي مختلف :
http://www.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.18-win.zip/from/pick

(((حجم فايل : 23.1 مگابايت )))

(3) و حالا براي راحت كردن كار اضافه كردن و كلاْ مديريت database بهتر است كه برنامه PHPMyAdmin را كه آخرين ورژن آن (ورژن اصلي يعني Stable ) كه زبان فارسي هم داره 2.5.6 مي باشد.

++ دريافت فايل .tar.gz :
http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.5.6.tar.gz?download
++ دريافت فايل zip :
http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.5.6.zip?download
((( حجم فايل tar.gz = كيلو بايت 1847 )))
(((حجم فايل zip = كيلوبايت 2020 )))

+++ مراحل نصب+++
1- براي نصب آپاچي و php بايد از فايل اول استفاده كنيد كه اين فايل خودش installer دارد و براي نصب راحت است.

+ تذكر 1 +
البته نكته اي كه بايد تذكر داد اين است كه بهتر است براي نصب apache از قبل iis را uninstall نماييد يا حداقل آن را غير فعال نمايد.

+ تذكر 2 +
پوشه اي كه پس از نصب پوشه اصلي براي گذاشتن فايل ها مي شود پوشه htdocs موجود در پوشه apache محل نصب است.
آدرس دقيق :
کد:
[your_install_drive]:\nusphere\TechPlat\apache\htdocs
اين بدين معناست كه كه فايل يا پوشه اي كه در اين پوشه قرار گيرد از طريق http://localhost يا https://localhost قابل ديدن و دريافت است.
مثلاْ براي افزودن پوشه majidonline در http://localhost بايد ابتدا آن پوشه را در پوشه htdocs كپي كرده و سپس از طريق http://localhost/majidonline يا https://localhst/majidonline قابل بازبيني است.

2- در مرحله بعدي بايد MySQL را نصب نماييد.اين برنامه هم داراي Installer for windows اسن كه كافيست آن را نصب نماييد.براي نصب سعي كنيد حتماْ آن را كامل نصب كنيد كه براي اين كار اگر به قسمت Custom برويد به صورت اتوماتيك Full نصب ميشود.

+ تذكر 3 +
نام كاربري (Username) و رمز عبور (password) اصلي وصل شدن به ديتابيس MySQL شما به صورت پيشفرض root و root در نظر گرفته شده است كه براي تغيير آن مي توانيد به محل نصب
MySQL رفته و فولدر bin را باز كنيد و تنها فايل اجرايي را با نام winmysqladmin.exe اجرا نماييد كه در ابتدا از شما نام كاربري و رمز عبور ميخواهد كه مي توانيد از همان root و root استفاده نماييد. سپس براي ويرايش رمز عبور اصلي به بخش my.ini Setup رفته و بقيه كارها را انجام دهيد.(استفاده از دكمه pick up and Edit my.ini Values و ويرايش نام كاربري و رمز عبور موجود در Text Box آن را تغيير دهيد.)ولي توصيه مي شود اين مقدار را تغيير ندهيد چون در ادامه آموزش از همين مقدارها براي ورود استفاده مي كنيم.!

3- در اين مرحله بايد PHPMyAdmin را نصب كنيم.براي اين كار پس از extract كردن فايل هاي موجود در فايل tar شده يا zip شده آنها را با توجه به تذكر 2 به پوشه htdocs منتقل نماييم.در اين مرحله من نام پوشه را از phpMyAdmin-2.5.6 به phpmyadmin تغيير نام دادم .توجه داشته باشيد كه فقط يه پوشه كلي وجود داشته باشد و پوشه ياد شده در پوشه ديگري نباشد.سپس نوبت به تنظيمات است.در اين مرحله فايل config.inc.php را از پوشه phpmyadmin (تغيير نام اعمال شده است!!) با برنامه هايي مانند Macromedia Dreamweaver يا Nusphere PHPEd 3.3 (توجه داشته باشين اين برنامه ها مجاني نيستند!!) يا حتي wordpad خود ويندوز مي توانيد باز كنيد.(بهتر است از notepad استفاده نشود!!).

در اين مرحله من كد تغييرات با شرايط اعلام شده از خط 1 تا خط 122 كه تغييرات اساسي هستند را به صورت كد قرار مي دهم. (براي توضيحات بيشتر مي توانيد سوال خود را اينجا مطرح نماييد. !)

کد:
<?php
/* $Id: config.inc.php,v 2.5.2.1 2004/02/15 01:18:52 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:

/**
 * phpMyAdmin Configuration File
 *
 * All directives are explained in Documentation.html
 */


/**
 * Sets the php error reporting - Please do not change this line!
 */
if (!isset($old_error_reporting)) {
    error_reporting(E_ALL);
    @ini_set('display_errors', '1');
}


/**
 * Your phpMyAdmin url
 *
 * Complete the variable below with the full url ie
 *    http://www.your_web.net/path_to_your_phpMyAdmin_directory/
 *
 * It must contain characters that are valid for a URL, and the path is
 * case sensitive on some Web servers, for example Unix-based servers.
 *
 * In most cases you can leave this variable empty, as the correct value
 * will be detected automatically. However, we recommend that you do
 * test to see that the auto-detection code works in your system. A good
 * test is to browse a table, then edit a row and save it.  There will be
 * an error message if phpMyAdmin cannot auto-detect the correct value.
 *
 * If the auto-detection code does work properly, you can set to TRUE the
 * $cfg['PmaAbsoluteUri_DisableWarning'] variable below.
 */
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin


/**
 * Disable the default warning about $cfg['PmaAbsoluteUri'] not being set
 * You should use this if and ONLY if the PmaAbsoluteUri auto-detection
 * works perfectly.
 */
$cfg['PmaAbsoluteUri_DisableWarning'] = FALSE;

/**
 * Disable the default warning that is displayed on the DB Details Structure page if
 * any of the required Tables for the relationfeatures could not be found
 */
$cfg['PmaNoRelation_DisableWarning']  = FALSE;

/**
 * The 'cookie' auth_type uses blowfish algorithm to encrypt the password. If
 * at least one server configuration uses 'cookie' auth_type, enter here a
 * passphrase that will be used by blowfish.
 */
$cfg['blowfish_secret'] = '';

/**
 * Server(s) configuration
 */
$i = 0;
// The $cfg['Servers'] array starts with $cfg['Servers'][1].  Do not use $cfg['Servers'][0].
// You can disable a server config entry by setting host to ''.
$i++;
$cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
                                                    // (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser']   = 'root';          // MySQL control user settings
                                                    // (this user must have read-only
$cfg['Servers'][$i]['controlpass']   = 'root';          // access to the "mysql/user"
                                                    // and "mysql/db" tables).
                                                    // The controluser is also
                                                    // used for all relational
                                                    // features (pmadb)
$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = 'root';          // MySQL password (only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only
                                                    // this db is displayed in left frame
                                                    // It may also be an array of db-names, where sorting order is relevant.
$cfg['Servers'][$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname

$cfg['Servers'][$i]['pmadb']         = '';          // Database used for Relation, Bookmark and PDF Features
                                                    // (see scripts/create_tables.sql)
                                                    //   - leave blank for no support
                                                    //     DEFAULT: 'phpmyadmin'
$cfg['Servers'][$i]['bookmarktable'] = '';          // Bookmark table
                                                    //   - leave blank for no bookmark support
                                                    //     DEFAULT: 'pma_bookmark'
$cfg['Servers'][$i]['relation']      = '';          // table to describe the relation between links (see doc)
                                                    //   - leave blank for no relation-links support
                                                    //     DEFAULT: 'pma_relation'
$cfg['Servers'][$i]['table_info']    = '';          // table to describe the display fields
                                                    //   - leave blank for no display fields support
                                                    //     DEFAULT: 'pma_table_info'
$cfg['Servers'][$i]['table_coords']  = '';          // table to describe the tables position for the PDF schema
                                                    //   - leave blank for no PDF schema support
                                                    //     DEFAULT: 'pma_table_coords'
$cfg['Servers'][$i]['pdf_pages']     = '';          // table to describe pages of relationpdf
                                                    //   - leave blank if you don't want to use this
                                                    //     DEFAULT: 'pma_pdf_pages'
$cfg['Servers'][$i]['column_info']   = '';          // table to store column information
                                                    //   - leave blank for no column comments/mime types
                                                    //     DEFAULT: 'pma_column_info'
$cfg['Servers'][$i]['history']       = '';          // table to store SQL history
                                                    //   - leave blank for no SQL query history
                                                    //     DEFAULT: 'pma_history'
$cfg['Servers'][$i]['verbose_check'] = TRUE;        // set to FALSE if you know that your pma_* tables
                                                    // are up to date. This prevents compatibility
                                                    // checks and thereby increases performance.
$cfg['Servers'][$i]['AllowDeny']['order']           // Host authentication order, leave blank to not use
                                     = '';
$cfg['Servers'][$i]['AllowDeny']['rules']           // Host authentication rules, leave blank for defaults
                                     = array();

++ تغييران اعمال شده ++
1- در خط 39 در مقابل $cfg['PmaAbsoluteUri'] محل قرار گرفتن اين برنامه (PHPMyAdmin ) تنظيم شده است.

2- در خط 75در مقابل $cfg['Servers'][$i]['controluser'] نام كاربري اصلي وصل شدن به ديتابيس تنظيم شده است.(براي توضيحات بيشتر به تذكر 3 باز گرديد!)

3- در خط 77 هم در مقابل $cfg['Servers'][$i]['controlpass'] مقدار رمز عبور اصلي ديتابيس تنظيم شده است.(براي توضيحات بيشتر به تذكر 3 باز گرديد!)

4- در خط 82 در مقابل $cfg['Servers'][$i]['auth_type'] مقدار config انتخاب شده است.

5- و در خطوط 83 و 84 در مقابل $cfg['Servers'][$i]['user'] و $cfg['Servers'][$i]['password'] همانند مراحل 2 و 3 اين تنظيمات عمل شده است.

و حالا كامپيوتر شما براي ميزباني php آماده است.
++ نكته هاي مفيد در تنظيم Apache ++
همانطور كه شايد بعد از كار با آپاچي نصب شده خودتان متوجه اين موضوع شده باشين اين آپاچي به صورت پيشفرض فايل هاي index.php را در ارجحيت اجرا قرار نداده است (يعني مثلاْ هنگامي كه فايلي به نام index.php در پوشه http://localhost/majidonline است آن را به صورت اتوماتيك اجرا نكرده بلكه يك ليستي از فايل هاي پوشه نشان بدهد.).
براي حل اين مشكل مراحل زير را طي كنيد:

1- به پوشه conf موجود در پوشه apache خود روجوع كنيد .
(آدرس دقيق : [your_install_drive]:\nusphere\TechPlat\apache\conf )

2- فايل httpd.conf را انتخاب نموده و آن را توسط notepad يا wordpad خود ويندوز باز نماييد.سپس در قسمت جستجو ( Search ) اين برنامه ها عبارت زير را جستجو كنيد :
index.html
پس از پيدا كردن اين فايل دقيقْ بعد از اين اسم يه فاصله با space bar بگذاريد و اسم index.php را تايپ نماييد.(توجه داشته باشين كه ترتيب قرار دادن اسم فايل ها در ارجحيت اجراي آنها تاثر دارد اين بدين معناست كه وقتي ابتدا index.html نوشته شده باشد و سپس index.php اگر در يك پوشه هر دوي آنها وجود داشته باشد apache ابتدا به دنبال اسم اول مي رود و در صورت بودن آن را اجرا مي نمايد و اگر وجود نداشته باشد اسم بعدي را اجرا مي نمايد.)

3- سپس فايل را ضبط نماييد (save)

4- apache را خاموش كرده و دوباره آن را اجرا نماييد. (Restart)

اكنون آپاچي شما به روز است. :!:

اميدوارم مفيد واقع بشه. :wink:

تهيه و تنظيم : شاهرخ فرزام بهبودي
 

shahrokh_xp

Active Member
هر گونه سوال در اين رابطه هم كه داشتين مي تونيد اينجا مطرح كنيد تا انشااله پاسخش رو بدم! :wink:
 

ara

Member
آقا شاهرج دمت گرم واقا كه حال دادي
خيلي كامل و جامع بود
 

Majid

مدیر سایت
عضو کادر مدیریت
دستت درد نكنه شاهرخ جان

مجيد
 

جدیدترین ارسال ها

بالا