# How to install PHP without Apache?



## priya117 (Jun 20, 2013)

[size=-1][Split off into a new thread instead of resurrecting an old one already marked as solved. -- mod][/size]

Hi, I am also facing the same issues with this libphp5.so file. Can anyone please tell me how to install PHP first without Apache installed since while configuring PHP I'll give apxs file as one of the input?

Please help me, *I* am stuck in between, I only want this libphp5.so file how can *I* achieve this, Apache used was 2.4.4 and PHP of 5.4.16 

I installed Aache first and the server was up. Later I installed PHP. It was success but this libphp5.so file is absent in the Apache modules list and I'm unable to test it.

Thanks in advance.


----------



## ShelLuser (Jun 20, 2013)

priya117 said:
			
		

> Can anyone please tell me how to install PHP first without Apache installed since while configuring PHP I'll give apxs file as one of the input?


Simple, just go to the right ports directory (for example lang/php5), then simply use `# make config` and make sure to select the modules which you need.

If you select the Build Apache module option then it will build it.

All the other details regarding this can be found in the thread above us.

(In these examples I'm not getting into specific versions, so I'm focussing on lang/php5 and www/apache22 to make it easier on myself).

So basically select the port directory for PHP, run `# make config` from it and be sure to select the Apache module I mentioned above. If you follow this example then I think it will default (at the time of writing) to setting up www/apache22.

However, a better step would be to make sure that you have Apache installed _before_ you install PHP. This will give you full control over what Apache version to use (but keep in mind that lang/php5 requires Apache 2.x and up). To that end you would first need to run both `# make config` and `# make install clean` from the Apache port directory.

Note that you don't really need to enable or disable anything from the Apache configuration. By default it builds most modules and PHP doesn't have any specific requirements.

After this is done you can then proceed to building PHP.

And although I realize all too well that I've turned a bit into a portmaster advocate I can't help mention that this could make your life a lot easier with all this. If you start by telling portmaster to install PHP and then select the Apache option it will detect the new dependency after configuring PHP and then proceed with configuring Apache as well.

Effectively this means that you could do the above with one single command: `# portmaster lang/php5`.


----------



## SIFE (Jun 21, 2013)

Make sure you check the option php-cli.


----------



## priya117 (Jun 21, 2013)

Can you please elaborate what does 'right port' mean here and also 'build Apache module' means appending the apxs option while configuring?

Can you please show one example?


----------



## ShelLuser (Jun 21, 2013)

priya117 said:
			
		

> Can you please elaborate what does 'right port' mean here and also 'build Apache module' means appending the apxs option while configuring?


How exactly did you install Apache in the first place?

With right port directory I meant just that: go to the right directory, for example /usr/ports/lang/php5 and use the commands I mentioned earlier.

I get the impression that you haven't really been using the Ports collection very often, therefor you might want to check up on how to use it.


----------

