I decided to try and install php from source--just to see if I could do it. After messing around with vagrant unsuccessfully, I decided vagrant was way too complicated, and I installed php from source myself. In case anyone else is interested in how I installed php, I followed the php install instructions here (which are the Unix install instructions, which the Mac Install Instructions said to use):
http://www.php.net/manual/en/install.unix.apache2.php
Here are some clarifications of some of the steps:
3) I ignored step 3 (because I had already installed apache):
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 install
Apparently the apache install does the --enable-so by default.
5) I had previously installed mysql, and the --with-mysql flag, succeeded in allowing me to access my databases from a php script.
6) Make sure you do step 6:
cp php.ini-development /usr/local/lib/php.ini
I guess by default php reads the php.ini file located at /usr/local/lib/ and there isn't one there until you copy it.
7) The php install took care of adding the specified line to apache's http.conf.
8) I added the following to http.conf:
SetHandler application/x-httpd-php
9) To test your php install, start apache then create a file called my_test.php containing the following:
echo "My first PHP script!";
phpinfo();
?>
Put that file in the directory /usr/local/apache2/htdocs. Then use the following url in your browser:
http//localhost:8080/my_test.php
(Note that in apache's httpd.conf file, I have this line:
Listen 8080
which makes apache listen on port 8080, which means I have to include the port in the url.)
If you scroll down the resulting page, you can see lots of php/mysql/apache configuration info.
0 comments:
Post a Comment