stevelack
By:
stevelack

401 error when running PHP script.

December 9, 2015 699 views
Apache Linux Basics Ubuntu

I have a developer working on an integration for one of our sites. When he runs a php script that works on GoDaddy and HostGator servers it returns a 401 error. This happens on all of my Digital Ocean Droplets, so I thinking that I haven't installed something or I have something not properly set up in my Ubuntu installation. I am running Ubuntu 14.04.

Here's the VH:

<VirtualHost *:80>
ServerAdmin admin@site.com
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/sitedirectory
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride all
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/ssl.key/myserver.key
SSLCertificateFile /etc/apache2/ssl/ssl.crt/site_com.crt
SSLCertificateChainFile /etc/apache2/ssl/ssl.crt/site.ca-bundle
ServerAdmin admin@site.com
ServerName site.com
ServerAlias www.site.com
DocumentRoot /var/www/sitedirectory
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride all
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorLog ${APACHELOGDIR}/error.log
CustomLog ${APACHELOGDIR}/access.log combined
</VirtualHost>

And here is the error that is returned:

stdClass Object
(
[httpstatus] => 401
[status] => error
[debug
codes] => Array
(
[0] => stdClass Object
(
[code] => 40101
[reason] => Login Failure: Authorization Header required
)

    )

)

This only happens on my Digital Ocean Ubuntu droplets.

Any suggestions on how to trouble shoot this would be appreciated.

Thanks!

Be the first one to answer this question.