Αναζήτηση αυτού του ιστολογίου

Install Apache2.4 , PHP 5.5 and MySQL on FreeBSD 9.2 or 10

Official FreeBSD Instructions:
http://www.freebsd.org/doc/handbook/network-apache.html

User Tutorial:
http://blog.ataboydesign.com/2014/04/17/freebsd-10-installing-apache-2-4-mysql-5-5-and-php5-5-missing-libphp5-so/

Steps :
1.#portsnap fetch update

2.Install /user/ports/www/apache24 (#make install clean)
Once apache24 has been installed successfully, edit /etc/rc.conf to make the Apache server start automatically at system boot , by adding this line : apache24_enable="YES"
 
3.Install /user/ports/lang/php55
3.1 first run make config to select required options of php.
Minimum options should be CLI, CGI and LINKTHR.
Web suggests to enable even ZTS, but In my case (FreeBSD 9.2) , i had problems  with ZTS.
3.2 #make instal
Since it is quite possible, first php55 install to fail, better to avoid "make install clean", since "clean" option removes data after installation.

If installation fails, after you fix the failure cause, you can run make reinstall clean. If you need ZTS and this is the cause of the php55 installation failure (that was my case),this blog describes how ZTS problems and missing libphp5.so can be solved (PS: by the way i deselected ZTS, since this blog came to my attention later....)

3.3 Fixing ZTS In Brief :
# kldload dtraceall 
# echo 'dtraceall_load="YES"' >> /boot/loader.conf
Reinstall lang/php55: #make install (or reinstall) clean

4. Install /user/ports/www/mod_php55 (#make install clean)
After finish (without errors) check to verify that libphp5.so exists in /usr/local/libexec/apache24/ directory (it should!)

PS: You may want also to instal php55-extensions for apache24. If so make an install here : /usr/ports/lang/php55-extensions

5. Copy the PHP configuration file
#cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
PS: While php.ini-production was automatically created by php55 installation, file php.ini is also required but not generated by php55 installation (and FreeBSD instructions say nothing about this...)

6. Edit /usr/local/etc/apache24/httpd.conf file and verify (or add if missing) that the following lines exist:

LoadModule php5_module libexec/apache24/libphp5.so
PS: In my case this line was added in the "loadmodules section" by the mod_php55 installation.

AddType application/x-httpd-php .php 
AddType application/x-httpd-php-source .phps

These lines was not in my httpd.conf (and FreeBSD guide says nothing about this...)

7. Modify DirectoryIndex section of httpd.conf like this:
DirectoryIndex index.php index.html

8.  Create the index.php (must be saved in usr/local/www/apache24/data directory) like this:
# edit /usr/local/www/apache24/data/index.php 
< ?php phpinfo(); ?>
ctrl+c + exit to save file

9. Now restart the apache server
#service apache24 stop
#service apache24 start (or onestart)

10. Run 127.0.0.1/index.php from your browser, and should be ok now.

Credits: http://blog.ataboydesign.com/2014/04/17/freebsd-10-installing-apache-2-4-mysql-5-5-and-php5-5-missing-libphp5-so/

More About PHP:
PHP $_SERVER variables : http://php.net/manual/en/reserved.variables.server.php
Add PHP to Blogger: http://www.mybloggerlab.com/2013/04/how-to-host-css-or-javascript-files-in-blogger-using-google-drive.html
Free Hosting with PHP: http://www.mybloggerbuzz.com/2014/01/use-php-codes-blogger.html