Laravel 5.5 : getting error while creating project - php

I'm creating a project of Laravel (version 5.5) in Ubuntu (version 16.04) but while i running it on browser, getting error like this:
syntax error, unexpected '?' in
/opt/lampp/htdocs/lara1/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
on line 233
I have searched a lot for this and got that there are some version problem (displaying PHP version 5.6 on browser and in CLI it's 7.0) so i'm trying to remove the PHP version 5.6 by using command
apt-get purge 'php5*'
but its showing :
Package 'php5.6-common' is not installed, so not removed
So how can i remove php 5.6 from cli and run laravel project without getting error.
I'm new to Laravel and Ubuntu.
Please help me to get this. Any help will be appreciated.
Thanks in advance.
Edited :
while running sudo apt remove php5.6 getting
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php5.6-json' for regex 'php5.6'
Note, selecting 'php5.6-common' for regex 'php5.6'
Package 'php5.6-common' is not installed, so not removed
Package 'php5.6-json' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libllvm3.8 libllvm3.8:i386 libmircommon5 libpango1.0-0 libsnapd-glib1
linux-headers-4.4.0-71 linux-headers-4.4.0-71-generic linux-headers-4.4.0-72
linux-headers-4.4.0-72-generic linux-headers-4.4.0-75
linux-headers-4.4.0-75-generic linux-headers-4.4.0-78
linux-headers-4.4.0-78-generic linux-headers-4.4.0-79
linux-headers-4.4.0-79-generic linux-headers-4.4.0-81
linux-headers-4.4.0-81-generic linux-headers-4.4.0-83
linux-headers-4.4.0-83-generic linux-headers-4.4.0-87
linux-headers-4.4.0-87-generic linux-headers-4.4.0-89
linux-headers-4.4.0-89-generic linux-headers-4.4.0-92
linux-headers-4.4.0-92-generic linux-image-4.4.0-71-generic
linux-image-4.4.0-72-generic linux-image-4.4.0-75-generic
linux-image-4.4.0-78-generic linux-image-4.4.0-79-generic
linux-image-4.4.0-81-generic linux-image-4.4.0-83-generic
linux-image-4.4.0-87-generic linux-image-4.4.0-89-generic
linux-image-4.4.0-92-generic linux-image-extra-4.4.0-71-generic
linux-image-extra-4.4.0-72-generic linux-image-extra-4.4.0-75-generic
linux-image-extra-4.4.0-78-generic linux-image-extra-4.4.0-79-generic
linux-image-extra-4.4.0-81-generic linux-image-extra-4.4.0-83-generic
linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-89-generic
linux-image-extra-4.4.0-92-generic snapd-login-service ubuntu-core-launcher
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 212 not upgraded.

You do not need to remove the old PHP.It is indicate the php interpreter is 7 but the php-fpm is 5.6. This because the port 9000 is listened by the php-fpm that belong to php56.So you should stop all the process about php-fpm
sudo killall php-fpm // or sudo pkill -9 php-fpm
then go to the php7 folder and run the php-fpm process.
Hope it helps.
what's more,you have the right direction. Laravel5.5 need php7 or higher.Good luck!

Related

update php and php-fpm in nginx server

I have a requirement where I need to update the PHP and PHP-fpm to the latest version of the server. this server is hosted using Nginx and WordPress. We are using amazon Linux 2 when I disable php7.4 and enable php8 in amazon-Linux-extras and install I'm getting an error.
php error
I have a couple of questions:
what happens when I uninstall and install PHP to the latest version does it after the site?
Do we have any workaround for this PHP error?
Thanks in advance.
I'm expecting a solution to update my PHP to the latest version without any issues. I have just started learning DevOps. I'm not familiar with these errors
I removed php-json by sudo yum remove php-json and installed of php
sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip}
Still the application works.
php-json is available in Amazon Linux Extra topic "php7.4"
$ sudo amazon-linux-extras install php7.4

Orange HRM is not Working for PHP 7

I updated my server from PHP 5.5 to PHP 7. Now Orange HRM is not Working.
Production is on hr.oyasys.com . Error happen only after login (http://hr.oyasys.com/index.php/dashboard)
stack trace
at ()
in SF_ROOT_DIR/lib/vendor/symfony/lib/controller/sfController.class.php line 182 ...
if ($this->getActionStack()->getSize() >= $this->maxForwards)
{
// let's kill this party before it turns into cpu cycle hell
throw new sfForwardException('Too many forwards have been detected for this request.');
}
I don't think OrangeHRM has accounted for updates to PHP 7. mysql_* functions were also removed and I ran into an error or install.
https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
OrangeHRM uses the legacy mysql_connect extension which was deprecated in PHP 5.5 and was completely removed from PHP 7.
If you need to run OrangeHRM, you will have to downgrade your PHP version to 5.x or move OrangeHRM to a different compatible server.
I solved in this way to install orangehrm 3.3.0 on ubuntu 16.04
Added PPA repository
sudo add-apt-repository ppa:ondrej/php
Installed php5.6
sudo apt-get update
sudo apt-get install php5.6
Installed some modules
sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
Enabled php 5.6 module in apache2
Installation works fine
Downgrading is not really solving the issue, it's just working around the issue. There are a lot of people that cannot simply downgrade due to restrictions with other software running, and in some cases, IT policy.
It sucks, but we're not getting any love or a real solution until OrangeHRM does the changes necessary to support being run under PHP 7.

Amazon Linux LAMP with php 5.5

I installed PHP 5.5 on my Amazon Linux VPS via the instructions here. The CLI is working fine.
I also had apache already installed and running via the httpd package. It was running without any issue.
I see that there is no mod_php in the list of available modules. Now when I try to restart httpd I get the error:
httpd: Syntax error on line 222 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: symbol SSLeay_version, version OPENSSL_1.0.1 not defined in file libcrypto.so.10 with link time reference
I've looked up parts of this error, and the general advice seems to be to run
yum update openssl
However, when I run this I just get:
No packages marked for update
When I run install instead of update, I get:
Package 1:openssl-1.0.1e-4.55.amzn1.x86_64 already installed and latest version
Nothing to do
I'm not sure what else to do at this point.
The php55 package in the Amazon Linux YUM repository requires the http24 package, not the http package.

Error for Apache2.2.15 configuration with PHP5

I am trying to configure apache 2.2.15 with php5 in my linux system. I have installed both of them. But when I added libphp5.so module in httpd.conf of apache, it has given the following error while starting the server:
Starting httpd: httpd: Syntax error on line 202 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: undefined symbol: ap_unixd_config
Can anybody tell me how to fix this, as I tried every possible solution by googling it but in vain?
Some newer PHP versions may not be compatible with Apache2.2. This error occurs because the function ap_unixd_config is in Apache2.2 still called unixd_config.
Try to use Apache2.4 if you need to use this PHP version, otherwise you can use an older version of PHP.
This also happens on Arch Linux when one doesn't upgrade Apache 2.2 to Apache 2.4. So if you are using Arch Linux you need to downgrade php-apache package to the version that works for you. php-apache-5.5.8-1 is still OK, whereas 5.5.11-1 is not.
On RedHat Apache2 and PHP installation is done by issuing the following commands (as root):
yum install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
That's all. (I'm following this tutorial.) You may add or remove some php extensions to or from the list of packages to be installed if so desired.

