Class 'SimpleXMLElement' not found

class dojo
class dojo sign in
class dojo student
class dojo login
class assessment
class dojo parents
class dojo monsters
class dojo videos

I am trying to use digital ocean spaces in my php7 laravel project. The code is pretty simple to just load a file and copy it to the directory. Everything works on my local machine but fails on my digital ocean server with this error

Class 'SimpleXMLElement' not found

Even on digital ocean server, if I use tinker to run the same storage commands, it works fine. What can be the issue?

My get_loaded_extensions() returns get_loaded_extensions()

[
     "Core",
     "date",
     "libxml",
     "openssl",
     "pcre",
     "zlib",
     "filter",
     "hash",
     "pcntl",
     "Reflection",
     "SPL",
     "session",
     "standard",
     "mysqlnd",
     "PDO",
     "xml",
     "apcu",
     "calendar",
     "ctype",
     "curl",
     "dom",
     "mbstring",
     "fileinfo",
     "ftp",
     "gd",
     "gettext",
     "iconv",
     "json",
     "exif",
     "mysqli",
     "pdo_mysql",
     "Phar",
     "posix",
     "readline",
     "shmop",
     "SimpleXML",
     "sockets",
     "sysvmsg",
     "sysvsem",
     "sysvshm",
     "tokenizer",
     "wddx",
     "xmlreader",
     "xmlrpc",
     "xmlwriter",
     "xsl",
     "zip",
     "Zend OPcache",
   ]

so it looks like xml and simplexml are installed. As suggested by the link, php-xml and php-simplexml should be installed. Do I need to install something separately?

Also, my file upload code looks like this

public function uploadNew($file, $title, User $user)
    {
        if (!File::directoryExists($user->username)) {
            Storage::makeDirectory($user->username);
        }
        $completeFileName = $user->username.'/'.$title.time();
        Storage::put($completeFileName, file_get_contents($file), 'public');
        $this->url = File::baseUrl().$completeFileName;
        $this->title = $title;
        $this->user_id = $user->id;
        $this->save();
        return $this;
    }

    public static function baseUrl()
    {
        return 'https://'.env('DO_SPACES_BUCKET').'.nyc3.digitaloceanspaces.com/';
    }

    public static function directoryExists($directory)
    {
        $existingDirs = Storage::directories();
        return in_array($directory, $existingDirs);
    }

Adding the stack trace of exception:

(1/1) FatalThrowableError
Class 'SimpleXMLElement' not found
in PayloadParserTrait.php (line 39)
at RestXmlParser->parseXml(object(Stream))
in RestXmlParser.php (line 33)
at RestXmlParser->payload(object(Response), object(StructureShape), array())
in AbstractRestParser.php (line 62)
at AbstractRestParser->__invoke(object(Command), object(Response))
in RetryableMalformedResponseParser.php (line 37)
at RetryableMalformedResponseParser->__invoke(object(Command), object(Response))
in AmbiguousSuccessParser.php (line 58)
at AmbiguousSuccessParser->__invoke(object(Command), object(Response))
in GetBucketLocationParser.php (line 30)
at GetBucketLocationParser->__invoke(object(Command), object(Response))
in WrappedHttpHandler.php (line 126)
at WrappedHttpHandler->parseResponse(object(Command), object(Request), object(Response), array())
in WrappedHttpHandler.php (line 93)
at WrappedHttpHandler->Aws\{closure}(object(Response))
in Promise.php (line 203)

check the version of installed php using:-

$ php -v

If it's version 7, then install php7.0-xml

if it's version 7.2.*, then use php7.2-xml package on your machine along with php.

Class (Education), Not your computer? Use a private browsing window to sign in. Learn more. Next. Create account. ‪Afrikaans‬. ‪azərbaycan‬. ‪català‬. ‪Čeština‬. ‪Dansk‬. ‪Deutsch‬. But I was wrong, Class bring something to the table that Doctor who doesn't, a violent, well told tale about a group of regular teenagers defending their school. Sure the dialogue sounds unrealistic in some places, however Class is a fun teen drama that makes you think twice about the world of Doctor who.

Just install php-xml package.For reference, just install all the additional php libraries:

apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml

Social class, CLASS is a flexible tool that focuses on the heart of great teaching: the teacher-​student interactions proven to drive learning and development. Infant, Toddler, and  Class definition is - a body of students meeting regularly to study the same subject. How to use class in a sentence.

Finally, I just had to follow the same answer I have mentioned in question. installed php7.0-xml and simplexml had to be installed and apache server restarted to get it to work. So, even if your loaded extensions show xml and simplexml as installed, you might still need to install the php7.0-xml and simplexml.

Class (Computer programming), Class definition, a number of persons or things regarded as forming a group by reason of common attributes, characteristics, qualities, or traits; kind; sort: a class​  Class definition, a number of persons or things regarded as forming a group by reason of common attributes, characteristics, qualities, or traits; kind; sort: a class of objects used in daily living.

You have to put \ slash in front of SimpleXMLElement (in laravel) in order to call xml element class

$url = "https://abc.xyz.com";
$response = file_get_contents($url);
$xmlDoc = new \SimpleXMLElement($response);

ClassDojo, Class definition is - a body of students meeting regularly to study the same subject. How to use class in a sentence. CLASS uses research-driven insights to improve how teachers interact with children every day to cultivate supportive, structured, and engaging classroom experiences.

I solved running this command

sudo systemctl restart php-fpm

Sign in, With Classroom, educators can create classes, distribute assignments, grade and Save time by copying topics and assignments from one class to another. Generate originality reports by scanning for matching text on the web — right in the Classroom interface. Students can also create reports to cite and strengthen their submissions. Get up to 3 reports per class.

CLASS, class meaning: 1. a group of students who are taught together at school, college, or university: 2. a period of…. Learn more. A class expression is another way to define a class. Class expressions can be named or unnamed. The name given to a named class expression is local to the class's body. (it can be retrieved through the class's (not an instance's) name property, though).

Class, Class or The Class may refer to: Contents. 1 Common uses not otherwise categorized; 2 Arts, entertainment, and media; 3 Computing; 4 Education; 5 Law and  The HTML class attribute is used to define equal styles for elements with the same class name. So, all HTML elements with the same class attribute will get the same style. London is the capital of England. Paris is the capital of France. Tokyo is the capital of Japan. Tip: The class attribute can be used on any HTML element.

Class, Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader. Students can showcase and share their learning by adding photos and videos to their own portfolios. Share moments with parents. Get parents engaged by sharing photos and videos of wonderful classroom moments. Share the story of your classroom with families. Instantly share photos, videos, and announcements on Class Story, or privately message

Comments
  • Check for namespace, you might need to call with \SimpleXMLElement
  • Its somewhere in AWS library...nowhere in my code.
  • May be this can help. stackoverflow.com/a/35834836/3305978
  • I attached the same link in my question. As I have shown in the extensions list, xml and simplexml is already present but when I run extensions_loaded('php-xml'), it returns false. Do I have to install php7.0-xml or simplexml separately?
  • sudo apt-get install php7.0-xml for ubuntu and php 7.0
  • In my file? I am not using this class directly and in the library where they are using it they are actually using it correctly. But anyways, I tried it and it did not work.