LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PHP Installation (https://www.linuxquestions.org/questions/linux-newbie-8/php-installation-582058/)

rn5a 09-04-2007 04:15 AM

PHP Installation
 
I have been trying to install PHP in my Linux Mandriva machine but am encountering problems.

The documentation first tells how to install Apache server (which I did successfully) followed by the PHP installation. After uncompressing the tar.gz PHP installation file, as per the installation instructions, I executed ./configure. The next step tells to run make but the following error gets generated when I run the make command:

make: *** No targets specified and no makefile found. Stop.

This is where I am getting stuck up. Can someone please help me resolve this problem?

Thanks,

Ron

odcheck 09-04-2007 04:19 AM

Did you encounter any errors while you've startet
the configure?

Is gcc compiler installed? gcc++ and so on?

rn5a 09-04-2007 06:18 AM

Thanks, mate, for your concern.

GCC compiler is installed but am not sure about GCC++. The only error that ./configure generates is this:

configure: error: xml2-config not found. Please check your libxml2 installation.

The above error gets generated at the very end.

Thanks once again,

Regards,

Ron

odcheck 09-04-2007 07:13 AM

So this is what you should fix first before you start any make
anytime.

configure: error: xml2-config not found. Please check your libxml2 installation

if you have got any package management system like synaptic or yum or yast search for something like xml2
installed it and start ./configure again.

ingar 09-04-2007 07:59 AM

Short question: Do you need PHP for making/setting up a web-server?

If so, it might be interresting to check out this "ready-to-go" webserver-package - it will save you the trouble of getting all components installed, compiled and configured:

http://www.apachefriends.org/en/xampp-linux.html

I use this myself - and have been very satisfied with it. Only one important thing is, that you need to run the 'security'-setup afterwards.

rn5a 09-05-2007 03:28 AM

Thanks, friends, for your helpful suggestions.

Quote:

Short question: Do you need PHP for making/setting up a web-server?
Yes, thatīs exactly the reason why I need PHP - for setting up a web server.

Quote:

If so, it might be interresting to check out this "ready-to-go" webserver-package - it will save you the trouble of getting all components installed, compiled and configured:
Thatīs not a bad idea but itīs 51 MB size is the worrying factor for me! My ISP imposes a restriction on the size of the files downloaded.

Quote:

if you have got any package management system like synaptic or yum or yast search for something like xml2 installed it and start ./configure again.
How do I find out if my system has any packagae management system or not & if thereīs one, how do I find out the name of the package management system?

Actually when I open the Mandriva Control Centre & under the Software category, when I click Look at installable software and install software packages, among the many softwares installed, libxml2 is also listed as installed but when I search for libxml2 using Mandrivaīs in-built Find utility, it yields a directory named libxml2 which resides in the usr/include directory but thereīs no file any libxml2 in the libxml2 directory.

Any other suggestions, my dear friends?

Thanks once again,

Regards,

Ron

rn5a 09-05-2007 04:08 AM

Friends, I could finally manage to install PHP after libxml2 was installed but I am not able to run PHP files in the browser (FireFox). Actually thereīs a tool named ASP2PHP which automatically converts ASP files to PHP files which is what I did but when I opened a PHP file in the browser (using Apache as the server), all I could see is just the source code of the PHP file.

Any ideas what could be causing this?

Thanks a lot friends for your helpful inputs.

Regards,

Ron

dark_angel 09-05-2007 05:50 AM

you should tell apache to feed all *.php files through PHP. try adding this line in your httpd.conf:

AddType application/x-httpd-php .php

good luck!

rn5a 09-05-2007 02:26 PM

Thanks, dark_angel, for your suggestion.

What you have suggested, the same is mentioned in the PHP installation help file but when I add the line

AddType application/x-httpd-php .php

in the httpd.conf file & then open a PHP file in FireFox, FireFox pops-up a dialog asking me whether I want to open the PHP file with KWrite or save the file to disk (the dialog that pops-up whenever one wants to download a file). But, as already said before, if I comment out the above line (in blue), then FireFox renders the source code of the PHP file.

What could be going wrong?

Also another step mentioned just before the above step in the help file says to add the following line in the httpd.conf file:

LoadModule php5_module modules/libphp5.so

where php5_module must point to the path of the PHP module on the system. I searched for libphp5 in my PC but could not find it. So using the Software Media Manager, I downloaded libphp5_common.so.5 (which got saved in the /usr/lib directory) & then ran the following command to create the symlink libphp5.so in the /usr/local/apache-2.2.4/modules directory:

ln -s /usr/lib/libphp5_common.so.5 /usr/local/apache-2.2.4/modules/libphp5.so

The symlink got created in the modules directory. Thatīs OK I suppose but when I searched for php5*, then surprisingly, the result yielded a directory named php4 (which exists in the /usr/lib directory) & not php5 (or any directory whose name is preceded by php5)! I guess this should be the path of the PHP module or am I wrong? If I am wrong, then how do I find out the path of the PHP module? Or the path of the PHP module is the directory in which the TAR PHP installation file was uncompressed??

Is something wrong? The reason I am asking this is because I downloaded the PHP-5.2.4 installation TAR file; so where did the directory php4 come from?

Also after PHP got installed successfully, the next step told to run make test but thereīs nothing given about make test in the help file. Can you throw some light on this?

Thanks once again,

Regards,

Ron

rn5a 09-05-2007 06:26 PM

PLEASE....SOMEBODY PLEASE HELP ME OUT! I have been trying to resolve this issue since last 4 days! My hairline has receded by 4 inches in these 4 days!

SO PLEASE HELP ME RESOLVE THIS PROBLEM....PLEASE.....ITīS AN EARNEST REQUEST.....

Thanks,

Regards,

Ron

rn5a 09-05-2007 08:26 PM

Most of the articles & posts I have come across to resolve this issue says that the httpd.conf file should have the red colored line I have cited in my second-last post (the LoadModule line) but when I add that line in httpd.conf & then start the Apache server using

/usr/local/apache-2.2.4/bin/apachectl -k start

then the following error gets generated:

httpd: Syntax error on line 54 of /usr/local/apache-2.2.4/conf/httpd.conf: Cannot load /usr/local/apache-2.2.4/modules/libphp5.so into server: /usr/local/apache-2.2.4/modules/libphp5.so: cannot open shared object file: No such file or directory

Can someone please tell me what could be causing this error?

Thanks,

Regards,

Ron

rn5a 09-06-2007 12:30 AM

I finally managed to run PHP files using Apache in FireFox but please donīt ask me how! I myself am not sure how I could do it since I have employed so many methods to get a solution that now I donīt remember which method did the trick. Nevertheless some questions are still lingering in my mind. Can someone answer them?

The first few times when PHP scripts were not running, I configured both Apache & PHP using just ./configure without any flags. At this time, the root directory of PHP was usr/local/apache-2.2.4/htdocs. In other words, if a PHP file resided in the htdocs directory, I could access that PHP file with this URL:

http://localhost/Try.php

Itīs a different matter that I could just see the source code of the PHP file in the browser. The bottomline is the root was usr/local/apache-2.2.4/htdocs. The httpd.conf file resided in usr/local/apache-2.2.4/conf. In this file, PHP was told to listen to port 80. When I started Apache by executing the following command:

/usr/local/apache-2.2.4/bin/apachectl -k start

Apache used to start.

Since the PHP files were not running in the browser, I again configured Apache & PHP this time running ./configure with a host of flags like --with-apxs2=/usr/local/apache-2.2.4/bin/apxs, --with-apache-2.2.4=/usr/local/apache-2.2.4, --with-mssql=/usr, --with-mysql, --enable-ftp, --enable-ctype etc. for Apache and --enable-so, --enable-module=all, --enable-alias, --enable-asis, --enable-dir etc. for PHP. In fact, I did the configuration of Apache & PHP more than once using many flags but with slight differences here & there.

Now when I tried to start Apache by executing the above command (in blue), the following error got generated:

(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs


After going through a no. of posts to overcome this error, I changed the Listen port in httpd.conf from 80 to some other port number. Now when I started Apache, it started successfully but strangely, usr/local/apache-2.2.4/htdocs which was the root directory earlier no longer remained the root directory. Rather the root directory changed to var/www/html. I discovered this change in root directory by running the PHP file Try.php (which resides in usr/local/apache-2.2.4/htdocs) in FireFox. The output was File not found since thereīs no file named Try.php in var/www/html but when I copied Try.php from usr/local/apache-2.2.4/htdocs to var/www/html, then the PHP file was rendered successfully in FireFox.

Actually thereīs another httpd.conf file which resides in etc/httpd/conf. I didnīt notice the existence of this httpd.conf file when I configured Apache & PHP without any flags; so I am not sure whether this httpd.conf file existed from the very beginning or not i.e. when I configured Apache & PHP for the first time without any flags or did this httpd.conf file get created after I configured Apache & PHP with the flags. But both the httpd.conf files had different values for the same directive like for e.g. the value of the directive DocumentRoot in the httpd.conf file which resides in usr/local/apache-2.2.4/conf is /usr/local/apache-2.2.4/htdocs whereas the value of this directive in the httpd.conf file existing in etc/httpd/conf is var/www/html. Similarly, the value of the directive ServerRoot in one of the httpd.conf files is /usr/local/apache-2.2.4 whereas the value of this directive in the other httpd.conf file is /etc/httpd.

Now which of the 2 httpd.conf files will Apache use to process PHP scripts? Also why are the values of the same directives in the 2 httpd.conf files different?

Moreover why did Apache generate the above error (in red) & refused to start when I configured Apache & PHP with a plethora of flags? Finally what could have prompted the root directory to change from usr/local/apache-2.2.4/htdocs to var/www/html?

Thanks,

Regards,

Ron

dark_angel 09-06-2007 04:48 AM

i'm not really sure about your apache having two httpd.conf. maybe you already have apache installed in your system before you even downloaded and installed a new one. what is your distro by the way? mine is slackware and it comes with apache and php already installed. my httpd.conf resides at /etc/httpd and my default htdocs directory resides at /var/www. one more thing, you mentioned that apache could not bind to port 80. its because port 80 is already taken by some other processes. maybe the previous apache?

please post whatever you have discovered. i'm very interested since i am also running an apache server in my laptop as a test server for my php scripts. although i haven't installed apache from scratch like you did.

rn5a 09-08-2007 03:49 PM

After installing MySQL, PHP scripts refused to run in FireFox. So I manually deleted all the files & directories related to Apache & PHP & installed them again in the same manner as I had done before (as stated in my last post) but again I am encountering the same error!

When I open a PHP file in FireFox, FireFox asks me whether I want open the file or save it in the hard drive! I just donīt understand where am I erring. I added the line

AddType application/x-httpd-php .php

in httpd.conf but, as already said, FireFox asks me whether I want to open the file or save it in the hard disk. If I remove the above line, then FireFox just displays the source code of the PHP files.

The PHP help file also says to add the following line in httpd.conf:

LoadModule php5_module modules/libphp5.so

I downloaded libphp5_common.so.5 (which got saved in the /usr/lib directory) & then ran the following command to create the symlink libphp5.so in the /usr/local/apache2/modules directory:

ln -s /usr/lib/libphp5_common.so.5 /usr/local/apache2/modules/libphp5.so

But when I start Apache, it generates the following error:

httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: undefined symbol: php_register_internal_extensions

I have gone through numerous posts to resolve this issue & implemented each & every method I came across but the problem seems perennial.

Someone please help me resolve this problem....PLEASE....

Ron

rn5a 09-08-2007 07:06 PM

Can someone please give me a concrete solution?

PLEASE try to understand that itīs been close to 10 days since I have started installing LAMP & am still stuck up. When one works, the other doesnīt & vice-versa. I have gone through numerous posts & articles but still havenīt managed to get Linux-Apache-MySQL-PHP working together. I hope guys out there understand my frustration. Believe me - I am on the verge of losing my job!

PLEASE PLEASE PLEASE....I BEG YOU..SOMEBODY PLEASE HELP ME OUT....PLEASE....

Ron


All times are GMT -5. The time now is 08:46 PM.