Register for your free account! | Forgot your password?

Go Back   elitepvpers > Off-Topics > Tutorials
You last visited: Today at 21:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Installing PHP 5 on FreeBSD

Discussion on Installing PHP 5 on FreeBSD within the Tutorials forum part of the Off-Topics category.

Reply
 
Old   #1
 
elite*gold: -800
Join Date: May 2010
Posts: 317
Received Thanks: 219
Arrow Installing PHP 5 on FreeBSD

Choosing which port to use
In the past there were several ports for PHP such as /www/mod-php5, /lang/php5-cli, and /lang/php5. Since the release of PHP 5.1.14 there is now only /lang/php5 This port now allows you to choose if you want to install the CLI, CGI, and Apache module.

CLI stands for command line interpreter. It is used for running PHP scripts from the command line and makes creating shell scripts very simple if you already know PHP. The Apache PHP Module is disabled by default, so make SURE that if you plan to use this for web work that you enable it.

Installing the port
Since all PHP ports are now combined you will need to configure it to be sure the parts you need are built.

Code:
# cd /usr/ports/lang/php5
# make config
# make install
When you run make config you will be shown a list of options. To use PHP with Apache make sure the Apache Module box is selected.

Once php has installed you will need to install the extra modules for things such as MySQL. These modules are all located in the ports. Some of the most common modules are

Code:
/usr/ports/databases/php5-mysql - MySQL Database
/usr/ports/www/php5-session	- Sessions
/usr/ports/graphics/php5-gd - Graphics Library
Adding the PHP 5 module to Apache

Apache needs the following lines in the httpd.conf file to use php. These lines should already be added by the port but if you have problems you should double check your httpd.conf file. Note that Apache 2.x does not need the AddModule line.

Code:
# Apache 1.3.x
LoadModule php5_module        libexec/apache/libphp5.so
AddModule mod_php5.c
# Apache 2.x
LoadModule php5_module libexec/apache/libphp5.so
If you installed using the port and had apache installed already it should do this automatically for you.

Next find your DirectoryIndex section in your httpd.conf file. Apache is set up for PHP 4, but not PHP 5 currently so you will need to modify it and change the 4s to 5s like this.

Code:
<IfModule mod_dir.c>
    <IfModule mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.php3 index.html
        </IfModule>
        <IfModule !mod_php4.c>
            DirectoryIndex index.php3 index.html
        </IfModule>
    </IfModule>
    <IfModule !mod_php3.c>
        <IfModule mod_php5.c>
            DirectoryIndex index.php index.html index.htm
        </IfModule>
        <IfModule !mod_php4.c>
            DirectoryIndex index.html
        </IfModule>
    </IfModule>
</IfModule>
This code is telling Apache to open index.php first you have the PHP 5 module loaded. You can change the order as you wish. Or if you just wanted to skip it you could simply add the following line to the httpd.conf file since you know you are going to have php 5.

Code:
DirectoryIndex index.php index.html index.htm
Now apache just needs to know what it should parse the PHP files with. These two lines should be added to the httpd.conf file, and can be put at the bottom if needed.

Code:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
If want to use PHP code inside of .htm files you can just add on those extensions.

Code:
AddType application/x-httpd-php .php .htm .html
Configuring PHP
Settings for PHP are stored in /usr/local/etc/php.ini You will need to create this file by copying it from /usr/local/etc/php.ini-dist

# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

In this file you can set the memory limit for programs. Turn on global variables if you must, set the max file upload size, and everything else you need.

Testing PHP
Once you have restarted Apache so the changes take effect you are ready to test it. To test it run the following command to create a php file that you can attempt to run

Code:
# echo "<? phpinfo(); ?>" >> /usr/local/www/data/test.php
Then point your web browser to and if it works you will see several pages of information on your PHP settings. If it did not work you will see only the text you typed in.

Quelle:
Fyareh³ is offline  
Thanks
2 Users
Old 05/08/2010, 07:34   #2
 
elite*gold: 1982
Join Date: May 2010
Posts: 971
Received Thanks: 928
mhmz. i know all about installing php on freebsd, but the guide is usefull & ok.
aiiR7. is offline  
Thanks
1 User
Old 05/08/2010, 12:24   #3
 
elite*gold: -800
Join Date: May 2010
Posts: 317
Received Thanks: 219
Ok,Thank you (:
Fyareh³ is offline  
Thanks
1 User
Old 05/08/2010, 18:15   #4
 
elite*gold: 1982
Join Date: May 2010
Posts: 971
Received Thanks: 928
Yeye, no prob, u just can release how 2 installing apache, idk but i dont found it here, so maybe you can make a guide for this shize, if u know how to install it

greez aiiR7 <
aiiR7. is offline  
Thanks
1 User
Old 05/08/2010, 21:05   #5
 
elite*gold: -800
Join Date: May 2010
Posts: 317
Received Thanks: 219
(:
okey w8
Fyareh³ is offline  
Thanks
1 User
Old 05/09/2010, 03:39   #6
 
HighLvleR's Avatar
 
elite*gold: 94
Join Date: Feb 2008
Posts: 2,186
Received Thanks: 832
Quelle bitte!!
HighLvleR is offline  
Old 05/10/2010, 22:33   #7
 
megalastor22's Avatar
 
elite*gold: 0
Join Date: Apr 2010
Posts: 44
Received Thanks: 0
nice guide

very usefull sir Tausend Dank!
megalastor22 is offline  
Old 05/10/2010, 23:10   #8
 
syshack3rz's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 1,255
Received Thanks: 833
Fast schon Copy&Paste

syshack3rz is offline  
Old 05/11/2010, 19:19   #9
 
elite*gold: -800
Join Date: May 2010
Posts: 317
Received Thanks: 219
Ja,das is die Quelle
Fyareh³ is offline  
Reply


Similar Threads Similar Threads
Need help installing
07/14/2010 - Silkroad Online - 3 Replies
I havent played sro in ages, decided to come back. so i downloaded the installer and when i run it, it says that "this is a client that can be used after the alexandriaadfdsfdf updtae....blah" I remember this happened ages ago when i installed the Euro update but forgot what i did to fix it....so yeah..............how do i fix it? Thanks
Installing Apache on FreeBSD
05/08/2010 - Tutorials - 0 Replies
Apache @ FreeBSD Look here; /usr/ports/www/apache22 make install clean A Apache HTTP Server script apache22.sh is located at /usr/local/etc/rc.d to provide Apache HTTP Server start and shutdown service. To enable Apache web server to automatically starts whenever after server reboots, issue the following command at CLI: echo ‘apache22_enable =”YES”‘ >> /etc/ rc.conf
need help installing
04/09/2009 - Aion - 4 Replies
ok so i downloaded all 5 files the set up 3 data.zo files and the date rar file .. but i dnt get how to install i click setup and i get nothing but a error message when i go intot he rar file everyhting wants a password. can someone pleaseexplain to me how to install
Installing Co2 -
05/26/2007 - Conquer Online 2 - 3 Replies
Hello. I just formated my pc and i am having an annoying issue with installing conquer. So what i did was: I downloaded the latest client just an hour ago...i downloaded patch 4344-4349 and extracted it in the Conquer 2.0 folder.
installing co2
02/05/2007 - Conquer Online 2 - 1 Replies
is there a way to install co2 on mac?



All times are GMT +2. The time now is 21:41.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.