Running PHP 5.3 on CentOS 5.4 - fatal error Class 'PDO' not found

What is the best way to get PHP 5.3 up and running on CentOS 5.4.
My machine says I have PHP 5.3 installed but running into an issue with my script that says
Fatal error: Class 'PDO' not found in /var/www/html/lib/rb.php on line 45
It fails trying to new up a PDO class in the RedbeanPHP 3.0 lib.
How can I fix this missing PDO problem?
I tried to follow these instructions:
from http://www.computingunplugged.com/issues/issue201102/00002619002
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# THIS LINE FAILED FOR ME
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-6.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
UPDATE
Someone removed their answer. It was good. I'm putting it back in with exact steps.
First I had to yum install php53u-devel
To quote "
You need the PDO extension. Usually the best way to install extensions is via PECL.
Before you can install any PECL extensions you need to install the php5-dev package
sudo pecl install pdo
sudo pecl install pdo_mysql
You then need add the following to the end of your php.ini file(s). Depending on which version of PHP you installed they’ll be /etc/php5/apache2/php.ini, /etc/php5/cgi/php.ini and /etc/php/cli/php.ini.
extension=pdo.so
extension=pdo_mysql.so
"
Now I get a mysql_query_missing when trying to run sudo pecl install pdo_mysql
and not sure how to get past this.
You'll have to install the php-pdo package as well.
Edit: Maybe this helps as well: How do I enable PDO using CentOS?
I have been successfully able to install PHP-5.3 on CentOS 5.4 Linux. I needed this to be able to successfully install and run Drupal 7 - which also worked out for me. Here are the details:
This is a copy of the answer I wrote up in ServerFault: https://serverfault.com/a/392168/29205
(...for my question: https://serverfault.com/questions/391772/php-xml-install-complains-of-dependency-php-common-but-this-is-already-installed/392168#392168 )
The solution is based on the accepted answer in:
https://serverfault.com/questions/391839/how-to-force-centos-yum-to-use-a-later-version-of-a-package-dependency-already-i
In summary: move to php5.3.
Reason: support for php5.2 as been removed owing to security issues as explained in that other question's accepted answer. This removal causes mismatch of the versions of the dependencies and therefore the error seen.
Background
I wanted to run Drupal 7 on a CentOS 5.4 machine. So I needed 5.3 version of PHP.
Here are the full working steps to upgrade to PHP 5.3 with working repositories as of May 24 2012 ( I provide comments preceded by # - you don't need these, just for your info)
# Comment: sites like http://www.computingunplugged.com/issues/issue201102/00002619001
# provide a good start for remedying the problem whereby we need 5.3 on CentOS 5.4 to run Drupal 7. But although their packages worked at the time, the links are now outdated, and updates to these are below.
# comment: (as of May 2012 - the following work, the reason for failures was use of 1) older packages no longer on the server and 2) change of address of one of the servers to dl.fedoraproject.org/pub/epel (credit to: http://osdir.com/ml/centos/2012-03/msg00057.html )
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm
yum erase php php-pear php-mysql php-cli php-common
yum install php53u php53u-pear php53u-cli php53u-common php53u-gd
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap
yum install php53u-xml php53u-xmlrpc php53u-bcmath
# After doing the above, php -v shows 5.3.x But on attempting to install Drupal 7 you may get complaint of something "Your PHP installation is too old 5.1.6 Drupal requires at least PHP 5.2.4. See the system requirements page for more information." and php.info shows the same
# The remedy is to simply restart your apache server
service httpd restart
# credit to following for suggesting service httpd restart :-
# https://serverfault.com/a/207806/29205
# https://serverfault.com/questions/207762/centos-updating-php-via-yum-doesnt-change-the-version-apache-uses
# Drupal 7 install on CentOS 5.4 worked after applying the above steps
# If your MySQL server is not running (check by ps -ef | grep mysql ) then you can run:
/etc/init.d/mysqld
# ...to start it, and to make sure it starts when the machine is restarted or cold booted:
chkconfig mysqld on

Categories