Mac OS 10.3 and PHP 5 install.
Moderator: General Moderators
Mac OS 10.3 and PHP 5 install.
I've done the install of PHP5 per instructions here:
http://www.phpmac.com/articles.php?view=159
I have a previously installed version of Apache2 installed at:
/usr/local/apache2
my httpd is at : /usr/local/apache2/conf/httpd.conf
What comments do I need to get php5 running?
i.e. AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Thanks for anyhelp!
http://www.phpmac.com/articles.php?view=159
I have a previously installed version of Apache2 installed at:
/usr/local/apache2
my httpd is at : /usr/local/apache2/conf/httpd.conf
What comments do I need to get php5 running?
i.e. AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Thanks for anyhelp!
That tutorial is for building PHP5 for Apache 1.3.x for Apache2 you need to add the --with-apsx2 switch and specify the apsx file e.g.
You will then need to check your httpd.conf for missing config lines (from memory everything is now added with the exception of the addition to the 'Directory Index' so find....
or something like that and add 'index.php' to the line.
You should then check for the existance of the following two lines...
And add them to the bottom of the file if you are inable to find them.
And then check the 'LoadModule' lines for the PHP5 module (this should be added when you make install)
Code: Select all
--with-apsx2=/path/to/apache/apsx2/fileCode: Select all
DirectoryIndex index.html index.htmYou should then check for the existance of the following two lines...
Code: Select all
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phpsAnd then check the 'LoadModule' lines for the PHP5 module (this should be added when you make install)
redmonkey wrote:That tutorial is for building PHP5 for Apache 1.3.x for Apache2 you need to add the --with-apsx2 switch and specify the apsx file e.g.You will then need to check your httpd.conf for missing config lines (from memory everything is now added with the exception of the addition to the 'Directory Index' so find....Code: Select all
--with-apsx2=/path/to/apache/apsx2/fileor something like that and add 'index.php' to the line.Code: Select all
DirectoryIndex index.html index.htm
You should then check for the existance of the following two lines...And add them to the bottom of the file if you are inable to find them.Code: Select all
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
And then check the 'LoadModule' lines for the PHP5 module (this should be added when you make install)
I re-compiled the PHP5 to match these instructions:
http://laughingmeme.org/archives/001787.html
I wasn't sure if redoing the ./configure over would help or hurt.
Should I have deleted the php5? If so How?
I found the Lodmoudle php5 in the /etc/httpd directory. I copyed and pasted it along wih the Addtype directives to the bottom of my Apache2 httpd.conf located at /usr/local/apache2/conf.
I also added the index.php. I'm trying to test the php with a test.php file and it does not work.
When I run at terminal: php -v I get this:
When the php5 installation is correct, should the php -v command show php5?PHP 4.3.2 (cli) (built: Sep 13 2003 22:04:20)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
When I do install "correctly" php5, should it be installed in to a directory i.e., /usr/local/php ? If so How?
Thanks for your help,
Before recompiling PHP you need to make clean the existing build otherwise nothing will be done. Go to the directory where you uncompressed the PHP source and type....
You will need to re-run configure again otherwise it will just compile with the previous options you passed. You add the --with-apsx2 switch to the end of the configure line that you were already using.
You can install PHP anywhere you like, however, if you have an existing installation I would recommend that you remove this first or install PHP5 somewhere else. To specify the installation directory you need to pass the --prefix switch when you configure e.g....
Now when you issue the 'make install' PHP5 will be installed into the directory specified by the --prefix.
You would need to check that the directory in which you installed PHP into is in your PATH environment.
To remove a previous installation is not so straight forward, you need to know where the idividual files for that PHP installation were placed. These could be anywhere and everywhere as it depends on the configuration that was specified.
Note, I am basing this info on my knowledge/experience in compiling and installing PHP in Linux, I have little/no experience with Mac OSX and these matters. Judging by the tutorial links you have given though, it is the same process.
Code: Select all
make cleanYou can install PHP anywhere you like, however, if you have an existing installation I would recommend that you remove this first or install PHP5 somewhere else. To specify the installation directory you need to pass the --prefix switch when you configure e.g....
Code: Select all
--prefix=/path/to/desired/install/dirYou would need to check that the directory in which you installed PHP into is in your PATH environment.
To remove a previous installation is not so straight forward, you need to know where the idividual files for that PHP installation were placed. These could be anywhere and everywhere as it depends on the configuration that was specified.
Note, I am basing this info on my knowledge/experience in compiling and installing PHP in Linux, I have little/no experience with Mac OSX and these matters. Judging by the tutorial links you have given though, it is the same process.
O.K... I did the make clean and reinstalled into /usr/local/php.redmonkey wrote:Before recompiling PHP you need to make clean the existing build otherwise nothing will be done. Go to the directory where you uncompressed the PHP source and type....You will need to re-run configure again otherwise it will just compile with the previous options you passed. You add the --with-apsx2 switch to the end of the configure line that you were already using.Code: Select all
make clean
You can install PHP anywhere you like, however, if you have an existing installation I would recommend that you remove this first or install PHP5 somewhere else. To specify the installation directory you need to pass the --prefix switch when you configure e.g....Now when you issue the 'make install' PHP5 will be installed into the directory specified by the --prefix.Code: Select all
--prefix=/path/to/desired/install/dir
You would need to check that the directory in which you installed PHP into is in your PATH environment.
To remove a previous installation is not so straight forward, you need to know where the idividual files for that PHP installation were placed. These could be anywhere and everywhere as it depends on the configuration that was specified.
Note, I am basing this info on my knowledge/experience in compiling and installing PHP in Linux, I have little/no experience with Mac OSX and these matters. Judging by the tutorial links you have given though, it is the same process.
In this dir I have : bin etc include lib man
The intallation DID add the correct directives to my httpd.conf file this time.
Now... how do I start the php? my test.php file still doesn't work although my browser loads a blank page this time as well as when I attempt to load myphpadmin/index.php
Thanks agian for the great help!
Blank pages normally mean that PHP has encountered an error, but error reporting and/or display errors is set to off.
You may find the errors have been piped jnto your Apache log file, so have a look at that for any hints on possible problems.
Did you copy across either the php.ini-dist or php.ini-recommended file from the root of the PHP source directory to /usr/local/php/lib/php.ini If not then copy either one of those files across, then open it up and check for the following lines...
Note, the php.ini contains many comments to help you choose the correct config options.
Now restart apache which should in turn reload PHP with the changes (if any) in the php.ini file.
You can then try running your scripts again and see if there are any errors.
You may find the errors have been piped jnto your Apache log file, so have a look at that for any hints on possible problems.
Did you copy across either the php.ini-dist or php.ini-recommended file from the root of the PHP source directory to /usr/local/php/lib/php.ini If not then copy either one of those files across, then open it up and check for the following lines...
Code: Select all
error_reporting = E_ALL
display_errors = OnNow restart apache which should in turn reload PHP with the changes (if any) in the php.ini file.
You can then try running your scripts again and see if there are any errors.
I copied, from source, php.ini-recommended to /usr/local/php/libredmonkey wrote:Blank pages normally mean that PHP has encountered an error, but error reporting and/or display errors is set to off.
You may find the errors have been piped jnto your Apache log file, so have a look at that for any hints on possible problems.
Did you copy across either the php.ini-dist or php.ini-recommended file from the root of the PHP source directory to /usr/local/php/lib/php.ini If not then copy either one of those files across, then open it up and check for the following lines...Note, the php.ini contains many comments to help you choose the correct config options.Code: Select all
error_reporting = E_ALL display_errors = On
Now restart apache which should in turn reload PHP with the changes (if any) in the php.ini file.
You can then try running your scripts again and see if there are any errors.
Should I remove the "-recommended" prortion of the extention?
I opened it up and am looking at what looks like a configuration file for PHP? Forgive me ... this is all new to me. So does it act similar to a httpd.conf file in that I have to "UNCOMMENT" the "semi-colins" to activate features?
Example from my php-ini:
; - error_reporting = E_ALL [Code Cleanliness, Security(?)]
; By default, PHP surpresses errors of type E_NOTICE. These error messages
; are emitted for non-critical errors, but that could be a symptom of a bigger
; problem. Most notably, this will cause error messages about the use
; of uninitialized variables to be displayed.
Yes, rename the file to php.ini
Lines starting with a ';' are comments or have been commented out.
So, either uncomment the line which reads..
;error_reporting = E_ALL
or add that line (with out the semi-colon at the start). Also find the line detailing display errors, and change that to on.
While it is not recommended to display errors on production servers, it is definately benifical to show errors when developing.
To be honest, if you are new to PHP, Apache and building software packages, I would recommend trying to find some binary packages first to get you going. Although this stuff is fairly straight forward if you have some previous experience/knowledge it is definately not a simple task.
Lines starting with a ';' are comments or have been commented out.
So, either uncomment the line which reads..
;error_reporting = E_ALL
or add that line (with out the semi-colon at the start). Also find the line detailing display errors, and change that to on.
While it is not recommended to display errors on production servers, it is definately benifical to show errors when developing.
To be honest, if you are new to PHP, Apache and building software packages, I would recommend trying to find some binary packages first to get you going. Although this stuff is fairly straight forward if you have some previous experience/knowledge it is definately not a simple task.
Thanks for all your help redmonkey! My test.php script finally loaded displaying the info on current php version. I've been messing with binary packages for awhile now and I guess I'm curious about the "building from source" approach. I'm trying to learn how to integrate Apache2 and Tomcat. Why? Just because. I backtracked and wanted a better understanding of Apache2 and decided to build from source to learn more about it. Hence the php5 troubleshooting. I believe the main problem was not having the php.ini file in the correct directory. Thanks again for your great support!redmonkey wrote:Yes, rename the file to php.ini
Lines starting with a ';' are comments or have been commented out.
So, either uncomment the line which reads..
;error_reporting = E_ALL
or add that line (with out the semi-colon at the start). Also find the line detailing display errors, and change that to on.
While it is not recommended to display errors on production servers, it is definately benifical to show errors when developing.
To be honest, if you are new to PHP, Apache and building software packages, I would recommend trying to find some binary packages first to get you going. Although this stuff is fairly straight forward if you have some previous experience/knowledge it is definately not a simple task.
MacUnkie.
The php.ini file should be optional as PHP builds with defaults.
It is good you are keen to learn, but you will not gain any insight into an app just by compiling it's source. Also, you will not learn very much by stepping through a tutorial, although this will get you started, you don't actually learn very much (if anything).
If you are interested, then I would recommend that you read all the 'install' and 'readme' docs that come in the source package, you should also try running ./configure --help which will invaribaly give you more info about the config options and will generally give you some other helpful info and insight into what is happening.
Other things to consider are you should check if the makefiles generated also have an uninstall option, if not try running 'make -n install' and pipe the results into a file, this will give you some sort of idea (an install log of sorts) of what was installed and where, comes in handy if need to rollback your changes ('make -n install' doesn't install the compiled software, it merely pipes the install instructions to STDOUT).
You also need to be aware of your system, in some cases installing additional shared libraries to support the app you are trying to install may overwrite existing shared libraries which currently installed software has a dependancy on.
It is good you are keen to learn, but you will not gain any insight into an app just by compiling it's source. Also, you will not learn very much by stepping through a tutorial, although this will get you started, you don't actually learn very much (if anything).
If you are interested, then I would recommend that you read all the 'install' and 'readme' docs that come in the source package, you should also try running ./configure --help which will invaribaly give you more info about the config options and will generally give you some other helpful info and insight into what is happening.
Other things to consider are you should check if the makefiles generated also have an uninstall option, if not try running 'make -n install' and pipe the results into a file, this will give you some sort of idea (an install log of sorts) of what was installed and where, comes in handy if need to rollback your changes ('make -n install' doesn't install the compiled software, it merely pipes the install instructions to STDOUT).
You also need to be aware of your system, in some cases installing additional shared libraries to support the app you are trying to install may overwrite existing shared libraries which currently installed software has a dependancy on.