If the operating system is linux open a terminal or ssh to the server and type:
(as root)
which php-cli
or
which php5-cli
if nothing is ouputted it can't find it, then check if you've got it installed.
Debian based distro's: apt-get install php5-cli
hope this helps.
Why is PHP considered a scripting language instead of programming?
The difference between "scripting" and "programming" is largely one of semantics; they're essentially the same thing.
A purist is more likely to call writing in a usually interpreted language (such as PHP) "scripting" and writing in a usually compiled language (such as C) "programming". But either way, you're writing a set of instructions for the computer to follow, and some "scripts" can be as (or more) complicated than many "programs."
If I understand correctly it is because php is primarily a web programming language and Apache is a popular HTTP server.
How do I add an ID using PhpMyAdmin?
Two Methods can be used they are below:
Auto Increment1. Add a field as the first field (Under your fields, and Print View should be buttons and a Radio should say 'At Beginning of Table', check it then hit go.1b. If you are in the add table screen use the top row for this.
2. Call it id or whatever you want provided you'll know it's the primary key
3. The Type (in the dropdown) is either int or bigint (if you want a lot of rows choose BigInt with 255 length)
3b. The Length is how many number's (in the case of Integers) e.g. 6 would mean 999999 is the maximum and 7 is 9999999)
4. In some version this will be a dropdown in some newer versions it's a tick box however find AUTO_INCREMENT and ensure it is ticked / selected
5. Either finish your table or hit save.
Something's to keep in mind:
1. Only one AUTO_INCREMENT field per table
2. The AUTO_INCREMENT field is the primary key, and in PhpMyAdmin this is often auto added as the Primary key.
Second MethodThis method is more manual and requires adding code when Inserting.1. Add a field / make this the first field
2. Call it id or something that you'll know is the id
3. Make it an Int or BigInt
4. Read step 3a (of method 1) if you don't understand length with Integers
5. Save / Complete table
A. Then in php perform a MySql count (this method is basic so php isn't the only language this can be done in.
B. Add one to the Integer variable you saved the count in
C. In your insert make the Added count Variable your Insert for ID
Keep in mind way two will come in to issues if your site is used a lot or if the insert is on every page, for example logging people's habits.
How do you customize taxonomy page in drupal?
To customize a taxonomy page in Drupal, you can create a custom template file for the taxonomy term view by naming it taxonomy-term--[vocabulary-machine-name].html.twig. Place this file in your theme's templates directory. Additionally, you can use the Views module to create a custom layout for displaying taxonomy terms, allowing you to define fields, filters, and sorting options. Finally, clear the cache to see your changes reflected on the taxonomy page.
How insert data into array in php?
There's several ways:
1) You can put square brackets on the end of a variable to create an array key inside that variable:
$names['first'] = "john"
$names['last'] = "smith"
2) You can use the array function:
$names = array('first' => "john", 'last => "smith");
a lot of people set this function out like this:
$names = array(
'first' => "john",
'last' => "smith"
);
it makes it easier to read
hope this helps
What starts and ends a String in PHP?
" / "
and
' / '
However the same starter must end e.g.:
echo " '; is wrong
echo ' "; is wrong
echo " ' "; is right
echo ' " '; is right
echo " " ' '; is wrong - in this case echo " " . ' '; is right.
Is it apache compulsory for php mysql?
No necessarily, PHP can be used on various other web servers, not just Apache, but Apache is the most popular. MySQL is a stand-alone database engine and is used by a lot of other stuff, not just PHP apps.
Convert decimal to binary using recursive function in php programming?
function dec2bin($val){
if($val & 1){
$rval = '1';
}else{
$rval = '0';
}
$val >>= 1;
if($val > 0){
$rval = dec2bin($val) . $rval;
}
return $rval;
}
What is the PHP command used to take a file name and inserts the file's contents into the script?
you can use:
include($filename); // will give a warning if the file is not found
include_once($filename); // same, but only includes if the file isn't already included
require($filename); // will stop the script if the file is not found
require_once($filename); // same, but only includes if the file isn't already included
How do you pass a variable by value in php?
In the declaration of the receiving function, you add an ampersand.
<?php
function myWayCoolFunction( &$params)
{.....}
$x = array('1','2','3');
myWayCoolFunction($x)
?>
Is xampp better or individual software installation is better?
XAMPP just installs everything in one shot. It's a super easy setup. I think XAMPP is so much better.
How do you read pdf file in php?
You have to embed it or include it inside a special framework. You can find many ways by searching for "PDF in PHP" in a search engine.
What is wrong with your php where clause for user login?
where clause is related to mysql. If you mention the sql line here it will be easy to know more on this.
PHP data coding is softwares that allows or has frameworks which can make PHP input to it's own script language. So you may code programs for example with PHP, just that it has to be extended PHP because of new functions and features. It may also be application coding for the web.
What is the delimiter used in PHP for scripting?
Please see this example as below.
<?php
$first_variable = "Heloooo";
function first_method(){
print 'Heloooo';
}
class firstClass{
public $testvar="";
function firstClass(){
// initialize
$this->testvar = "Hiiiiiii";
}
function first_method_inclass(){
print 'Heloooo';
}
}
?>
How do you return a value in a PHP function?
Below is a simple example of how you could return a value in a PHP function.
<?php
function returnme($value)
{
return $value;
}
echo returnme('hello'); // outputs: hello
?>
How do you empty an array in PHP?
To empty an array in PHP you need to use the unset function like shown below:
<?php
$array = array('hello', 'hi', 'weee');
unset($array); // empty
?>
How do you find the size of an array in PHP?
To find the size of an array in PHP you can either use the count() function or the sizeof() function as they will produce the same result.
<?php
$array = array(1, 2, 3, 4, 5, 6, 7);
echo count($array); // outputs 7
echo sizeof($array); // outputs 7
?>
How do you pick a random value from a PHP array?
To pick random results from an array in PHP you will need to use the array_rand() function, you can select the amount of results you wish it too select too.
<?php
$array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$rand_results = array_rand($array, 3); // will select 3 random results from the array and store in a new array
?>
How can you check if a value is already in an array in PHP?
To check if a value is already in an array you will need to use the in_array function like shown below!
<?php
$values = array("pizza","hello","cheese","fred");
$newvalue = "hello";
if (in_array($newvalue, $values))
{
echo "$newvalue is already in the array!";
}
?>
Which is the latest stable version of PHP?
The lastest stable versions of PHP (as of March 3, 2012):
PHP 5.4: Version 5.4.1
PHP 5.3: Version 5.3.11
What is the purpose of PHP software?
To answer this question we must delve into the very nature of the Internet - the network of networks of networks. The HyperText Transfer Protocol (HTTP) defines a server as a computer connected to a network which receives requests for data and responds to them. A client is a computer which makes such requests and receives the responses. A proxy server performs both functions, operating as a middleman.
A static web page is one which is necessarily the same upon every request; such a page normally has a .html or .htm extension. A dynamic web page is modified by a program which runs on the server, depending on any of several possible circumstances. PHP, a server-side scripting language, is a language designed for writing such programs.
Note: PHP does not make pages dynamic in the same way as does JavaScript, a client-side scripting language. JavaScript is sent within a response and its instructions might be followed by the client. It can only change the copy of the page which was downloaded with itself and contact its origin server, unlike PHP which can access the server's filesystem and databases, and talk to other servers. However PHP is incapable of providing such a sleek user experience as JavaScript.