How to fix "/www/bin/apxs: No such file or directory"

The other day I was trying to compile php in one of my Linux machine and this error threw up. Well then I thought let me provide a solution for this on my blog as well.
 

Error

This error comes when you are trying to compile php with Apache.

# ./configure --with-apxs=/www/bin/apxs

Well I was following the INSTALL directory present inside the downloaded php directory which told me to compile using the above syntax if I wanted to integrate my php with Apache. Initially I didn't recognised that the path I was using for apxs was not correct but anyhow we will come to know about it once we run the command.
 

Solution

This happens because of the following missing package

  • httpd
  • httpd-devel (important)

In most cases httpd-devel package is missing which leads to this error.
On Red Hat, Fedora, CentOS

# yum install httpd httpd-devel

Once the package is installed look out for apxs in your machine

# which apxs
/usr/sbin/apxs

So as you see the location of apxs is different as we were using in our command. Now try to compile your PHP

# ./configure --with-apxs=/www/bin/apxs

NOTE: If your Apache version is higher than 1.3 then you will have to use apxs2 instaed of apxs.

# ./configure --with-apxs2=/www/bin/apxs

I hope the article was useful.

1 thought on “How to fix "/www/bin/apxs: No such file or directory"”

  1. Hi Deepak,
    Thanks for the above article.
    I have a small doubt. I have installed apache using source httpd-2.2.27.tgz and found that apxs is missing If I want to get it do I need to install default httpd again or is there any other way to compile the same. Please let me know if possible mail me
    Thanks
    Kiran

    Reply

Leave a Comment