include_once is not executing php [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have done this a million times with no issue, but for some reason today, if I do this:
include_once('phpocr/config.php');
It doesn't execute the php in the file. it prints out the php code in the file. For all intents and purposes, just imagine that this is the content of the file:
<? class myClass {
} ?>
And when I include that file, it literally prints out: "class myClass { }". Why? And how do I fix it?

The problem was that the script that i'm using has the following opening tags
<?
My web server is set up to only accept
<?php

Are you new to web programing ?
I guess that you're intent to run the php script through apache web server, all right?
If then you should set up the php module for apache as following
LoadModule php5_module /path/to/php5_module.so
With the above module, apache just regard the php script as normal text

Related

Upload file using PHP to FTP and get url [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I would like to create a PHP form that is going to run on a local machine(WAMP).
This form is going to upload a file to a web server and echo the url of the uploaded file.
My skills in php are low, I can understand a code but I have difficulties writing one.
Your help will be appreciated.
Here's a start. Have a look at these tutorials
http://www.tizag.com/phpT/fileupload.php
http://www.dzone.com/snippets/very-simple-php-file-upload
http://www.htmlgoodies.com/beyond/php/article.php/3472551
http://www.sitepoint.com/file-uploads-with-php/
UPDATE:
If you want to use a local version and FTP the file to another remote location have a look here
http://nirvaat.com/blog/web-development/uploading-files-ftp-server-php-script/

PHP files open as text in my browser [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
My php files if opened via the localhost (i used httpd-2.2.25-win32-x86-no_ssl.msi and the apache server is running with PhpMyAdmin files placed in apache/htdoc) are shown as text files in my browser:
for example if i wrote a something in my php file, as soon as i open that file either via my local webserver or opening the file directly, it will be shown as text! Please help.
You haven't configured Apache to send PHP files to the parser. As such, the format will remain unrecognized and be displayed as text or be downloaded to the client. Assuming you're using a PC or a Mac, most every guide to setting up Apache with PHP will explain how to do this.

Call a script(PHP, Perl) when MYSQL insert occurs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What I'm looking is to execute a script as soon as there is an INSERT on one of the MYSQL table.
I wanted to export all the contents of the inserted row into formatted Excel file. (This will be done through external script written in PHP)
Main issue is to call the script as soon as the insert occurs.
First thing that occurred to me is to create a Trigger and call the script (Found that this is not best approach. Other thing occurred to me is running a crontab
Could anyone please suggest if there is a better solution for this?
PS: The INSERT happens through an external application and I have no control over it.
This question was answered here: Invoking a PHP script from a MySQL trigger btw.
Anyway, other possible solution is to create environment with replication (although there will be no slave), write your own mysql client connected to the master (simulating slave server) and waiting for commands comming through.
You can also create "tail -f" script listening on binlog file.

trying to install/use php on a mac [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm trying to set up php on my mac. From what I gathered, mac already comes preinstalled with php so I went through the whole httpd.conf and editing LoadModule php5_module libexec/apache2/libphp5.so to uncomment it.
I can't find a clear instruction on what to do after that. PHP seems to be still not running when I open a test file in my browser. Some sites say to add a IfModule php5_module block? but others don't mention that.
Well I click file>open in chrome
You are ignoring your web server and loading the file directly from your file system.
This means that Apache will not see the file, so it will not pass it through the PHP engine.
You must load the file over HTTP from your web server. Type http://localhost/etc/etc into the address bar (where /etc/etc is the path to your file from the DocumentRoot).
I use MAMP on a mac to do testing with serverside code - http://www.mamp.info/en/mamp-pro/

How to get set up for learning PHP? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have downloaded WAMP to try to learn PHP on, and am having trouble getting it to work as expected whenever trying to follow along in PHP tutorials.
Either what I get back in my browser is raw PHP (as shown below in "PHP Test 1"), or nothing at all (as shown below in "PHP Test 2"). I'm just trying to learn the basics of PHP, and am finding this to be very frustrating. Can anyone help? What do I need to do get PHP working, or what should I try?
Originally I was going to post screen shots to better describe the problem I'm having, as well as to better help others who are experiencing the same problem, but was not allowed to due to something about not having enough "points". Anyway, what I was originally trying to post can be found here:
https://sites.google.com/site/bluedog4678/
You need to start WAMPP then type this in the address bar: localhost/PHP_TEST_1.php.
You are currently opening a simple file without running WAMPP you need to run it through localhost.
You shouldn't access your files directly. Normally with simulated apache-servers you need to type in "localhost" to let it render correctly
EDIT
If you want to select a file it would be "localhost/"

Categories