[SOLVED] invoke php from a self made webpage on my home computer
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
invoke php from a self made webpage on my home computer
I have a form page, which should be sent to my email. Here is a bit of it:
<body>
<h1>Send Us Your Feedback!</h1>
<form action="send_mail.php" method="post">
<table>
<tr>
<td>Email Adress:</td>
I also have a php script.
But when I click send, it doesn't, up comes a window asking me if I want to 'open send_mail.php with gedit', or 'save the file'.
This is a problem with php.ini I think. What should I have there??
Found php.ini, edited it thus:
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail
What you see when you choose to "open with gedit"? If your php code then this is problem in webserver configuration (tell which you use), not parsing php files. If you see expected script execution result or empty file, then your server should send appropriate Content-Type header along with result (text/html for example).
I've been reading about this, and I need libphp5.so, which is nowhere on my computer. I don't know if it is a file that belongs to apache2 and didn't get installed for some reason, or it comes with php and didn't get installed.
Which distribution of Linux are you using as the location of the directories/files varies somewhat. How did you install Apache? Do you get the IT WORKS page in Apache? Some of the more popular distributions allow you to do a LAMP install without installing separately, Apache, php/perl, mysql. I'm not sure how you would get an empty httpd.conf file if you have Apache installed.
I use ubuntu 12.04 at the moment. I am connected to the net via China Telecom, so what I normally see runs through their server.
I am making a web page, and want to try things out at home before I put it anywhere, as I am only a beginner.
It must be possible to tell Firefox to open *.php with php.
I'm wondering if this can be done. I want to use apache2 on my own laptop, but my internet connection is through China Telecom. I tried booting without the dsl cable plugged in, made sure I had apache2 running,
pedro@pedro-bedro:~$ sudo /etc/init.d/apache2 restart
[sudo] password for pedro:
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
then started Firefox,but I still get, well see screenshot.
I thought of something: if I make a new internet connection with fixed ip 127.0.1.1, will my home based apache then serve Firefox and implement my php script??
Can I do that like that??
Maybe when I click the submit button, Firefox looks for apache/php on the China Telecom server, finds nothing, and asks me if I want to open the script as text.
How do you display your html file? Through your server (e.g. http://localhost/yourpage.html)? Or by double-clicking it in a filemanager? You must serve your pages through your webserver for it to work.
Thanks for that. It nearly worked.
Using Firefox if I enter,
localhost, I get apache2 default index.html, which just says 'It works' Good, but not quite what I wanted.
http://localhost/home/pedro/newwebpage gets me a 404 'not found on this server'
I checked this:
pedro@pedro-bedro:~$ sudo a2ensite mynewsite
[sudo] password for pedro:
Site mynewsite already enabled
pedro@pedro-bedro:~$
In /etc/apache2/sites-available/ I have default, defaultssl and mynewsite
mynewsite has among other things copied from default, this
DocumentRoot /home/pedro/newwebpage
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/pedro/newwebpage/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
which clearly points apache at /home/pedro/newwebpage But, it doesn't find it, and goes to default. Clearly, I have done something wrong, or forgotten to do something.
localhost, I get apache2 default index.html, which just says 'It works' Good, but not quite what I wanted.
That tells you Apache is working at least. Generally, these files (including the index.html IT WORKS file) are either in the /var/www directory/sub-directories or in a /home/user public_html directory. You could try putting your newwebpage file there to see if it is found.
I've not used the a2ensite program so I'm not sure if I'm reading this correctly. Your Document Root shows: /home/pedro/newwebpage which should be the folder you have the file in so what's the file?
There are a few files, and I believe one should always have an index.html so of course I have that there too, and also my send_mail.php
but apache2 does not find it or anything, and defaults to, well, its default index.
There must be something wrong with my /etc/apache2/sites-available/mynewsite I think. But what??
a2ensite just configures apache for a new site. The docs say
The /etc/apache2/sites-available directory is not parsed by Apache2. Symbolic links in /etc/apache2/sites-enabled point to "available" sites.
I am no expert, but I don't think that is the right way to go, putting all files in /var/www It is possible and I think preferable to put them elsewhere. I know they work, I have tried them. Just the send_mail.php won't work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.