MSQL DOCS
2.x Apache on Unix-based platforms Notes and recommendations unique to Apache 2.x PHP installations on Unix systems are included in this section. Caution With Apache 2, we do not advise use a threaded MPM in production. Utilize the prefork MPM, which Apache 2.0 and 2.2 ships with by default. Read the relevant FAQ entry on running Apache2 with a threaded MPM to find out why. The most reliable source of information about the Apache 2.x server is the » Apache Documentation. There you may get more details regarding Apache installation options. Obtain the Apache HTTP server from the location listed above, and unpack it: tar -xzf httpd-2.x.NN.tar.gz Likewise, obtain and unpack the PHP source: tar -xzf php-NN.tar.gz Build and install Apache. Consult the Apache install documentation for more details on building Apache. cd httpd-2_x_NN ./configure --enable-so make make installAt this point, Apache 2.x.NN is accessible in /usr/local/apache2, set up with the default MPM prefork and support f or loadable modules. Use your typical method for starting the Apache server to test the installation, for example: start apachectl /usr/local/apache2/bin and halt the server so that PHP configuration can continue: bin/apachectl stop in /usr/local/apache2/ Set up and compile PHP now. This is where you set up PHP's customization, including which extensions to enable. To view the list of available options, run./configure—help. We'll perform a basic configuration in our example using MySQL and Apache 2. If you installed Apache in a different fashion, you'll need to modify the path to apxs. However, if you build Apache from source as previously said, the example below will match your path for apxs.
You will need to repeat the configure, make, and make install procedures if you decide to modify your configure parameters after installation. For the new module to take effect, all you have to do is restart Apache. Apache does not need to be recompiled.
Keep in mind that'make install', unless instructed differently, will also install PEAR, a number of PHP utilities, including phpize, the PHP CLI, and more.
Configure your php.ini file. cp /usr/local/lib/php.ini-development You can configure PHP settings by editing your.ini file. You can use the option --with-config-file-path=/some/path in step 5 if you would rather have php.ini somewhere else. Should you opt for php.ini-production instead, make sure to go over the changes listed there as they have an impact on PHP's behavior. In order to load the PHP module, edit your httpd.conf. The path of the PHP module on your system must be indicated by the path on the right side of the LoadModule statement. You should double-check even if the above make install might have already added this for you.
Regarding PHP 7: LoadModule libphp7.so from php7_module modules Regarding PHP 5: LoadModule modules/libphp5.so php5_module Direct Apache to interpret some extensions as PHP. Let's take an example where Apache parses PHP files ending in.php. We want to prevent potentially hazardous uploads and produced files like exploit.php.jpg from being executed as PHP, rather than merely utilizing the Apache AddType directive. By adding the extension(s) to this example, you may have any extension(s) parse as PHP. We'll add.php to serve as an example. cd ../php-NN ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql make make install
Otherwise, we would use this to enable PHP execution for.php,.php2,.php3,.php4,.php5,.php6, and.phtml files only:
SetHandler application/x-httpd-php
You might use mod_rewrite. To enable syntax-highlighted source code to be displayed from any
random.php file without requiring it to be renamed or copied to a.phps file:
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source] RewriteEngine On
On production systems, the php source filter shouldn't be enabled because it could reveal
sensitive or private data that is embedded in the source code.
Utilize your standard protocol to launch the Apache server, such as:
start apachectl /usr/local/apache2/bin
OR restart the httpd service
If you follow the above instructions, you should have an Apache2 web server that supports PHP as a SAPI module up and running.
Of course, Apache and PHP have a lot more setting possibilities. In the relevant source tree, type./configure --help for further details.
Citation
BIO About the Author: Joseph P Fanning
Joe studied at Harvard. He owns Joepfanning.com and blogs alot about cool things and stuff. He co owns Business Process Automation
Phone - 201 334 8743
Email - Joe's App email
Suffolk County LI New York 11772 Bergen County NJ Programmer