PHP - Probem setting up server for FrontAccounting

hi all,

I’m trying to setup a Apache server with PHP support in order to install the FrontAccounting software and got stuck. I started out by following the instructions in SDB:Linux Apache MySQL PHP - openSUSE and got the apache server working according to my browser (127.0.0.1 says “It works!”). Unfortunately, the test for PHP fails, i.e., after installing the PHP software according to the instructions, I created in ~/public_html a file info.php and when I navigate my browser to http://127.0.0.1/pascal I get the 404 error.

What am I missing? And should I be able to read with firefox any .php file instead of being prompted to use beaver?

You are trying to serve from a users home directory (which btw is considered insecure nowadays). This must be switched on by adding the module userdir to Apache and change the configuration because by default it only serves from the system, that is (again by default) in* /srv/www* (which you can of course find in the Apache configuraion defined as DocumentRoot).

And even when you want to serve from a users home directory, the URL would be something like http://host.domain/~username. And the configuration would then tell where it is inside that users home directory and public_html. is often used for that.

There is more info in* /etc/apache2/default-server.conf* and of course, read the Apache documentation which also on your system and, when you did correct, can be found at* http://127.0.0.1/manual*.

Thanks for replying. First let me begin by correcting myself. In my previous post I stated that my setup failed the second test in SDB:Linux Apache MySQL PHP - openSUSE. That is not so, I simply had omitted the ~ in http://pascalinux/~pascal/. Now, it shows the default PHP info page. So the PHP installation is also right. Let’s forget for the moment the security issues that result from serving from a public directory and focus on my inability to read .php files an issue also addressed in the previous page, right in the end of the Confirming PHP works. I followed those instructions too, i.e. I added

Include /etc/apache2/conf.d/php5.conf

to /etc/apache2/mod_userdir.conf file and restarted the Apache server. I still cannot use my browser to view .php files so I followed the last instructions which is to seek advice in the forums:)

Before going into technical detailss, I want express I am a bit confused about what you want. I admit I do not know what FrontAccounting is, but my impression is that you want to build a HTTP server with an application behind it. Now that is typicaly a case of serving from the system place(s) that are used for such a case, that us on openSUSE from /srv/www. This is also the default configuration when youinstall the LAMP with Yast/zypper in openSUSE.

But it looks to me as if you are aiming for serving end-user HTTP pages from the end users home directories (typicaly $HOME/public_html for all each user that wants to use the feature). This functionality is designed for e.g. systems of ISPs that want to offer a personal web-site to all their users. A complete different case from the one above.

In short I am doubting that you are walking the correct path for your solution.

=======================

Then about your technical problem.

It is allways difficult for people here to understand from just “telling stories” what is realy going on your system, or what you are doing. Thus you should allways back your “story telling” which as much computer information as possible. Thus as you say that you can not get Apache to correct interprete a PHP file in a certain directory, you should back this with an* ls -l *of that directory, so we can see that it does exist and all the information that belongs to it (like owner, access bits, etc.). Same for the URL you use for accessing it, you should copy/paste that here. And of course the exact errormessage you get is also missing from your story.

Equaly it would be best to post the relevant Apache configuratiion files, but I admit that that is a bit much. But parts of them, that prove that you configured your ServerRoot, Aliases, Userdir and more correct.

That makes two of us.

That was exactly the problem. Being a web server novice I was not aware that directories matter. As soon as I moved my files to */srv/www/htdocs/ *I was able to read them correctly FrontAccounting.png.

You may notice that there are errors that have to do with write permissions but the important thing is the server works!

Once again thank you so much for you assistance. I’m deeply grateful to you.

Looks impressive! Congratulations.

The main task in these things is often the planning abouit what one realy wants and how this fits in the Unix/Linux way of life.
Many Linux users, often having only experience with Windows single user systems, forget that Unix/Linux is a multi user system and that end-users and what they can do differ considarably from how one should organize a system serving a database or HTTP website, or other service. The two functionalities may reside on the same system (thus the word Server as used in a MicroSoft environment is a misnomer in a Unix/Linux environment).

One should also be carefull in choosing a user for a mnagement function of e.g… a HTTP server as you have. The Apache deamon on openSUSE is normaly running with user wwwrun and group *www. *This done to avoid using root for managing the HTTP server. Best is to let wwwrun:www be owner of all inside /srv/www. Thus you will have the least problems with permissions. Restrict the permissions to the user wwwrun and the group *www. *Then create a new user in group *www. *Use this user for managing the contents of the web-site in /srv/www. Because this user is in group *www, *it can read/write there. You do not need root then for managing your web-site.

Do not use a normal user like pascal for this. You should restrict pascal (in group users)for your personal tasks like your mail, your music, whatever. Do not mix users. You have different roles on the system. Use a different user for each of these roles.

After your suggestions

root@pascaLinux:~ #l /srv/www
total 24
drwxr-xr-x 6 wwwrun www 4096 Ιούν 30 18:29 ./
drwxr-xr-x 4 wwwrun www 4096 Νοέ  10  2011 ../
drwxr-xr-x 2 wwwrun www 4096 Ιούν 16 11:18 cgi-bin/
drwxr-xr-x 4 wwwrun www 4096 Μάι   5 09:46 htdig/
drwxr-xr-x 5 wwwrun www 4096 Ιούλ  1 22:35 htdocs/
drwxr-xr-x 2 wwwrun www 4096 Οκτ  29  2011 perl-lib/
root@pascaLinux:~ #

things look a lot better FrontAccounting.png. The remaining issue seems to be a known bug in the installation files which I’m trying to resolve at the moment the frontaccounting.com forum. When/If I’m done with them I’ll post a final screenshot.

The bug was that I had not installed php5-openssl. Now it’s complete.

Glad it worked. Wishing success!